Supporting MathML

08/11/2008 19:44:26

After lots of trial and error, I think I finally have a fairly solid handle on what it takes to get a web page to properly display MathML. Depending on your situation, you can follow one of the sets of instructions below.

My instructions work for Firefox. I make no claims for Internet Explorer. Safari and other browsers based on Apple’s WebCore do not support MathML currently.

Supporting MathML in an individual document

  1. The document’s filename must end in .xhtml

  2. The DOCTYPE must be set properly:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
        "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd">
    
  3. <html> must have the proper namespace:

    <html xmlns="http://www.w3.org/1999/xhtml">
    
  4. <math> elements must also have the proper namespace:

    <math xmlns="http://www.w3.org/1998/Math/MathML">
    

Supporting MathML in a CGI script

  1. The script must return the proper HTTP Header content-type — application/xhtml+xml. This will, however, break Internet Explorer. I have written an extension for Oddmuse (still in testing) that detects which browser a visitor is using in order to send the proper content-type, but this seems like a kludge.

  2. The DOCTYPE must be set properly:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
        "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd">
    
  3. <html> must have the proper namespace:

    <html xmlns="http://www.w3.org/1999/xhtml">
    
  4. <math> elements must also have the proper namespace:

    <math xmlns="http://www.w3.org/1998/Math/MathML">
    

Installing the proper fonts for Firefox

Firefox supports MathML, but you must install the proper fonts for it to display properly. You can find these fonts at MIT.

When all is working properly, the following equation should look familiar and should consist of graphics in addition to characters:

<<x_(1,2) = (-b+-sqrt(b2–4ac))/(2a) [quadratic equation solution]>>

Similar Pages

Comments

Leave a comment