RESOURCE CENTER

“Really Strategies provides us with the third-party expertise we need.”

—Kinsey Wilson
USATODAY.com
Resource Center

Does MathML Add Up?

Does your content include math? If so you've probably experienced the complexities of creating, maintaining, and rendering equations for different media. How do you avoid re-creating the same equations over and over, first in the editorial process, then for print composition, and again for Web delivery?

Perhaps you've decided reluctantly that PDFs of your composed pages must suffice on the Web. And the pain of re-authoring every equation—because, say, your composition system can't import equations from Word—may seem a necessary burden.

But new standards and new technologies offer a chance to re-evaluate how effectively you can manage and deliver math-rich content.

Enter MathML

MathML is a W3C-standard XML representation of mathematical formulas. Here's an example:

  <msqrt>
    <mrow>
     <msup>
      <mi>b</mi>
      <mn>2</mn>
     </msup>
    <mo>−</mo>
    <mn>4</mn>
    <mi>a</mi>
    <mi>c</mi>
    </mrow>
  </msqrt>

The outer <msqrt> element indicates that all the contents belong inside a square-root. The <mrow> tag is a simply a container for a horizontally aligned set of expressions. <msup> delimits a pair of elements that take baseline and superscript positions. <mo>, <mn>, and <mi> indicate operators, identifiers (i.e., variables), and numbers, respectively. This corresponds to the expression

A more complete example, the quadratic equation, is

  <mrow>
    <mi>x</mi>
    <mo>=</mo>
    <mfrac>
     <mrow>
      <mo>−</mo>
      <mi>b</mi>
      <mo>&PlusMinus;</mo>
      <msqrt>
       <mrow>
        <msup>
         <mi>b</mi>
         <mn>2</mn>
        </msup>
        <mo>−</mo>
        <mn>4</mn>
        <mi>a</mi>
        <mi>c</mi>
       </mrow>
      </msqrt>
     </mrow>
     <mrow>
      <mn>2</mn>
      <mi>a</mi>
     </mrow>
    </mfrac>
  </mrow>

which is rendered as

Additional elements, attributes, and entities can capture matrices, integrals, set theory, and many other types of expressions. This flavor of MathML is called "presentation MathML," because it describes notation without trying to capture meaning.

Another set of MathML components, referred to as "content MathML," attempts to represent meaning. For example, to convey ab using presentation markup, one might write

  <msup>
    <mi>a</mi>
    <mi>b</mi>
  </msup>

But to show explicitly the base/exponent sense in the same expression, one would use

  <apply>
    <power/>
    <ci>a</ci>
    <ci>b</ci>
  </apply>

Although the content MathML model is more complex, it will likely yield better results when, say, converting mathematical expressions into speech, or exchanging math fragments between symbolic computation programs. But for most purposes presentation MathML offers a good blend of simplicity and power.

Tools

MathML has been around for a while, but it couldn't offer solutions to the problems of maintaining equations or rendering them on the Web without compliant software. Happily, both authoring and web-rendering tools for MathML are maturing.

On the rendering side are some convenient browser developments: The inclusion of native MathML rendering capability in the Netscape/Mozilla line of browsers, and a pair of free MathML rendering plug-ins for Internet Explorer. One is MathPlayer, by Design Science, and the other is techexplorer by Integre. Once you have a plugin, or if you're using Netscape or Mozilla, cruise over to the MathML Test Suite to see what's possible. Try the Torture Test.

By the way, this page doesn't use MathML. To ensure everyone could see the samples without a plugin, I've inserted the rendered equations as images. That's a common trick, but has two major shortcomings: (1) You need to regenerate an image if you want to edit an equation, and (2) the image won't scale with the text if you alter your base font size. Try scaling down your browser font to see that. It gets ugly fast if you have a lot of math embedded in your text.

For editing MathML there are a number of tools now available. In fact, the W3C maintains a nice list of them on their MathML Software page. Of particular interest is MathType, also by Design Science. It's the big brother of the equation editor built into Microsoft Word. It can seamlessly replace that tool in Word, or it can be run in standalone mode. You can configure it to save or copy-to-clipboard in several formats: notably MathML, TeX, LaTeX, EPS, GIF, and WMF.

Scenario

How does all this help? Let's suppose you're adopting single-source content-management, and XML is at the heart. Even if your documents are initially authored in Word, you now have a means to translate math into MathML when converting those documents into XML. There's no need to manually recreate equations and subject them to human error. Then you can send that MathML directly to the Web, or use it to generate alternate markup (e.g. LaTeX) or images for page-makeup. Or perhaps your next composition engine will be MathML aware, and translation won't be necessary.

In any case, XML with MathML offers both immediate solutions and future promise for flexible, powerful, and accurate management of math-rich content.

Privacy Policy |  Register |  Unsubscribe

Really Strategies' Blog

Consultants and analysts blog about strategy, content, and XML. See what they are saying.

Newsletter Index

General Publishing

Composition

Collaboration

Content Management

Licensing/Syndication

Rich Data Products

Semantic Technology

Software Development

Standards

XML Editing

Production

Oh Really! 5 Questions With...

Inside the Brackets