Getting started/Viewing XHTML and MathML

From OpenGL.org
Jump to: navigation, search

<< Back to Getting started

Viewing XHTML+MathML

The Docbook XML man pages for OpenGL use a DTD which combines Docbook 4.3 and MathML 2.0 DTDs. Using the Docbook modular stylesheets, the XML documents are converted into conformant XHTML+MathML.

MathML support in browsers is developing. Several tips:

  • The documents must be served with MIME type application/xhtml+xml. If they are served as straight XHTML, or worse yet HTML, documents, the browser will not try to render MathML content properly. (The main consequence of this, so far, is that XHTML+MathML documents have to use the ".xhtml" filename suffix when reading them from file:// URLs or in the filesystem Apache is reading them from.)
  • If you are serving .xhtml files from the Khronos Subversion repository, you must set the MIME type correctly. For an existing document, use
svn propset svn:mime-type application/xhtml+xml filename.xhtml

You can automate this for new documents by modifying your Subversion config file (on Linux, this should be in ~/.subversion/config) to contain:

[miscellany]
enable-auto-props = yes

[auto-props]
*.xml = svn:eol-style=native;svn:mime-type=application/xhtml+xml

This causes all files created in Subversion with a ".xml" suffix to automatically be given appropriate MIME types (and also EOL styles, which helps sharing them across Windows/Unix platforms).

  • For Firefox 1.5, MathML support is built-in. However, the proper fonts must be installed. This is somewhat tricky, but I have it working on Fedora Core 5 Linux (a bit of juggling with the fonts was required - removing the Adobe Symbol font despite its being recommended).
  • For IE, there are some free plugins. The most recommended seems to be MathPlayer, and it has been confirmed to work well. Some other plugins are listed here. Please experiment and let us know of any plugins better than MathPlayer.
  • For test pages see the W3C's MathML Test Suite.

OS X Notes

You have to use Firefox, as Safari doesn't implement MathML. You'll have to install the fonts from MIT from the link above. After that, I had to edit my Firefox user preferences to get rid of a warning about needing fonts named CMSY10 and CMSX10 every time the page was displayed. To do this in Firefox 2.0:

  1. Type about:config in the address bar
  2. Control-click anywhere in the list of preferences that come up and select New→String
  3. In the "New string value" dialog, enter font.mathfont-family
  4. In the "Enter string value" enter Math1, Math2, Math4