3. Using the MathML tool

Figure 1. The MathML tool
The MathML tool

Using the MathML tool does not require you to learn MathML presentation markup. However there are three points you must learn, understand and remember before using this tool:

  1. Clicking on a tool in a palette always replaces the implicitly or explicitly selected element[2] by the MathML template clicked upon.

    Figure 2. Clicking on the "xn Scripts" button in the MathML tool displays the Scripts palette
    Clicking on the "xn Scripts" button in the MathML tool displays the Scripts palette
  2. A section in a palette[3] always starts with a completely empty template followed by one or more samples of this template.

    These samples show you how, once filled, the empty template looks like. They are also useful by themselves: you may prefer clicking on them rather than the empty template and then, use the normal text selection to replace some of the text they contain.

  3. As always with XMLmind XML Editor, you need to type text in the placeholders contained in the newly inserted math template. MathML has three main text containers:

    mi

    represents identifiers: variable names, function names, constants, etc.

    mn

    represents numbers.

    mo

    represents operators (e.g. "+"), fences (e.g. "("), separators (e.g. ",").

    Most placeholders are mi elements[4]. Make sure not to type a number inside an mi element, not to type a variable name in an mn element, etc. If you need to specify a number,

    • click inside the mi placeholder and use the "Variables & Numbers" palette to replace it by a number,

    • or, more simply, type the number then press Ctrl+Shift+SPACE to let XMLmind XML Editor replace the mi element by an mn element. More information about this facility in Section 3.1, “Parsing simple math expressions as MathML”.

    Why all this trouble? After all, we are talking about presentation markup and not about content, semantic, markup. The reason is that using the right presentation element also means using the right typesetting rules.

    Example 1: typing a single letter in an mi element renders this element using an italic font, while typing a longer identifier renders this mi element using an upright font.

    Example 2: typing a curly brace "{" inside an mo element placed before a ``tall element'' (e.g. a fraction) will cause the curly brace to stretch vertically. Note that there is no way to force a curly brace to stretch vertically if you type this character in an mn or mi element.

    Example 3: typing a "+" sign inside an mo element placed between two elements automatically adds the right amount of space before and after the "+" sign.



[2] The explicitly selected nodes have a red box drawn around them. In absence of explicitly selected nodes, the implicitly selected element is the element having a text node child containing the caret.

[3] In the above screenshot, the first section of the Scripts palette is Subscript, the second one is Superscript, etc

[4] The samples found after the empty template give you a hint on the nature of the placeholders.