5 Mathematics

§ 5.1 Math Details

LaTeXML processes mathematical material by proceeding through several stages:

  • Basic processing of macros, primitives and constructors resulting in an XML document; the math is primarily represented by a sequence of tokens (XMTok) or structured items (XMApp, XMDual) and hints (XMHint, which are ignored).

  • Document tree rewriting, where rules are applied to modify the document tree. User supplied rules can be used here to clarify the intent of markup used in the document.

  • Math Parsing; a grammar based parser is applied, depth first, to each level of the math. In particular, at the top level of each math expression, as well as each subexpression within structured items (these will have been contained in an XMArg or XMWrap element). This results in an expression tree that will hopefully be an accurate representation of the expression’s structure, but may be ambigous in specifics (eg. what the meaning of a superscript is). The parsing is driven almost entirely by the grammatical role assigned to each item.

  • Not yet implemented a following stage must be developed to resolve the semantic ambiguities by analyzing and augmenting the expression tree.

  • Target conversion: from the internal XM* representation to MathML or OpenMath.

The Math element is a top-level container for any math mode material, serving as the container for various representations of the math including images (through attributes mathimage, width and height), textual (through attributes tex, content-tex and text), MathML and the internal representation itself. The mode attribute specifies whether the math should be in display or inline mode.