The ORCCA converter

(Excerpt from "The MathML Handbook" by Pavi Sandhu)

Another approach to converting LaTeX equations to MathML has been adopted by Stephen Watt and his colleagues at ORCCA. They have developed a Java program that takes LaTeX equations as input and translates them into presentation MathML. The translation is determined by a map file, which contains a collection of templates. Each template defines the MathML markup that corresponds to a particular type of TeX construct.

The map file is written in a specific XML syntax, for which a DTD is provided. For example, the following template replaces the opening parenthesis in a TeX expression with the <mo>(</mo> element in MathML:

  <pat:tex op="(" />
  <pat:mml op="(">

Similarly, the following template replaces the TeX command \alpha with the corresponding Unicode character:

  <pat:tex op="\alpha" />
  <pat:mml op="&#x03B1;">
    <mo> &#x03B1; </mo>

All the elements defined for use in the map file have the namespace prefix pat. Each template is represented by a pat:template element. The pat:tex element, via its op attribute, specifies a particular TeX command to which the template applies. The pat:mml element defines the MathML markup that corresponds to a TeX command. A user can edit the templates in the map file, for example, to specify a different set of notational preference. Details about the syntax of the map file and the various elements and attributes it can contain are given at The TeX/MathML Map File Specification.

This conversion process is very similar to the XSLT transformations discussed under Applying styles and transformations: Using XSLT with MathML. The map file plays the role of the XSLT stylesheet, and the Java program that does the transformations is like an XSLT processor. The difference is, of course, that XSLT stylesheets can be applied only to well-formed XML documents, while the map file and Java program used here have been specially defined for use with TeX documents, which do not conform to XML syntax.

By specifying an appropriate map file, you can use a Java program to process LaTeX equations and translate them into the corresponding MathML. An online demo of the ORCCA converter is available under TeX/LaTeX to MathML Online Translator. You can type in a particular equation in TeX syntax into the text area and then click a button to view the result in the same Web page (see the following figure). The demo page also gives you the option of uploading a TeX file from your computer and receiving the output in a separate file.

Converting LaTeX into MathML with the ORCCA online converter

Figure: Converting LaTeX equations into MathML using the online converter at ORCCA.


<< back next >>





Copyright © CHARLES RIVER MEDIA, INC., Massachusetts (USA) 2003
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "The MathML Handbook" is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.

CHARLES RIVER MEDIA, INC., 20 Downer Avenue, Suite 3, Hingham, Massachusetts 02043, United States of America