research_helpers.display

Parses a LaTeX table back into data for reading in a notebook or using in a test.

class research_helpers.display.Row(cells, rule=False, shaded=False)[source]

Bases: object

A rendered row.

Parameters:
class research_helpers.display.Table(header, body, align, caption='', label='', latex='')[source]

Bases: object

A parsed table, rendered as HTML in Jupyter and as text elsewhere.

Parameters:
property columns: int

Return the column count of the widest row.

research_helpers.display.parse(latex, *, symbols=None, strip=None)[source]

Parse a LaTeX table into rows.

Parameters:
  • latex (str) – a float or bare tabular environment (‘tabulary’, ‘tabularx’, ‘tabular*’, ‘tabular’, or ‘longtable’).

  • symbols (Mapping[str, str] | None, default: None) – replacements merged over ‘SYMBOLS’, for a project’s own macros.

  • strip (Iterable[str] | None, default: None) – extra regular expressions removed from every cell before anything else.

Return type:

Table

Returns:

The parsed table.

Raises:

ValueError – if no recognised tabular environment is present.

research_helpers.display.show(latex, *, symbols=None, strip=None)[source]

Return a table in a form Jupyter renders and ‘print’ formats.

Return type:

Table

Parameters: