XML technologies / DocBook / Block elements / Equations / DocBook and MathML

(Excerpt from "DocBook-XML: Medienneutrales und plattformunabhängiges Publizieren" by Thomas Schraitle)

DocBook can be customized to include MathML (see Extending DocBook with MathML). An introduction to MathML is beyond the scope of this section. Converting the formula in the code example Structure of a displayed equation (equation.xml) to MathML produces the following:

Example: Equation in MathML syntax

<equation>
    <title>Zerfallsgesetz</title>
    <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML">
        <mml:mrow>
            <mml:mrow>
                <mml:mi>N</mml:mi>
                <mml:mo mml:stretchy="false">=</mml:mo>
                <mml:msub>
                    <mml:mi>N</mml:mi>
                    <mml:mn>0</mml:mn>
                </mml:msub>
            </mml:mrow>
            <mml:msup>
                <mml:mi>e</mml:mi>
                <mml:mrow>    
                    <mml:mo mml:stretchy="false">&lambda;</mml:mo>
                    <mml:mi>t</mml:mi>
                </mml:mrow>
            </mml:msup>
        </mml:mrow>
    </mml:math>
</equation>

In DocBook 5, the prefix does not matter when using the RELAX NG or W3C schema. However, the MathML module in the DocBook 4DTD uses the mml prefix. If you generate MathML with a program that uses no mml prefix, adjust the output using search and replace.

When this book was written, only Mozilla, Firefox and Netscape 7 could display MathML, with minor limitations. Firefox has a page about MathML.

Note: Formula editor and MathML in OpenOffice.org
The formula editor built into OpenOffice.org lets you enter formulas graphically and export them as MathML.

  

back to top