Surfin' Safari


Posted by Beth Dakin on Tuesday, August 17th, 2010 at 5:52 pm

If you’ve been following check-ins for the last year or so, then you already know that some dedicated contributors have been working on a MathML implementation in WebKit. I am very pleased to announce that the implementation is now turned on by default in the WebKit build and in WebKit Nightlies! Big thanks to Alex Milowski, François Sausset, and everyone else who has worked on MathML in WebKit.

Check out Riemann’s Zeta Function, as rendered by WebKit:

Riemann's Zeta Function in MathML

Download a WebKit Nightly and check out the demo for yourself. And as always, we encourage you to get involved and file bugs.

14 Responses to “Announcing…MathML!”

  1. Jacob Rus Says:

    This is probably known to all of you working on this, but the example render here (the png file) has a bunch of typographic problems: the equals sign is too close to the closing parentheses, the summation sign is too high vertically, the 1 under the sum should not be italicized (similarly, the infinity symbol should not be), there’s an odd amount of space between the fraction bar and the stuff below, and the summation sign itself is much too bold.

    Still, nice to hope that eventually we’ll be able to put math on the web in a way that looks reasonable without resorting to images.

  2. spicyj Says:

    I agree with everything Jacob said. For reference, this is how LaTeX renders the same formula:

  3. Spiff Says:

    I’m excited about MathML in WebKit, and I look forward to it meeting and quickly exceeding the typographic quality of the typical TeX-based math expressions as seen in math paper PDFs.

    I agree with spicyj that at this time, TeX appears to be better typographically compared to this initial level of WebKit’s MathML support. However, I think even TeX (perhaps not TeX itself, but how it ends up being used) leaves a lot to be desired. I think a major factor is that TeX’s typefaces and font metrics are often a jarring contrast to the typical math paper’s body text typeface. Another major factor is that in many environments, it seems TeX-based mathematical typography is not antialiased the same way the body text is, causing the TeX-based stuff to look jaggy in comparison.

  4. randallfarmer Says:

    First, love this. I maintain a hack to convert LaTeX to images, but I earnestly look forward to its obsolescence.

    Also likely known to the MathML crew, but the n-Category Café is a heavy real-world adopter of MathML. Here’s a post there that shakes out a number of differences between the nightly build and Firefox (I don’t know who, if anyone, is following the standard):

    Some things that look different (that, again, I’m not qualified to say are or aren’t bugs):

    – Blocks of math are left-aligned in WebKit; they’re centered in Firefox
    – In Firefox, labels like “unitless parametrization” are in Roman text and have spaces; in WebKit, slanted and no spaces
    – Also slanted in WebKit but not FF: blackboard bold R.
    – There are large spaces to the left of super/subscripts, and less horizontal spacing than Firefox generally.
    – One sigma symbol has its top cut off (under “Say we have a system…”)
    – I don’t have full Unicode fonts, so in both browsers I get placeholders for characters like U+1D400, math bold uppercase A. I guess that isn’t a bug (it’d be rough to try to select fallbacks) but noting it for completeness.

    I bet we’re going to see the MML rendering improve quickly. It can’t hurt that people can actually use it now!

  5. randallfarmer Says:

    Bleh, in my heart of hearts, I know I should have filed that in Bugzilla. Will later.

  6. Mark Rowe Says:

    Please write up any issues in Bugzilla at

  7. richbradshaw Says:

    I might be wrong (I’m not an expert by any means!), but shouldn’t the math element have an implicit namespace of ‘’, even if not specified?

    In other words:

    var element = document.createElement(‘div’);
    element.innerHTML = ”;


    Should log ‘’, even if not given an xmlns tag.

  8. rjohnson Says:

    A nice side by side comparison of TeX, Firefox 3.6, and the browser you are running for complex MathML:

  9. easco Says:

    I feel compelled to point out that, in the demo file, the equation labelled as “De Moivre’s Theorm” is, in fact, Euler’s formula.

  10. joejava Says:

    Congratulations! on getting MathML rendering up and running on all builds of WebKit.

  11. PaulTopping Says:

    Congratulations! You may be aware of the MathJax project ( that is an open source JavaScript engine that displays MathML and LaTeX in all modern browsers, including WebKit-based ones. It makes use of native MathML display in browsers where it is present. When your MathML implementation is a bit farther along, we would be happy to have it make use of it. Is there an easy way to check for the presence of WebKit MathML support from JavaScript?

  12. randallfarmer Says:

    richbradshaw: In the post about the HTML5 parser, they said they’d be tackling the fragment parser used for innerHTML next. I don’t know for sure, but I bet that’s the missing piece for automatically getting the right namespace.

    (You can probably insert MathML that you parsed as XML with DOMParser — I commented with a few lines of code to do that on the HTML5 post. But that’s neither here nor there.)

    Mark Rowe: Yes, I’ve realized the error of my ways and started filing bugs. More later.

  13. joejava Says:

    MathML in HTML5 works great! See:

    The default W3C HTML validator does not work correctly (yet) with MathML in HTML5.
    To validate an HTML5 document that uses MathML, use the W3C Beta HTML validator at

  14. wassy Says:

    I suppose it’s MathML 2.0SE, right?
    MathML 3 is a Proposed Recommendation at W3C now
    and I hope we can enjoy it soon!