MathML for mathematics research articles

Arun Ram
Department of Mathematics
University of Wisconsin, Madison
Madison, WI 53706 USA
ram@math.wisc.edu

and

Department of Mathematics and Statistics
University of Melbourne
Parkville VIC 3010 Australia
A.Ram@ms.unimelb.edu.au

Introduction

Given the ubiquity with which the internet has taken over our lives and the extent to which society is using web pages written in HTML it is, perhaps, a bit surprising that research mathematicians still use TeX to distribute their results. Current web browsers and authoring tools are much more friendly towards formatting, graphics, animation, colors and cross referencing. The possibilities are endless, and it is a pity that we don't currently have them available in our standard mathematics presentations. For example,

are only a few of the possible tools that mathematicians might like. Perhaps it is time that we, as a community, make the switch and stop using TeX in favor of web markup.

In fact, some TeX addons (HyperTeX [HT], Beamer [Bm]), attempt to incorporate some weblike features. In 1998, MathML version 2 was released by the World Wide Web Consortium, the standards organisation for Web markup. So what is holding up our conversion? On one hand, research mathematicians are right to be hesitant to try to convert to MathML because the existing software is sometimes user unfriendly and this can be very frustrating. On the other hand, it is a vicious circle, because mathematicians have not demanded better software, software for MathML has developed extremely slowly. As soon as we, as a community, start trying to use the existing tools they will develop very quickly.

Thanks to the efforts of Mozilla (particularly Roger Sidje) there is a robust browser that processes MathML with good looking results.

What about authoring tools? A few hours of playing with Dreamweaver shows how easy typing into web pages can be. Unfortunately, Dreamweaver doesn't handle MathML. But does and it is because of Mozilla and Amaya that I think that use of MathML is a realistic possibility for research mathematicians. Though Amaya crashes way too often to give it any more than beta-beta-beta status it is on the right track and a good programmer might take this template and make it into a wonderful MathML authoring tool in a month or two. I think that the mathematical community will jump to web presentation as soon as the rendering and authoring tools become polished. Greater usage of these tools by mathematicians would quickly push the currently available browsers to render mathematical markup even better.

This article has two goals:

Production of this article was partially supported by research and teaching intiatives supported by the National Science Foundation under Grant No. DMS-0353038. I thank National Science Foundation for continuing support of my research and teaching. This article was completed during the special semester on Combinatorial Representation Theory at Mathematical Sciences Research Institute (MSRI) in Berkeley. I thank MSRI for support and a wonderful and stimulating working environment.

Background information

The first and most important step is to get a browser that can display MathML. Mozilla Firefox [Fx], (or Camino [Cm], optimised for the Mac) seems to be the best option. Download the necessary fonts from STIX fonts [SX], MathML at MIT [MT], or the appropriate font installer in the right hand column of the fonts for MathML enabled Mozilla [ft]. Test your browser with the MathML torture test [Tt]. Other browser options are:

Opera [Op] does not advertise any support of MathML.

MathML is an add-on to HTML, the base language for writing webpages. All the basic formatting is done with HTML (titles, paragraphs, links,... ) and so only the formatting of mathematical formulas needs to be done with MathML commands. The result is that MathML has fewer commands than TeX. It is not necessary to learn HTML and MathML separately. After reading this article, start by modifying the template for an article at http://www.math.wisc.edu/~ram/MathGlossary/template.xml [tmp]. If there is something you want to typeset which is not found in the template then look at the following useful pages, full of examples:

MathML comes in two flavours: presentation markup and content markup. At the moment, most browsers do not render content markup (see MathML for Mozilla [Mmz] and Amaya overview [Ao]). It seems that presentation markup is sufficient for mathematical typesetting needs and this article treats only presentation markup.

Style sheets for formatting are standard in TeX (e.g. amssym). The analogue for HTML is CSS (Cascading Style Sheets). There is no need to learn CSS separately, the necessary commands to get started are in the header of the template for a MathML typeset research article at http://www.math.wisc.edu/~ram/MathGlossary/template.xml [tmp]. Appendix 1 contains a list of the most useful HTML commands and (all) MathML commands. The authoritative sources for commands and syntax are the W3C (World Wide Web Consortium) recommendations:

The W3C specifications are often more useful than books from the library or the bookstore. If you do go read the MathML specification, read Chapter 3 first.

Formatting an article with HTML and MathML

The following gives some basics for creating pages with HTML and MathML. The code for most of the are often examples in this article is included in the template article at http://www.math.wisc.edu/~ram/MathGlossary/template.xml [tmp]. If you are viewing this article on the web use View Source in the View menu of your browser to see the code or download this page and edit it in your favourite editor.

Though MathML is simpler to learn than TeX, it has one great annoyance (which is, very likely, the reason it hasn't caught on more quickly): nearly every printing character is supposed to put inside <mi> </mi> or <mo> </mo> or <mn> </mn> (for "math identifier", "math operator" and "math number"). This means that the equation x2 + y2 =1 is typeset with the code

<math xmlns="http://www.w3.org/1998/Math/MathML">
<msup><mi>x</mi><mn>2</mn></msup>
<mo>+</mo>
<msup><mi>y</mi><mn>2</mn></msup>
<mo>=</mo><mn>1</mn>
</math>
The consequence is that it is tedious to type in MathML by hand and some software that helps is desirable. Amaya is still in beta-version but it can be useful. Hopefully, Amaya will be improved quickly. Javascript can do amazing things: there is a javascript ASCII to MathML translator [AT] written by Peter Jipsen [Jp] and a javascript LateX to MathML translator [TT] written by Douglas Woodall and Jeff Knisley [Kn]. Perhaps translation is too extreme, a MathML dialect that retains the advantages of web markup and is not tedious to enter might be the ideal. Although I have not yet implemented this myself, a bit of javascript at the beginning of your web page that automatically puts in the tedious mi, mo, and mn tags would enable the same equation, x2 + y2 =1 , to be typeset with the code
<mymath> <msup>x2</msup> + <msup>y2</msup> =1 </mymath>

Features from HTML and CSS

MathML Features

There are plenty of math symbols available in MathML.

± < > ⩽̸ ⩾̸ × C C

The Mozilla MathML character table [CT] is extremely helpful, both for finding available characters and for determining character names. The following links will help for navigating these tables:

  1. Logic table http://www.mozilla.org/projects/mathml/fonts/chars/table00xx.html
  2. Arrows table http://www.mozilla.org/projects/mathml/fonts/chars/table21xx.html
  3. Operators and Relations Table http://www.mozilla.org/projects/mathml/fonts/chars/table22xx.html

Math formulas and notation are typeset inside
<math xmlns="http://www.w3.org/1998/Math/MathML"> math stuff here </math>.
This is analogous to $ in TeX.

Using Amaya for MathML authoring

Amaya is very useful for putting in all those <mi>, <mo>, setting up subscripts, superscripts, matrices and fractions. Amaya, at the moment, is painful for entering math symbols and it has the annoying problem that, even if you get it entered right, when you save your document, Amaya will automatically change character entities that have been entered manually. For example, &langle; will change into some Chinese character.

Amaya crashes often. Until Amaya gets more robust the best option is to use Amaya in tandem with your favourite editor. Do the layout of the text and the equations with Amaya. Type a few paragraphs into Amaya then copy the code into your favourite editor and fix up the character names. Use a slightly different name for Amaya file and your document file. When using Amaya

Amaya MathML keyboard shortcuts for Mac OS X

Command Tag Shortcut
New Formula <math> Ctrl-m Ctrl-m
Subscript <msub> Ctrl-m Ctrl-v
Superscript <msup> Ctrl-m Ctrl-6
Subscript and Superscript <msubsup> Ctrl-m Ctrl-b
Multiscripts <mmultiscripts> Ctrl-m Ctrl-s
Under <munder> Ctrl-m Ctrl-u
Over <mover> Ctrl-m Ctrl-o
Under and over <munderover> Ctrl-m Ctrl-k
Fraction <mfrac> Ctrl-m Ctrl-f
New Matrix <mtable> Ctrl-m Ctrl-h
Root <mroot> Ctrl-m Ctrl-r
Square root <msqrt> Ctrl-m Ctrl-q

Problems with Amaya

Tips

References

[Am] Amaya, http://www.w3.org/Amaya/

[Ao] Amaya overview, http://www.w3.org/Amaya/Amaya.html

[AT] Peter Jipsen, ASCII to MathML translator, http://www1.chapman.edu/~jipsen/mathml/asciimath.html

[Au] Authoring MathML for Mozilla, http://www.mozilla.org/projects/mathml/authoring.html

[Bm] Beamer, http://en.wikipedia.org/wiki/Beamer_(LaTeX)

[Cm] Camino, http://www.caminobrowser.org/

[CSS] CSS (Cascading Style Sheets) Specification, http://www.w3.org/TR/CSS21/

[CT] MathML character table, http://www.mozilla.org/projects/mathml/fonts/chars/table.html

[DS] Design Science MathPlayer, http://www.dessci.com/en/products/mathplayer/

[ft] fonts for MathML enabled Mozilla, http://www.mozilla.org/projects/mathml/fonts/.

[Fw] Fireworks, http://www.adobe.com/products/fireworks/

[Fx] Mozilla Firefox, http://www.mozilla.org/products/

[HT] HyperTeX, http://arxiv.org/hypertex/

[Ik] Inkscape, http://www.inkscape.org/index.php?lang=en

[Jp] Peter Jipsen, http://www1.chapman.edu/~jipsen/

[Kn] Jeff Knisley, http://faculty.etsu.edu/knisleyj/.

[mm] XHTML1.1+MathML2.0+SVG1.1 Document Type Definition, http://www.w3.org/TR/XHTMLplusMathMLplusSVG/

[Mmz] MathML for Mozilla, http://www.mozilla.org/projects/mathml/authoring.html

[MT] MathML at MIT, http://web.mit.edu/is/products/mathml/

[Op] Opera, http://www.opera.com/

[st] Status report of MathML tags in Mozilla, http://www.mozilla.org/projects/mathml/update.html

[SX] STIX fonts, http://www.stixfonts.org/

[TS] The W3C MathML test suite, http://www.w3.org/Math/testsuite/

[tmp] Arun Ram, Template for a research article in MathML, http://www.math.wisc.edu/~ram/MathGlossary/template.xml

[TT] Douglas Woodall and Jeff Knisley, LateX to MathML translator, http://math.etsu.edu/LaTeXMathML/

[Tt] MathML torture test, http://www.mozilla.org/projects/mathml/demo/texvsmml.xhtml.

HTML and MathML commands

Basic HTML

MathML Presentation Markup tags