Adding MathML equations

The 'Add MathML equation' button toolbar button allows to add an m:math top-level MathML element to your document. For now, this button is found in the toolbar only when you open a DocBook v5+ document, a DITA topic or an XHTML 5 page.

The newly inserted m:math element contains just an empty m:mi (math identifier) element. Using the MathML tool, you'll be able to replace this placeholder by complex equations without knowing much about the MathML standard.

The MathML tool

The MathML tool contains a number of palettes. Each palette contains a number of MathML templates.

The Equations palette

Clicking on a template replaces the implicitly or explicitly selected element by this template. Remember that the element containing the caret is implicitly selected. Therefore, generally, clicking on a template replaces the element containing the caret.

In practice, this means that using the MathML tool imposes you to construct your equation using a top-down approach. If you want to write ???, you cannot write that naturally, from left to right. You'll have to first insert the Equation template template, then replace the left placeholder by a fraction template Fraction template, then replace the right placeholder by another fraction template and so on. This top-down approach may seem tedious and slow, but it is also easy to remember and straightforward to use.

Fortunately, in some cases, there are ways to workaround this top-down approach:

This being said, if you know MathML, you are free to write your equations directly using the Edit and the Attributes tools. Because XMLmind XML Editor natively supports MathML presentation markup, MathML elements are not treated differently than say, a paragraph or a list item.

Let's give it a try

Suppose that you need to insert the following equation in a DocBook 5 document: ???.

  1. Replace the initial empty m:mi (math identifier) element by clicking on the simplest equation template.
  2. Type "F" in the left placeholder.
  3. Replace the right placeholder by clicking on the fraction template.
  4. Type "G*m_1*m_2" in the numerator of the fraction; press Ctrl+Shift-SPACE to invoke "Parse Text As MathML"; Click in the popup (or press Down then Enter, like for any popup menu) to accept what's suggested in the popup.

    Notice that character "*" is translated by "Parse Text As MathML" to what's looks like a small x. This very common MathML operator is called InvisibleTimes. This operator is peculiar because normally it's invisible. However for easier editing, XMLmind XML Editor has made it visible.

  5. Type "d^2" in the denominator of the fraction; press Ctrl+Shift-SPACE to invoke "Parse Text As MathML"; press Down then Enter to accept what's suggested in the popup.

    Most computer keyboards will allow you to directly type "d2" in the empty denominator of the fraction. This empty denominator is, like all placeholders, an m:mi element. Don't do that because "d2" is clearly not an identifier. In MathML, "d2" is represented by:

    <m:msup>
      <m:mi>d</m:mi>
      <m:mn>2</mn:mn>
    </m:msup>

    and this is exactly what will be suggested by "Parse Text As MathML" if you type "d^2" in the denominator of the fraction.

Screencast Watch the screencast