MathPlayer
(Excerpt from "The MathML Handbook" by Pavi Sandhu)
MathPlayer is a free plug-in developed by Design Science Inc. It enables high-quality rendering of MathML on Versions 5.5 and later of IE on Windows. MathPlayer takes advantage of a special feature of IE called Behaviors, which allows low-level integration of a helper application with the browser. When you use the Behaviors functionality, MathPlayer can query the browser to get information about the font style and size, as well as spacing and alignment of text in a document. This information is then used to render MathML equations that are well integrated with their environment; that is, the font styles and sizes, as well as the baseline of the equations, are consistent with the adjacent text.
MathPlayer does an excellent job of rendering both content and presentation markup. It is written entirely in C++, making it fast and efficient. It can render hundreds of equations in a fraction of a second. MathPlayer comes with a special set of fonts for displaying mathematical symbols. These fonts are automatically installed on the machine when MathPlayer is installed.
MathPlayer also allows you to access the MathML source for any equation it displays. To do this, right-click on the equation to bring up a pop-up menu. If you then choose the Copy MathML command from this menu, the markup for the equation is copied to the clipboard. You can then paste this markup into another application, if desired.
MathPlayer supports some limited functionality for displaying interactive equations, such as toggling between two displays, changing the color or background of an equation, and displaying a message in the browser's status area when you move the mouse over it. For this type of interactivity, the equations must be authored using the WebEQ Editor application, details of which are provided under Using CSS with MathML.
At this time, MathPlayer is not available for Macintosh. This is because the Behaviors functionality that it relies on is not implemented in IE for Macintosh.
Authoring documents for MathPlayer
The following example shows the source of a typical document that contains an equation to be displayed by MathPlayer.
Example: A sample document for displaying MathML in IE using MathPlayer.
<html xmlns:m="http://www.w3.org/1998/Math/MathML">
<head>
<object id="MathPlayer" classid="clsid:32F66A20-7614-11D4-BD11-00104BD3F987">"</object>
<?import namespace="m" implementation="#MathPlayer">
</head>
<body>
<p>Here is a simple equation.</p>
<p>
<m:math>
<m:mrow>
<m:msup><m:mi>x</m:mi><m:mn>2</m:mn></m:msup>
<m:mo>-</m:mo>
<m:mrow>
<m:mn>2</m:mn>
<m:mo>⁢</m:mo>
<m:mi>x</m:mi>
</m:mrow>
<m:mo>+</m:mo>
<m:mn>1</m:mn>
</m:mrow>
</m:math>
</p>
</body>
</html>
The above document has the various key features that are explained next.
The xmlns:m attribute in the html tag associates the prefix m: with the MathML 2.0 namespace. This specifies that any tag of the form m: name in the document should be interpreted as the name tag defined by MathML 2.0.
The object element associates the MathPlayer ID with the MathPlayer software. This association is established through the values of two attributes:
- id: defines a keyword for referring to the software.
- classid: is a unique label that identifies MathPlayer in the Windows registry. It tells IE where MathPlayer is installed on the local machine.
The import processing instruction says that any element with the namespace prefix m: should be displayed using the software whose ID is MathPlayer.
The MathML expression is included in the document with each MathML element in the form of a qualified name with the m: prefix.
Using the above guidelines, you can author by hand Web pages that contain MathML to be displayed by MathPlayer. Alternatively, you can use the translation mechanism provided in products like MathType or WebEQ to save an equation in the desired form and directly paste it into the HTML document. Details of how to do this are provided under CSS primer and Using CSS with MathML. The following figure shows how the document in the above example looks, when viewed in IE.
Figure: A simple MathML equation as displayed in IE using MathPlayer.
Since MathPlayer is implemented as an IE Behavior, it has access to information about the various display settings of the browser (such as the font style, size and color). Hence, MathPlayer can automatically adjust the display of all equations to match the default settings of the browser. The following figure shows the result of viewing the same document but with the default font style set to Courier, a larger font size, and the background color set to gray. Note that all these changes are automatically applied to the display of the equation.
Figure: The same equation but using different default settings for the font style, font size, and background color.
<< back | next >> |
Copyright © CHARLES RIVER MEDIA, INC., Massachusetts (USA) 2003
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "The MathML Handbook" is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.
CHARLES RIVER MEDIA, INC., 20 Downer Avenue, Suite 3, Hingham, Massachusetts 02043, United States of America