MathML in Webkit
There was a discussion about displaying math on the web, over at Terry Tao’s blog. It was a little disheartening to learn where most peoples’ heads are at, in that regard. Many seems to be excited at the mere prospect of creating a web service that would turn TeX equations into pictures. Such services are not exactly thin on the ground, I retorted, but hardly satisfactory, either. Fortunately, an actual blind user showed up to explain at least one reason why that wasn’t the answer.
Still, being told, “You should use MathML.” is like being told, “Eat your vegetables.” and is just about as likely to be heeded.
One objection is the lack of browser support, which – these days – means that neither Opera, nor Webkit browsers (Safari, Chrome, …) support MathML. The latter, however, seems to be changing. There’s a plan and, more importantly, there’s actually been code checked into trunk.
Of course, it’s far too early to expect anything usable, but if Alex wants to prioritize, here’s a table of MathML elements and attributes used by itex2MML. Things that aren’t yet supported by his patches are marked in bold.
Element | Attributes |
---|---|
math | display |
mi | mathvariant |
mn | |
mo | maxsize minsize lspace rspace stretchy |
mrow | xmlns:xlink xlink:type xlink:href |
mover | |
munder | |
munderover | |
msub | |
msup | |
msubsup | |
maction | actiontype( = toggle, statusline, tooltip) |
mphantom | |
mpadded | width lspace |
mspace | height depth width |
merror | |
mtext | |
mstyle | scriptlevel mathcolor mathbackground displaystyle mathvariant |
mmultiscripts | |
mprescripts | |
none | |
mfrac | linethickness |
msqrt | |
mroot | |
mtable | rowalign columnalign align rowspacing columnspacing equalrows equalcolumns rowlines columnlines frame |
mtr | rowalign columnalign |
mtd | rowalign columnalign rowspan columnspan |
semantics | |
annotation-xml | encoding |
Other bits of the conversation were a little more heartening. MathML-in-text/html
support is in Firefox nightlies, though disabled by default. I don’t imagine it will be turned on before Firefox 3.7 at the earliest. Judging by the number of Firefox 3.0 users, it’ll be some years yet, before we can count on using MathML-in-text/html
. And I did learn about the very-cool-sounding MathJax project.
Anyway, here’s a modest contribution to what the discussion could have been about: things you can do with math on the web, that you couldn’t do in print. Hover your mouse over the right-hand side of
Unfortunately, due to a year-old Mozilla bug, the perhaps more-useful doesn’t currently work.
These are created with itex’s \statusline{}{}
, \toggle{}{}
and \href{}{}
commands.
Update (11/6/2009):
Since Frank Hecker was confused, here’s the same equation, redone using itex’s new\tooltip{}{}
command:
Specifically, the itex code is
A=\toggle{ \tooltip{Click to hide.}{ \tfrac{2}{\sqrt{\pi}}\int_0^x e^{-t^2} d t} }{ \tooltip{The Error Function: click for the definition.}{ \mathop{erf}(x)} }
Re: MathML in Webkit
That is great news about MathML in Webkit. Lack of MathML support is pretty much the only thing stopping me from switching over to Chrome wholesale. Thanks also for the summary of the discussion on Tao’s blog, which I didn’t follow to the end. In particular the MathJax project seems very interesting.
In my opinion, to encourage adoption of MathML we need to make it absolutely brain-dead simple for anyone to implement MathML in any web-based system and on any common server setup, including cheapo shared hosting. Current solutions fall somewhat short of that, although they are great if you put the effort into setting them up. The situation is somewhat similar to the hell of Javascript coding before the advent of libraries like JQuery et. al., which made all the browser implementation headaches disappear overnight. It looks like MathJax might do the same for MathML.