research_helpers.latex
This module covers LaTeX table assembly. See LaTeX tables.
- research_helpers.latex.table(*, spec, header_rows, body_rows, caption, label, wide=False, prologue=None, environment=DEFAULT_ENVIRONMENT, width=None, column_width_in=None, setup=None, style=DEFAULT_STYLE, chktex=True)[source]
Assemble one table as a LaTeX float.
- Parameters:
spec (
str) – column specification, e.g. ‘LRRCC’ for tabulary or ‘Xllrr’ for tabularx.header_rows (
list[list[str]]) – one list of already-formatted cells per header line.body_rows (
list[list[str]]) – the data rows, cells already formatted as strings.caption (
str) – caption text, as LaTeX.label (
str) – the ‘\label’ value, e.g. ‘tab:morph-curve’. Also the table’s identity.wide (
bool, default:False) – use ‘table*’, spanning both columns.prologue (
list[str] |None, default:None) – raw lines inserted after the first header row, e.g. a ‘\cmidrule’.environment (
str, default:DEFAULT_ENVIRONMENT) – the tabular environment, e.g. ‘tabulary’, ‘tabularx’ or ‘tabular’.width (
str|None, default:None) – explicit width for the environments that take one. Defaults to ‘\textwidth’ or column width.column_width_in (
float|None, default:None) – overrides the project’s ‘\columnwidth’ for this call.setup (
str|None, default:None) – raw commands emitted inside the float, before the tabular begins.style (
str, default:DEFAULT_STYLE) – font commands applied inside the float.chktex (
bool, default:True) – emit the chktex suppression comment after the label.
- Return type:
- Returns:
The complete float, ending in a newline.
- research_helpers.latex.header(text, expand=None, size=DEFAULT_HEADER_SIZE)[source]
Format a header cell.
- Parameters:
- Return type:
- Returns:
The cell, as LaTeX.
- research_helpers.latex.half_up(value, places=2)[source]
Round half away from zero, the way a reader expects and ‘format’ does not.