Skip to main content

Module latex

Module latex 

Source
Expand description

LaTeX conversion utilities for contract math notation.

Converts Unicode math notation found in YAML contracts into LaTeX math mode suitable for rendering with KaTeX or full LaTeX.

Functions§

latex_escape
Escape special LaTeX characters in plain text.
math_to_latex
Convert contract math notation to LaTeX math mode.
replace_func
Replace func(...) with \cmd{...} handling nested parens. Applies recursively so sqrt(a + sqrt(b)) becomes \sqrt{a + \sqrt{b}}.
replace_unicode_cmd
Replace a Unicode symbol with a LaTeX command, inserting a trailing space when the next character is alphabetic (prevents \foralli).