MathML Testing & One Weird Benefit

Math ML is one of those standards that has been waiting for implementation for years. It’s been on my list to try “one of these days” and I used an engineering course to try it out. First, it helps that modern equation editors are not exporting MathML files – I wouldn’t want to try and code these by hand.

Browser Implementation

Unfortunately, I was disappointed to learn that MathML is inconsitently implemented on the different browsers. It works best in Firefox, but only if you embed the HTML & MathML together in a true XML page (with the &lt?xml version="1.0"?> header) and change the extension to .xml or .xhtml). The good newa is that If you’re comfortable with CSS, you can apply styles to get some very nice effects (either in a DIV or directly on the tags).

See Fake Blog Test Page with MathML (with .xhtml extension)

Update on Feb 4, 2009 – Firefox users should install an MathML font. For now I recommend the font from MIT (scroll down), but the Stix font should be available at some point in the future. I also recommend upgrading to Firefox 3.

The same file will also work in Opera, but with some display quirks (at least for exponents). Safari has no MathML support, but you can kluge some results with the right CSS stylesheet…but that page will look weird in Firefox (sigh).

As far as I can tell, IE 7 is hopeless. Once you change the extension from .htm/.html, IE 7 treats the file as a “random” XML file and can no longer parse the HTML tags properly – everything runs together on the page. I think you could fix the HTML part, but recreating a CSS stylesheet (e.g h1,h2,h3,h4,p,ol,ul: {display:block}…but is it worth the hassle? The real problem is that the MathML does not display correctly.

In theory, there are plugins for MathML for IE 7, but they were designed for older versions of IE. The one I tried hasn’t worked so far. To make it worse, when it did work, you apparently had to use an OBJECT tag (in an .html page) which then makes it stop working in Firefox – Arggh.

Update on 8 Dec – I was able to view a version of MathML of IE7, but the syntax is not the same. See the IE 7 and MathML Update entry for details

Weird Benefit

If it ever works, it will be great because the MathML versions display much better than the GIF/JPG files generated by the Equation editor (see below for comparison). You can also make minor edits in the code to fix any typos/formatting issues (such as super tniny exponents)

Image Generated by Equation Editor (Fuzzy)

Fraction - a = 27 r squared times T sub c squared over 64 P sub C

Image of Equation Generated by MathML (Sharper)

Same Fraction Rendered in MathML/Firefox

Which leads me to the weird benefit – I CAN use MathML in Firefox to post the equations and take screen captures for all other browsers. Plus, you can then have a record of the MathML to use for quick corrections. Then…when everyone gets to the same place, it will be nice to have a repository available to plug in later.

This entry was posted in Standards. Bookmark the permalink.

Leave a Reply