the all-thing | 2010-09-06 18:49:24 -0400 ========================================== On the hell that is MathML -------------------------- Date: April 16, 2010 5:34pm Author: William Morgan Labels: mathml, whisper URL: http://all-thing.net/on-the-hell-that-is-mathml.txt It's been 12 years since the first MathML spec was released, and math on the web is _still_ largely unsupported and incredibly complicated to get right. If that isn't a spec failure, I don't know what is. Personally, after a year of doing my best to do MathML the "right" way, I've given up trying to be correct. I'm now using MathJax [1] to render math, a solution that is, while absolutely horrible, far less horrible than before. In particular, people can actually see math. But William! you might say, all you need to do for math on the web is to generate MathML. Firefox has supported MathML for years and years! And that's true, BUT: 1. Random browsers simply don't support MathML (e.g. Chrome, Safari). 2. The browsers that do support it (e.g. Firefox) support it only in strict compliance mode. And strict compliance mode is an absolute hell for everyone involved. You must produce valid XHTML and sending your content as text/xml instead of text/html. Any kind of non-conforming XML produces a horrible cryptic red error message instead of displaying the page. You will begin to live in fear of screwing things up whenever you make a chance to your layout, and god help you if you have any kind of UGC or templating or any kind of non-trivial content generation. MathJax smooths that away. You can embed MathML or even LaTeX math markup directly into a text/html document, and it will do the magic to turn it into math in the browser. If the browser has native MathML support, then great, it will use that. If the browser has web font support, then great, you get pretty fonts. And if not, the degradation is graceful. And you get the nice error-robust rendering that makes HTML nice. I'm still using Ritex [2] to translate LaTeX math into MathML, because I like the syntax and because I didn't feel like going back and translating all the math. I've changed Whisper [3] to emit text/html as the content type. So now I should have the best of all possible worlds. Let's try it: \int_0^1 p^{x-1} (1-p)^{y-1} d\,p = \frac{\Gamma(x) \Gamma(y)}{\Gamma(x + y)} If you see math above, I have succeeded. If not, I have failed. [1] http://www.mathjax.org/ [2] http://ritex.rubyforge.org/ [3] http://masanjin.net/whisper Replies -------- thomas, on April 16, 2010 9:20pm: ["| Hi,\n", "| \n", "| Not in Google Reader I don't. But I agree, LaTeX input syntax is here to stay\n", "| and JavaScript/DOM has become powerful enough for this kind of stuff, so\n", "| inventing a separate XML language doesn't make that much sense.\n"] William Morgan, on April 21, 2010 2:52pm: [" | \n", " | The RSS feed should now contain the original LaTeX markup, which is better\n", " | than nothing...\n", " | \n", " | \n", " | Yeah, I think it might've caught on if the spec had been much simpler and\n", " | wasn't tied to a fail-fast mode that discouraged people from using it.\n"] This delicious text version served up by Whisper .