Steps to create MathML for and view it in Mozilla

Step 1 - Installing a Viewer

Acquire Mozilla (or other MathML capable rendering system). You can get a MathML enabled version of Mozilla compiled for Win32 systems by clicking here. To install Mozilla, you must double-click on the downloaded file, and you should encounter instructions from there. I have a problem with the installation provided from this self-extracting archive, which is the program hanging at the Mozilla "splash screen" immediately following installation. If this happens, press ctrl-alt-del and end the mozilla task. Then run it again, and (at least on my machine) it should load correctly. You may not encounter this problem at all.

You should then test your installation of Mozilla to make sure it can properly display MathML. You can do so by pointing Mozilla here. Make sure that all the symbols are rendered properly (that is, there aren't any obviously missing symbols or the character "?" scattered around the page, which is Mozilla's way of saying it can't find a character that it thinks should exist). In particular, make sure that the "fences" (brackets or parenthesis which should stretch vertically to accomodate the height of the equation inside) and the radicals (the horizontal bar of which should stretch horizontally to cover exactly the part of the equation it should) are rendering correctly. If they are not, particularly if the horizontal bar of the radical symbol is much too thick, you probably need to install two fonts which you can download by clicking (click+right mouse to save file) on the three links below:

Chances are you already have MTExtra installed, but if you don't, install it now using (on a windows machine) Start -> Settings -> Control Panel -> Fonts and then selecting "Install New Font" from the File menu.

Step 2 - Installing the Converters

If you are planning on viewing the MathML output in Mozilla, a special converter has been created which is supposed to output Mozilla readable output. I do not mean this statement to imply that MathML is severely browser dependent, but unfortunately Mozilla will (currently) only render MathML in a well-formed XML document, not as a "<math> ... </math>" fragment in an HTML document. The converter mzlatex takes Latex input and converts it into a well-formed XML document using MathML for the equations. You can learn more about (as well as download) mzlatex (actually called Tex4Moz, but the command is either mzlatex or mztex) by clicking here. The program mzlatex requires a working installation of Latex to operate, and if you don't have one, you can get a good Latex engine compiled for Windows by clicking here. The installation of mzlatex is a little more difficult than most other programs, but everything worked the first time for me when I followed the instructions carefully on the mzlatex page. As per the instructions on the mzlatex page, you can test the conversion process by downloading the file "test.tex", typing "mzlatex test", and comparing the output ("test.xml") with the file "testMML.xml" on the mzlatex page.

Step 3 - Tweaking the input and output

In a better world, the above two steps would be everything that would be needed to produce MathML from a Latex source. However, several very important problems get in the way of this ideal. First, although mzlatex professes to understand macro definitions, it seems to be easily confused (especially) by more complicated ones. So, if your latex file relies heavily on complicated macros, in my experience mzlatex will complain a lot, and possibly exit with a fatal error, even if the same file goes through another latex engine with nary an issue. For example, I recently could not, no matter what I did, get mzlatex to convert a \begin{table} ... \end{table} block without whining uncontrollably and then dying. I ended up having to remove all tables from the source latex and then manually adding them to the output XML. However unpleasant, this kind of thing has to be expected when playing with another's "in-development" software. After manually modifying several latex documents, I ended up writing a Perl script to read in the source Latex, remove all macros (among other things), and replace them with the standard latex. You are welcome to this script; it is listed in the links below (latexclean.pl). However, this script is probably disasterously tied to the particular latex files I was converting, and is definitely useless generically without heavy modification and serious additions.

The second issue is that without the proper tools installed [ghostscript and a script (called convert) which calls ghostscript to convert postscript files to gif files] the graphical figures in the source latex document will not be converted automatically. I have had to, therefore, convert all postscript files manually, which is really very easy using a tool such as Adobe Illustrator, although there is a way to get ghostscript to do it.

The third issue is that even after you've spent all that effort getting mzlatex to accept your latex file, the output from mzlatex is far from perfect. First of all, the layout of the XML is difficult to read. Second, many of the expected symbols are not present, like integration signs and summations. To fix this, I have written another script, mzlatexclean.pl, which reads in your .xml file and fixes many (if not all of these problems). This script should be generic enough to work on any .xml file output from mzlatex, but the program will only fix those problems I have encountered. You should, after this entire process, have a .xml file which is readable and displayable by Mozilla.

MathML without Mozilla

If you wish to write (or convert to) MathML/XML and do not wish to use Mozilla to display your output, you can use another tool for conversion, TtM. TtM is a commercial product (~$40) based on the program TtH which converts Latex to HTML. TtM differs from TtH in that TtM uses MathML for equations, where TtH uses text. However, because TtM outputs HTML, and not well-formed XML, Mozilla cannot properly display the output from TtM unless you convert the HTML to well-formed XML, which is not easy. I have written a script which does a lot of the work in certain cases (html2xml.pl), but it could hardly be described as robust. However, an advantage of TtM is that it seems to write better MathML code (or at least correctly converts more symbols) than mzlatex currently does. Our group has purchased a single copy of TtM, and let me know if you'd like to try it out; I'm sure we could purchase more copies if people are interested.

This document has been very Mozilla-centric, and I think for good reason. Mozilla is the first major browser with a native implementation of MathML, and as such I think will play a major part in the movement towards putting mathematics on the web. Additionally, Mozilla should soon be over it's inability to display XML fragments inside HTML documents, and when that happens we'll be able to put "<math> ... </math>" blocks directly into our HTML documents and display them with Mozilla. While we're waiting for Mozilla to implement this feature, in order to view these "math-blocks" outside of well-formed XML documents, we can use a variety of tools. Amaya, the W3C's test browser is able to correctly render MathML inside HTML documents. More information about Amaya can be found here. Additionally, several plugins to existing browsers exist which can display MathML in an HTML document. IBM's Techexplorer Plugin, which can be found here, has the ability to display not only MathML, but also typeset TeX/LaTeX right in the browser. Design Science, Inc. has produced a program called WebEQ, which can be found here. WebEQ is a plugin which allows the display of MathML in current browsers.

List of Inline-Links in document