MathML equations

Define mathematical equations and formulas for presentation on web pages

MathML is an XML markup language for defining the presentation of mathematical notations and content in equations. Browsers interpret the XML to render the equations in an accessible format. For example:

a + b c = d

Heretto CCMS and portal support MathML. The Heretto Equation editor (provided by MathJax) is a UI tool for creating MathML elements in DITA topics.

Restriction: MathJax supports the full MathML 3.0 standard. However, most web browsers support a subset known as MathML Core. It is important to understand what elements are and are not supported when creating MathML elements.

Equation editor

Use the Equation editor to insert and edit equations.

  1. In a topic, place the insertion point where the equation will be.

  2. Click Add Equation on the editor toolbar to open the editor.

    To edit an existing equation, click on the equation and click Edit.

    Heretto Equation editor with callout to the button on the tool bar that opens it

  3. Enter the equation and format it with the editor tools.

    Equation edit with callouts to Fraction, operators, and Regular Text tools

    Equation editor with callout to table tool

  4. Click Save.

Experience shows use that it is very hard to get the equation formatted just right. Often you have to use the source editor to fine-tune the equation editor's output. element for each character in the word. These can be combined for better rendering.

MathML XML elements for equations

Equations are defined in XML by the MathML standard and rendered by the browser. A simple equation looks like this in the Heretto source editor.

mathML source code and rendered with highlight colors showing the parts

Here are some of the common MathML elements:
mathml
Parent DITA element, contains just one math element.
m:math
Required container element; must include the xmlns name space directive.
m:mi
A symbolic name or arbitrary text that should be rendered as an identifier like variables, function names, and symbolic constants. According to the MathML Core specification, when an mi contains a single character, that character should be rendered in italics font style.
Tip: When entering a string text in the Equation editor, the editor assumes each character is an mi element. To render as single string, select the text and click the Regular text format (button). In this example, "alpha" is rendered as a single mtext, but "bravo" is rendered as a sequence of individual mi elements.

alpha + b r a v o

Alternatively you can edit the source and collect the string into a single mi element.

alpha + bravo

Either way, Medallia portal style attempts to render the sequence as a single string. If you see undesired spaces, consider using mtext or manually combine the characters into a single mi element.

m:mtext
A string of text. The MathML specification says mtext should be used for arbitrary text that is not part of the equation, such as a comment, and it discourages the use of mtext in equations stating that mi should be used instead. Medallia does not enforce that recommendation, and in fact, prefers mtext over mi for a sequence of characters.
Note: The MathML Core specification provides ms for string literals. The Equation editor does not support ms.
m:mo
Operators, such as multiplication and plus signs, brackets, parentheses, etc. The main reason to use an mo instead of mi or mtext is for semantics and to allow style changes. We however, do not apply a style change to them.
m:mn
Number, like 3.1415.
m:mfrac
Contains both numerator and denominator, and renders with a horizontal line separator. To place elements above and below without a separator, use an mtable instead.
m:mrow
Horizontally group a subexpression. Rows typically appear in fractions. In this equation a+b is an mrow in an mfrac.

a + b c = d

m:mtable, m:mtd, m:mtr
Tabular formatting with no horizontal or vertical line separators.

In this example, alpha is a cell (td) in a row (mtr) in a table (mtable), and bravo is in another row in the same table.

alpha bravo delta

m:mfenced (deprecated)
The Equation editor supports and uses mfenced, but that element has been deprecated from the MathML Core specification. As such, most Chrome-based browsers do not support this element. Use mrow and mo (open and close characters) to achieve the same results.

( a b )