2. How to add equations to your XML documents

  • If you are authoring DocBook 5 documents, insert an equation, informalequation or inlineequation containing a MathML mml:math child element into your document, then edit the contents of this mml:math child element normally, using the Edit tool and/or the MathML tool (see below).

    In order to insert insert an equation, informalequation or inlineequation containing a MathML mml:math child element into your DocBook 5 document,

    • Use the Edit tool and choose one of the equation(mathml), informalequation(mathml) or inlineequation(mathml) element templates.

    • OR use the "Add MathML Equation" found in the DocBook tool bar.

  • Same approach if you are authoring a DITA topic or an XHTML 5 page.

  • For all document types other than DocBook 5, DITA topics and XHTML 5 (DocBook 4, XHTML 1.x, etc), you must treat MathML as if it were a graphics format such as SVG or PNG.

    Unlike what happens for DocBook 5 documents, DITA topics and XHTML 5 pages, you'll not be able to directly edit the MathML elements, but if you install this MathML add-on (which depends on the add-on called "JEuclid image toolkit plug-in" — see 5), the MathML elements will be properly rendered on screen and also properly converted to formats such as HTML, PDF, RTF, etc.

    In practice, this means:

    1. Create a standalone MathML document using FileNew, MathML, "Inline Math" or "Math Block".

    2. Reference this MathML document in the proper ``image element'':

      DocBook 4 example

      <imagedata fileref="equations/equation1.mml"/>

      XHTML 1.x example

      <img src="equations/equation1.mml"/>