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-fontsinto the X fonts directory on your machine, which is I'll assume is named
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-fontsdirectory with two subdirectories called
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
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.
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.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.xslis 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.xslfile. 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>
This discussion says nothing at all about reasonable ways to author MathML. There are several tools for doing so. For the Intelligent Book, we'll use a program that translates Scheme expressions to MathML.
This is for people not in the Intelligent Book project who would like to get the math fonts package. You're probably wondering why, if I could put this package in our directory, I couldn't just also dump a copy on the web server. The reason is that the Mathematica fonts, which are part of the package, are licensed in a way that does not permit wide-scale redistribution.
This is a perfect illustration of why restrictive licenses on digital information impede innovation -- you have to go to the trouble of rebuilding the package yourself, rather than being able to take advantage of the work I've already done. So curse, send a donation to the FSF, and build the package as follows:
cmpsfontdirectory has a subdirectory called
pfb. Change (
cd) into that directory and run the command
type1instWhat this is doing is creating a fonts.dir file that indexes the fonts in that directory.
math-fontssomewhere (e.g., in an appropriate temporary place) and move
cmpsfont/pfbinto that directory, renaming it to
mv cmpsfont/pfb directory-where-math-fonts-is/math-fonts/cmtex-pfb
PCFdirectory and run
type1inst. Then move the
math-fonts, renaming it to
mv PCF directory-where-math-fonts-is/math-fonts/mathematica-pcf
math-fontsis the fonts package. Scan it to make sure it looks OK and that the permissions are set correctly. Use the package as described above to complete the installation of fonts for GNU/Linux.