Skip to content

Function: latexToOmml() ​

latexToOmml(latex, opts?): string

Convert a LaTeX string to OMML for the math: option on addText.

Display math (the default) is returned as a full <m:oMathPara> centered display paragraph; with { display: false } a bare <m:oMath> is returned (both forms are accepted by the math: option). Throws on invalid LaTeX, surfacing temml's parse position.

Parameters ​

ParameterTypeDescription
latexstringa LaTeX math expression, e.g. x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}
optsLatexToOmmlOptionssee LatexToOmmlOptions

Returns ​

string

OMML <m:oMathPara>…</m:oMathPara> (display) or <m:oMath>…</m:oMath> (inline)

Throws ​

if the LaTeX cannot be parsed