MathML is an extensive system for displaying mathematics on the Web. This page is a quick guide to installing and using it. I've written this guide for members of the MIT Intelligent Book Project, but it should be generally useful as well.
This page includes instructions for installing MathML with Mozilla on GNU/Linux or Windows, and with Internet Explorer on Windows.
To check if your browser can render MathML, try viewing this simple test page. The page includes both flavors of MathML:
In order to view MathML you need:
Mozilla comes with built-in MathML support, so all you need to do is to install the fonts. I've put together a font package for use by people in the Intelligent Book project. To use this:
/project/intelligent-book/mathml/math-fonts
into
the X fonts directory on your machine, which is I'll assume is
named /usr/lib/X11/fonts
:
cp -r /project/intelligent-book/mathml/math-fonts /usr/lib/X11/fontsYou'll probably need root privileges on your machine to do this. This creates a
math-fonts
directory with two subdirectories called
cmtex-pfb
and mathematica-pcf
.
If you are not in the Intelligent Book project, you can't access the fonts package I put together. Read the instructions below on how to create the fonts package for GNU/Linux. Then create the package, move it to your X fonts directory, and continue with the instructions here.
xset fp+ /usr/lib/X11/fonts/math-fonts/cmtex-pfb xset fp+ /usr/lib/X11/fonts/math-fonts/mathematica-pcf xset fp rehashNow close Mozilla if it was open, relaunch it, and try the test pages above. If this doesn't work, check that the fonts are really in the directories, and that the directories really were added to your path, which you can do with:
xset -qGood luck.
/etc/X11/XF86Config-4
. (At least, this is where
it is on Debian.) Find the lines in the
fonts section that look like
FontPath some directoryand add the lines
FontPath "/usr/lib/X11/fonts/math-fonts/cmtex-pfb" FontPath "/usr/lib/X11/fonts/math-fonts/mathematica-pcf"Now reboot your machine (or restart the X server some other way). When everything comes back, you should open Mozilla and be able to view the test pages. Congratulations.
Note: Be very careful editing the XF86Config-4
file. If you blow it, you may not be able to start X. If
you do mess up like this, say a penance and find a wizard.
Just as on GNU/Linux, Mozilla on Windows comes with built-in MathML support, so all you need to do is to install the fonts. There are two sets of fonts to install.
Windows/fonts
folder.
Windows/fonts
folder.
Download and install the MathPlayer Plug-in. When I download this, I get a file whose name ends in ".exe.asp". I had to change the name to remove the ".asp", before I click on the installer and run it.
Now try the browser tests. Hopefully, these will work.
foo.xml
, not foo.html
.)
This implies that any HTML on your pages must be well-formed
XML (i.e., it must be XHML, rather than just XML). For
example, all tags must be balanced -- none of those hanging,
unbalanced <p> tags and the like.
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="/styles/mathml.xsl"?> <html xmlns="http://www.w3.org/1999/xhtml"> ... Your stuff here ... </html>The style sheet referred to in the first line --
/styles/mathml.xsl
is already on Swissnet. If
you wish to serve MathML from a different server (or test it
offline) you need to install appropriate style sheets. You'll
need four of them, which you can snarf from W3C: mathml.xsl,
pmathml.xsl,
ctop.xsl and
pmathmlcss.xsl.
Place these in a directory on your server and make the
xsl-stylesheet for MathML pages you serve point to the
mathml.xsl
file. For more information, see the
W3C note:Putting
mathematics on the Web with MathML
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="/styles/mathml.xsl"?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Simple MathML Example</title> </head> <body> Here is some presentation MathML -- <math xmlns="http://www.w3.org/1998/Math/MathML"> <mi>x</mi><mo>+</mo><mn>3</mn><mo>+</mo><mi>y</mi> </math> <p/> Here is some content MathML -- <math xmlns="http://www.w3.org/1998/Math/MathML"> <apply> <fn><ci>f</ci></fn> <ci>x</ci> </apply> </math>