cottax.consumers.visualization.latex¶
Drawings for a LaTeX document: names set as LaTeX (text), and figures sized as the page says: the XDSM (xdsm), the N2 (matrix) and node-link through dot (dot). The three figure modules import cairosvg / graphviz where used, so the formatter alone needs nothing installed.
- class LatexFormatter(names: Mapping[str, str] | None = None, notation: Notations | None = None, spell: Callable[[Label], str] = spell_plain)[source]¶
Bases:
FormatterEvery name spelt as LaTeX: names maps a plain spelling (spell, spell_plain by default) to the LaTeX that replaces it – {‘V1’: r’mathcal{D}_1’} – and anything not in it is read as LaTeX as it stands, digits made subscripts (subscripted).
A minted name given in names is named outright: drawn as given, and not under the notation of its purpose – {‘^solve.S1’: ‘S_1’} draws S_1. Every other minted name is written in its purpose’s notation, in LaTeX: notation by Mint class – {Solve: Around(r’S_{{}}’)} – else its MintDrawing’s, else as mathrm{<spelling>}(·).
- latex_to_markup(s: str)[source]¶
A LaTeX-ish string as markup: all math without a $ (a variable name already is), alternating text / math from text mode with one.
- Return type:
str
- subscripted(name: str)[source]¶
A declared name as the notation it stands for: V1 is V_{1}, S1S2 is S_{1}S_{2}. An identifier cannot carry a subscript, so a digit against a letter is one; anything holding LaTeX of its own is the caller’s spelling and passes through.
- Return type:
str
- tex(s: str | None)[source]¶
A LaTeX string as a label a drawing sets rather than prints.
- Return type:
str|None