How to display math formulae in Internet Explorer.

There are quite a few ways to do this. The one I've chosen for the page on daily compound interest calculation uses MathML with XSL. MathML is an XML markup language devised by the W3C Math Working Group. It captures both the structure and content of mathematical equations, allowing the presentation to be determined by the end device which, in this case, is Microsoft's Internet Explorer.

Here's a short example of what MathML looks like from the browser's view:

	
	<?xml version="1.0"?>
	<?xml-stylesheet type="text/xsl" href="mathml.xsl"?>
	<html xmlns="http://www.w3.org/1999/xhtml">
	<head></head>
	<body>
	<math xmlns="http://www.w3.org/1998/Math/MathML">
	    <mfrac>
	      <mi>i</mi>
	      <mn>365</mn>
	    </mfrac>
	</math>
	</body>
	
	
This will display the fraction i/365 when rendered correctly. If you understand XML and how every opening tag has a corresponding closing tag, then you won't have much trouble with MathML.

So if that's all there is to MathML, what's the problem? Why not just include the MathML code describing your equation and let IE render it? In fact, in a lot of other browsers like Netscape 7, Mozilla and Amaya, that is indeed what you do. Unfortunately IE doesn't, and this is where the problems arise..

One option is to use either the MathPlayer or Techexplorer plugin with IE. I rejected that option because it required user intervention. It would be like asking your user to change browsers to view your page. Of course, you could just generate a pdf or gif file from your original source but that entails additional time, effort and possibly money. Fortunately, David Carlisle has produced some nice XSL Style Sheets that convert the xml file containing the MathML constructs into something understandable by IE.

Note that the file extension on your file has to be .xml so that the XSL style sheets can do the translation. XSL doesn't know what to do with html files. In the example above you'll notice the XSL stylesheet used is mathml.xsl. This style sheet references 3 other xsl files. You'll need all 4 of them to make this work. Due to the security restrictions on active content in IE you'll have to download them to the same computer and put them in the same directory as the xml file containing the MathML markup language.

Here's a list of the 4 XSL files and where you can get them:

If you're just developing an xml page that contains MathML and displaying it in IE, you can reference the mathml.xsl page directly from the w3c site with this line:

<?xml-stylesheet type="text/xsl" href="http://www.w3.org/Math/XSL/mathml.xsl"?>

Keep in mind that you'll need to reference a local file when serving up your xml file to the outside world as shown:

<?xml-stylesheet type="text/xsl" href="mathml.xsl"?>

The Amaya web browser allows you to generate equations graphically and generates the MathML (.mml) file for you. This is an open source browser and although the version I used (9.4) was a bit unstable, it did a fairly good job of rendering equations.

It seems that Microsoft considers the market too small to invest resources making IE render MathML. Until that changes, here's a quick summary of the steps you can take to include math equations in your web page:

Just a quick note about a small problem I had with the XSL style sheets. There are a couple of constructs, munder and mover, that aren't implemented yet. You'd use munder, for example, to show the greek sigma symbol and the under part would contain x->infinity. Fortunately, there is an munderover construct that works fine. So if you want to use munder, use munderover and leave the over part empty.

Valid XHTML 1.0 Transitional