Restricted Math Zone Character Formatting

A number of character formatting properties are treated differently in a math zone than they are in ordinary text. These include underline, strikeout, math font face and size, subscript and superscript. This post discusses how these properties differ in math zones, sometimes to the surprise of users.

For starters, the ordinary subscript and superscript attributes are not allowed in math zones, since they are insufficient to handle the more elaborate kinds of scripts found in mathematics. In particular they are only one level; a subscripted superscript cannot be represented with them, nor can a superscript be aligned over a subscript. On a more subtle level, the special “cut-in” kerning of math fonts like Cambria Math isn’t available in nonmath fonts. In principle, it would be possible to support the Ctrl+= hot key for subscript and the Ctrl+Shift+= hot key for superscript along with the corresponding ribbon tools, but it might be confusing and simple linear format commands like e^x for superscripting the x are easier to type in spite of their substantially increased generality.

The underline and overstrike attributes are automatically extended throughout the math zone. We tried allowing them to apply on the usual per glyph basis, but that can lead to visual chaos, with underlines up and down throughout a multilevel equation. So to give feedback to the user, we draw a uniform underline and/or a strikeout throughout the math zone. If you want to underline a particular expression, use the underbar math object (linear format \underbar(…), where … is what you want to underline. This measures the … and draws a uniform underline under it . Similarly \overbar(…) draws a bar above the … . If you want to strike through an expression put it in a rectangle using \rect(…) and use the context menus to choose the horizontal strike option. You also need to hide the rectangle borders, since these are shown by default.

Onto the math font. Only one is allowed in a given math zone and it must be the same size throughout that math zone. Furthermore if the math font can display a character, it must be displayed by the math font and not by some other font, unless the character is marked as "Normal text". The only cases where other fonts are allowed in a math zone is for characters not supported by the math font, such as Chinese and Indic characters, or for Normal text embedded in the math zone.

At first these restrictions to a single math font and size seem overly cautious. Users love to use multiple fonts for one purpose or another. But the restrictions are there for very good reasons. Mathematical typography has extensible entities such as fraction bars, the line over the radicand of a square root, and a myriad bracket types that grow to fit their arguments. There are many font-size depended parameters that support the varioushorizontal and vertical placements in mathematical expressions. One needs to have a uniform size throughout the math zone to render these things properly. Also mathematical expressions just look better when displayed consistently with the same font. However, one case where it might be handy to use another font on occasion is when the math font doesn’t support the full Unicode math character set, which is the case with Cambria Math. The STIX font does have glyphs for all the math characters. Hopefully it will support the other features of a math font needed for high-quality math typography.

You might want to call attention to some math characters within a math zone. Changing the math style isn’t what you need, since that would change the meaning of the variables. One method that I’ve used over the years in lectures is to distinguish variables by color. For example, three-mode laser light has the frequencies ω1, ω2, and ω3, in order of increasing frequency. To emphasize their relationships, I’d color them and their ray lines as red (ω1), green (ω2), and blue (ω3), since in the visible light spectrum red has lower frequency (longer wavelength) than green, which, in turn, has lower frequency than blue. The laser mode frequencies were much closer together in frequency than those colors, but people understood what was meant. In fact, color is sufficiently important for such purposes that MathML has foreground and background color attributes. OMML doesn’t, but should. Word uses embedded WordProcessingML to represent color in math zones, but this isn’t as interoperable as having color attributes directly in OMML.