MathJax 2.0 no longer uses Firefox MathML support by default :-(
By fredw on Thursday, March 1 2012, 11:00 - Permalink
MathJax 2.0 was
released last Sunday and contains a lot of bug fixes and new
features. The changes are extensively described on the MathJax web site,
but one of them is particularly important to know for Mozillians, so I
thought I should write a blog post about it. As indicated in the title, MathJax
2.0 no longer uses Firefox MathML support by default, because of some (more or
less serious) limitations of the
Mozilla MathML engine. Maybe the main reason is the lack of support for
<mlabeledtr>, which is essential to implement LaTeX commands
introduced in MathJax 2.0 for equation labeling/numbering.
First of all, for those who do not know, MathJax is an open source Javascript display
engine for mathematics. Basically, it parses mathematical expressions (e.g.
LaTeX or MathML) inside the source code of a Web page, converts it into an
internal format (more or less the MathML format) and outputs some code
(HTML+CSS, SVG or MathML) that the browsers can use to render the mathematical
expressions. MathJax allows to get an excellent rendering quality across all
the browsers (as opposed to the traditional raster images of mathematical
formulas), requires no specific installation for the visitors (no need for
native MathML support, downloadable fonts can be used etc) and is very easy to
set up and maintain for the webmaster (author just have to insert a
<script> tag linking to the MathJax CDN and write LaTeX
inside the source code ; automatic upgrades...). MathJax provides other
advantages and also has some drawbacks, but I will not enter in the details
here.
As it has already said elsewhere, three main reasons have prevented the mainstream adoption of MathML: need for a converter or other tools to generate MathML, need to serve the page as XML (until recently) and lack of a good support in main browsers. Because of the main advantages mentioned above, MathJax has become very popular, the MathJax user list is active and MathJax is even considered to be used by arXiv or Wikipedia. Since MathJax relies on MathML it has contributed to increase the use of this W3C recommendation. This has also obviously enabled the Mozilla MathML Project to receive a lot of feedback to improve its implementation.
Unfortunately with the release of MathJax 2.0, Firefox MathML support is going to be much less used or tested. More precisely, it will not be used by default on Web sites that use MathJax unless the web master modify this configuration or the visitors select it in the MathJax menu. It is definitely a shame for Mozilla and the MathML community in general to see that the best native MathML support will be disabled. I want to highlight that in most case, Firefox will display without problems the MathML code generated by MathJax. Thus if you are a Web master / Firefox user willing to help the Mozilla MathML project, I suggest you to override the default configuration. But more importantly, this change should encourage Mozilla developers to continue improving the Firefox MathML support so that it becomes the default renderer in MathJax again...
--update: I forgot to mention that now bug 356870 is
fixed (Firefox 9), it is possible to show the label on the left of
<mlabeledtr> rows with the simple CSS rule below. That
should provide a satisfying result in most cases.
mlabeledtr > mtd:first-child {
display: table-cell;
}
--update 2: Because I got feedback about that, I just want to clarify things: the change described here is not arbitrary or political. It has been made from a purely technical point of view: there have always been various issues in the MathML rendering that can be inconvenient for Firefox users. Now, MathJax 2.0 relies on two key MathML features that are missing in Firefox rendering (namely linebreaking and equation labeling) which are thought important enough to make the choice of switching to HTML-CSS. Again, please read the Bugzilla entry for technical details.
Comments
Just out of curiosity, how come using attr() generated content with :before and :after doesn't provide enough to do the equation numbering? I've always wanted css-counters to be good enough for that actually, so that you didn't have to worry about numbering, but getting that generated content to use in text (i.e. "See Fig. 2.1") is impossible as far as I know and you end up writing your own counters anyway.
MathML is quite a beast but then it is also supposed to be standalone format.
I have used MathJax on Wikipedia using http://en.wikipedia.org/wiki/User:N... (can't wait it becomes official a display option for formulas in MediaWiki) and I used the MathML mode there for quite a while but then I came across some serious issues that show when printing, so I switched to HTML-CSS (but even there are some printing issues).
@WesJ: MathJax computes the numbering and references itself if you are using the LaTeX input, so that's not really a problem in that case. Your suggestion to use :after or :before to attach a label on a
<math>element works well. However, MathJax relies on the standard MathML element<mlabeledtr>("MathML labeled<tr>") which can display a set of labeled rows of formulas. You just reminded me that I did not mention a CSS workaround to make this work in Firefox, when all the rows are labeled. I updated my blog post, thanks.@Bido: Yes, the printing bugs are referenced in the Bugzilla entry, but that seems really something someone in Mozilla with expertise outside the MathML code should look at. I'm also waiting for MathJax to be integrated in MediaWiki so that each user will be able to use his preferred output mode...
The main issue I ran into with MathML in MathJax on Firefox is need for local fonts in order for output to look reasonable. e.g. http://jyouyang.corp.he.net/latex/c... Any possible way forward on bug #295193 or similar?
Right now, it just seems less of an imposition on the user by having it "just work" with HTML/CSS. My apologies. :/
@jyo: No need to apology, the Mozilla MathML team is well aware of this issue. According to Davide Cervone from MathJax, the STIX fonts are not currently very usable as downloadable fonts. As indicated in bug 295193 Mozilla could ship Firefox with these fonts inside and use CSS rules for downloadable fonts to load them, but that would increase the build size and we probably don't want to.
We recently fixed bug 701758 to add support for MathJax fonts. Since the MathJax team provides WOFF version, they could in theory be used by Mozilla. However, Karl Tomlinson said in bug 663740 comment 8 that downloadable fonts can probably not be used for stretching all the symbols in our current implementation (this also applies to STIX fonts), so we need more work...
BTW, bug 663740 and the one it blocks are key steps to improve the MathML font support. I suggested student to work on it last summer, but it didn't produce any relevant work. I recently asked my brother to have a look to them, so I hope the situation will change.
It strikes me as odd/sad that a cross-platform Javascript-based MathML rendering engine should be more feature-complete and less buggy than the native MathML rendering engine that has been in Gecko nearly forever (in Internet years).
@Jacques Distler: there are two reasons I see to explain this situation:
@fred: Thank you for the very through explanation!
Did you see the mathjax blog entry yet?