Usage of the semantics element

fred-wang edited this page Dec 6, 2012 · 3 revisions
Clone this wiki locally

Various tools generate MathML code with some annotations attached to it. The most typical examples are LaTeX to MathML converters that embed the LaTeX code inside an <annotation> or Computer Algebra Systems adding content MathML inside an <annotation-xml>. Below we describes briefly how some of these MathML applications use the <semantics> element to preserve this kind of information. The information can naturally be shared between applications during file transfer or copy & paste operations. MathJax could expose the most important formats to its "Show Math As" menu. See

  • Gellmu: uses a TeX-like input. It does not seem to include any <annotation> element. The documentation mentions possible generation of semantics info in the future, so probably something like content MathML or OpenMath. See

  • LaTeXML: adds the LaTeX code inside math@alttext as well as an <annotation> with encoding "application/x-tex". LaTeX macros are expanded. If you request the math to be converted into parallel markup, the alternative forms will be encoded into annotation-xml. A typical example would be Presentation MathML as the 1st child and Content MathML and/or OpenMath as annotations.

  • Maple: Seems to generate "MathML-Content" in <annotation-xml> and "Maple" in <annotation>:

  • MathType: embeds its rendering format in an annotation with encoding "MathType-MTEF" and exact speech data in annotation with encoding "DSIPairs".

  • Mathematica: It seems possible to generate <semantics> with "MathML-Content" in an <annotation-xml>:

  • Sage: ???

  • StartOffice/OpenOffice/LibreOffice: includes the original StarOffice code in an <annotation> element. Encoding is e.g "StarMath 5.0".

  • Tex4ht, HeVeA, Hermes: ??? do not seem to include the LaTeX code

  • WIRIS: store LaTeX fragments in annotation with encoding "LaTeX".

  • Word: ???

  • blahtex: By default Blahtex(ml) does not use any annotation. If the --annotate-TeX option is used an <annotation> with encoding "TeX" is created. The LaTeX macros are expanded. It is also possible to use the --annotate-PNG option to generate an <annotation> with the URI of a PNG representation of the formula.

  • itex2MML: does not include the LaTeX code, but Jacques Distler told me he plans to implement that in the future and suggested that Gecko support copy and paste. itex2MML does not support LaTeX macros. itex2MML is used, for example, in instiki and Abiword. itex2MML also uses the <semantics> trick to embed foreign content (e.g. SVG) in MathML.

  • The Wiris OpenMath Editor tuned for the ActiveMath learning environment uses the semantics by creating a map of the (safe) types (including pictures, text, mathml-p & -c, openmath) then fetching from the first available in the following list: openmath, mathml-content, mathml-presentation, text, pictures.