MathML Editor: Introduction
MathML is an XML-based format for displaying and conveying mathematics. Version 1.01 of the specification was released way back in July of 1999, so it isn't a "new" standard; rather it's been a little slow to gain as much fame as XHTML or even SVG. This may be due to the nature of its intended users, or that LaTeX, an immensely popular typesetting format, has excellent mathematics display capabilities, and is relatively easy to learn and quick to write.
Regardless, MathML has some importance to the world wide web. It comes in two flavors, presentational and content. Obviously, one is geared toward the presentation of the mathematics (at the expense of semantic meaning), while the other emphasizes the meaning of the expression (something LaTeX does not offer). Content MathML ends up looking like a preorder traversal of an expression tree, making it trivial to import into CAS software. Put it into a stack and evaluate. Anyway, MathML also provides a method to combine the two, allowing for a self-contained MathML document that describes its presentation and its meaning.
This is not a MathML tutorial, so actual specifics about the language will not be talked about. For a quick example though, let's render the following equation in MathML: ![]()
<semantics> <mrow> <munderover> <mo> ∫ </mo> <mn> 0 </mn> <mi mathvariant="normal"> ∞ </mi> </munderover> <mrow> <msup> <mi mathvariant="normal"> ⅇ </mi> <mrow> <mo> - </mo> <msup> <mi> x </mi> <mn> 2 </mn> </msup> </mrow> </msup> <mo> ⁢ </mo> <mrow> <mo> ⅆ </mo> <mi> x </mi> </mrow> </mrow> </mrow> <annotation-xml encoding="MathML-Content"> <apply> <int/> <bvar> <ci> x </ci> </bvar> <interval> <cn> 0 </cn> <ci> ∞ </ci> </interval> <apply> <exp/> <apply> <minus/> <apply> <power/> <ci> x </ci> <cn> 2 </cn> </apply> </apply> </apply> </apply> </annotation-xml> </semantics>
Ok, first we notice is that it gets huge! That fragment is a combined presentation and content MathML fragment; in theory I don't need both if I'm only concerned with one or the other, cutting it in about half. However, let's look at alternative forms of writing this. LaTeX:
$\int_{0}^{\infty}e^{-x^{2}}\,dx$
Painful to read, but very short (the image showing the equation was actually generated with this snippet). Maple input:
int(exp(-x^2), x=0..infinity)
Mathematica input:
\!\(\[Integral]\_0\%\[Infinity]\( \[ExponentialE]\^\(-x\^2\)\)\[DifferentialD]x\)
A special note about Mathematica is that I didn't actually type that. There is a very nice WYSIWYG interface for writing mathematical expressions in the software.
Looking at these three alternatives, one might wonder why even bother with MathML? Maple and Mathematica aren't free for one. They're both excellent pieces of software (I use Maple heavily), and would recommend their purchase, but not everybody can afford that. Maple can also export its own proprietary input/output into other formats, including gif images, LaTeX, and MathML - further increasing its usefulness.
As for LaTeX, look at it long enough and it becomes a bunch of random characters. It is extremely messy, and pulling semantic meaning from it would require a significantly more complicated parser than one would for content MathML.
So, a quick summary:
MathML: Bloated, but can convey meaning and presentation in an easily parsable manner. Faster internet connections places less importance on bloat and more emphasis on semantics, which fits the description of MathML perfectly.
LaTeX: Short, easy to write, impossible to read. As a typesetting language, conveying semantics isn't the goal, and it shows.
Maple: Probably my favorite direct input. Presentation is left up to the program to figure out, and having worked with Maple on some involved math major writeups for multivariable calculus, it isn't always consistent in laying out expressions. Exporting to other formats (presentation MathML, LaTeX, and GIF images) is a big plus, but remember this isn't free software.
Mathematica: Not exactly the prettiest input, but you'll never see it when working with the program thanks to the excellent WYSIWYG capabilities. As a matter of fact, the whole purpose of this article is to describe the need for exactly the same kind of interface. I may prefer Maple over Mathematica, however when working with complicated triple integral expressions I was longing for a similar interface in Maple.
With this brief introduction out of the way, let's look at the need for a WYSIWYG interface to MathML.
Next: Need for WYSIWYG