Math on the Web: Still flaky

Sometimes, much to the chagrin of my non-scientific readers, one of my articles hits on a concept that really needs a bit of math to be properly explored. One or two good equations (explained, of course) can be far more useful to the reader than a dense paragraph of math-as-English-sentences.

Math on Web pages, though, is still really flaky. Despite worldwide efforts to standardize on a math markup format that will work anywhere on the Web, support in certain browsers remains bad enough that we're still stuck with ugly hacks.

To mathematicians, engineers and physical scientists, the natural way to typeset math on a computer is with LaTeX code:

x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}

TeX markup, though, is not a finished presentation- it's a way of telling the computer what the equation should look like. Plus, the 98% of the population who aren't mathematicians or physicists tend to leave when they see it.

We can also use the generally-recognized "ASCII Math" hack, in which we try to represent the equation using normal characters:

x = (-b +- sqrt(b^2 – 4ac)) / (2a)

But it's still ugly, and if the equation gets big, the code gets clumsy. So we try a different tack: typeset the equation, save it as an image, and show the image. Tools like fMath can (with an awful lot of fiddling) add this capability to many common Web editors.

That looks nice, but has so many problems. If you change the text size, the equation will either stay the same or turn blocky/fuzzy. If you rely on a screen reader, it'll skip over the equation. If you want to copy the equation into your own software, well, good luck.

The official, W3C-recommended online math typsetting solution is MathML. In theory, the open, XML-based MathML format should allow all web browsers to render equations correctly, and can be easily converted into LaTeX or other source code formats. It's a far more elegant, portable and versatile solution than embedded images. Does it work in practice?

x=b±b24ac2a

If that looked like the familiar quadratic formula, then congratulations- your Web browser is working. If you got a line (or a dozen lines) of gibberish, well, it's your browser vendor's fault. Webkit-based browsers (Safari, Chrome) are still a bit flaky with mathematics. Trident-based browsers (IE and its relatives) don't even try, preferring to just dump the terms at random all over the place. Only Gecko (the layout engine on which Firefox and friends are built) and Presto (Opera's core) currently make a serious attempt to comply with the standard.

The last options I'm looking at are ASCIIMathML and MathJax, which convert equations written in ASCII or LaTeX into MathML that your browser can render. Those of you who keep your computers up to date would see things properly rendered. Those of you who are stuck on obsolete equipment, or who disallow Javascript, would see the TeX source instead.

$x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$

I haven't decided which option to use. And so you, my readers, will remain mostly free from the onslaught of equations.... for now.

Topic: 

Technology: 

Add new comment