5. Adding equations to your DocBook document

MathML

MathML support requires the "MathML support" and the "JEuclid image toolkit plug-in" add-ons to have been installed using OptionsInstall Add-ons in XMLmind XML Editor - Online Help.

  • Use the "Add image" toolbar button to add an image to your DocBook document. The image file pointed to must have a ".mml" file extension and must contain valid MathML presentation markup. Example:

    <figure>
      <title>Proving ...</title>
      <mediaobject>
        <imageobject>
          <imagedata fileref="equations/eq1.mml"/>
        </imageobject>
      </mediaobject>
    </figure>
    Figure 3. Proving the Pythagorean theorem
    Proving the Pythagorean theorem
  • Or, use the "Add MathML equation" tool bar button to embed MathML presentation markup in your DocBook 5 document. See also XMLmind XML Editor - Support of MathML 2.0. Example:

    <inlineequation><math display="inline" xmlns="http://www.w3.org/1998/Math/MathML">
      <mrow>...</mrow>
    </math></inlineequation>

TeX/LaTeX math

TeX/LaTeX math support requires the "JLaTeXMath image toolkit plug-in" add-on to have been installed using OptionsInstall Add-ons in XMLmind XML Editor - Online Help.

  • Use the "Add image" toolbar button to add an image to your DocBook document. The image file pointed to must have a ".tex" file extension and must contain mathematical formulas written in LaTeX, which are supported by JLaTeXMath. Example:

    <figure>
      <title>Excerpts ...</title>
      <mediaobject>
        <imageobject>
          <imagedata fileref="equations/eqA.tex"/>
        </imageobject>
      </mediaobject>
    </figure>
    Figure 4. Excerpts from "User’s Guide for the amsmath Package (Version 2.1)"
    Excerpts from "User’s Guide for the amsmath Package (Version 2.1)"
  • Use the Edit tool in XMLmind XML Editor - Online Help to insert an inlineequation(tex), informalequation(tex) or equation(tex) element template in your DocBook 4.5 or 5+ document. The newly inserted equation has a ready to use <mathphrase role="tex"> child element. Example:

    <inlineequation><mathphrase role="tex">
    \(\lim_{h \rightarrow 0 } \frac{f(x+h)-f(x)}{h}\)
    </mathphrase></inlineequation>
[Tip]

TeX/LaTeX math delimiters are optional. However specifying them may be useful as \[math\], $$math$$ or \begin{env_name}math\end{env_name} specify displayed math, while \(math\) or $math$ specify in-line math.

[Tip]

If you need to refresh the preview after modifying the TeX/LaTeX math code found in the <mathphrase role="tex">, simply right-click this element and select item "Update TeX Math Preview" from the contextual menu.