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:
Clicking on a tool in a palette always replaces the implicitly or explicitly selected element[2] by the MathML template clicked upon.
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.
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.
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.
Suppose that you need to type the following, very simple, inline equation in a DocBook 5 document: .
Use the "
" button found in the DocBook toolbar and select .Click inside the newly inserted element and select the Equations palette in the MathML tool. Click on the Equation template:
This gives you:
Type "E
" in the left placeholder:
Click in the right placeholder then select the ``Invisible Times'' binary operation (rightmost template in the screenshot below) from the "Operations & Functions" palette.
This gives you:
Type "m
" in the left placeholder:
Click in the right placeholder then select the empty Superscript template in the Scripts palette:
This gives you:
Type "c
" in the left placeholder:
Do not type "2
" in the right placeholder. Instead click inside this placeholder then select 2 from the "Variables & Numbers" palette:
This finally gives you:
Notice how the equation was built using a top to bottom approach: equation, left hand, right hand, binary operation, left operand, right operand, etc. Using such top to bottom approach is absolutely required when you work with the MathML tool. If you prefer the more natural left to right approach, then you really have to learn MathML (mrow
, etc) and work with the Edit tool ( , , etc).
When you don't understand a template, move your mouse over it and you'll see a useful ``balloon help''.
The replacement operations performed using a MathML palette are repeatable. That is, suffice to click elsewhere and press Ctrl+A (Cmd+A on the mac) to repeat the same replacement operation.
The replacement operations performed using a MathML palette can be recorded using the macro recorder (
→ → ).The MathML tool has a "Text & Space" palette. Use it if you want to insert text which is not mi
, mn
or mo
.
If you want to edit an mtable
, for example add a column to a matrix or add an equation to a set of equations, use the table editing commands found in the menu (e.g. → → ) and in the menu (e.g. → → ).
If you want to insert special characters, use the Characters tool or use the " " found in the menu and in the menu.
It is fairly easy to tweak the look of an equation created using the MathML tool. For this, you'll generally insert mspace
elements ( → ), wrap one or more elements into a mphantom
or mpadded
element ( → ) or specify attribute values using the Attributes tool. Of course, doing this requires you to learn MathML presentation markup.
[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.