Styles in MathML Markup
MathFlow enables the use of user-defined custom styles definitions as described in "Manage Custom Font Styles" in the Structure Editor documentation. Custom styles are represented in the MathML markup by attributes specifying style names. Here we give more details about how the association between the style name and the actual font being used is managed.
All character data in a MathML expression must be contained in a token element (MI, MO, MN, MTEXT, etc.) The font used to render the character data is determined by the values of the "mathvariant", "class", "fontfamily", "fontweight" and "fontslant" attributes. The last three attributes are deprecated by MathML 3.0 and are not generated by MathFlow (though they are still honored by the MathFlow rendering engine.) The values for any of these attributes may either be set explicitly on token elements, or inherited from a parent element, usually an MSTYLE element.
When several of these attributes are used, MathFlow uses the following precedences in determining which of them controls the font:
- Explicit "mathvariant" values
- Inherited "mathvariant" values
- Explicit "class" values
- Inherited "class" values
- Explicit "fontfamily" "fontweight" and "fontslant" values
- Inherited "fontfamily" "fontweight" and "fontslant" values
Both the "mathvariant" and "class" values are interpreted as specifying all three components of the fonts specification -- family, weight and slant. Thus, the "mathvariant" value "bold" actually specifies a serif font face, in bold weight, with normal (upright) slant.
To illustrate the above precedence rules, consider and example. If we define the style "myArial" to have family="Arial", weight="normal" and slant="automatic", then the following will display the x in an Arial, normal, upright font, and the y in serif, bold, upright (since mathvariant="bold" takes precedence over fontstyle="italic"):
<math> <mstyle mathvariant="bold" fontstyle="italic">
<mi class="myArial">x</mi><mo>+</mo><mi>y</mi> </mstyle> </math>
Whereas this will display the x in a serif, bold, upright font, and the y in Arial, normal, italic:
<math> <mstyle class="myArial" fontstyle="italic"> <mi mathvariant="bold" >x</mi><mo>+</mo><mi>y</mi> </mstyle> </math>
|