November 29th, 2022

Default Math Properties

Murray Sargent
Principal Software Engineer

Quite a few math properties have document default values. These default values are used if you don’t override them, which you can do usually by invoking a math context-menu option or programmatically by calling the ITextDocument2::SetProperty or ITextDocument2::SetMathProperties methods. Most properties pertain to “displayed” math zones, that is, math zones that begin either at the start of the document or a hard/shift Enter (CR/VT) and end at the following hard/shift Enter. The options determine math indents and characteristics such as whether integral limits are positioned below and above the integral or as subscript and superscript. For example in Russian documents, it’s common to see the integral limits below and above the integral, while in the United States, limits are usually displayed as subscript and superscript on a large integral sign.

You can change the default settings to suit your tastes or a publisher’s conventions. In the math ribbon (type Alt+= to insert a math zone and select the math ribbon tab), click on the Tools button over toward the left side of the ribbon. A dialog will be displayed that shows a variety of math properties along with buttons to access the math autocorrect and recognized-function dialogs.

The document default math properties in this dialog are described in a somewhat technical way in the math section of the RTF specification. The properties belong to the RTF {\mmathPr…} group. They are also children of the <mathPr> OMML element. In this post, I describe the properties in a less technical way. For easy reference to the RTF specification, the relevant RTF control word is listed in parentheses along with the corresponding ITextDocument property values. The dialog also has some options that are not document default math properties, such as “Copy MathML to the clipboard as plain text” instead of “Copy Linear Format to the clipboard as plain text.” Such options do not affect the layout of a document and hence are stored in the system registry rather than in the document.

Default font for math zones

The Word Equation/Conversions dialog gives a drop-down list of math fonts that can be used as the default math font for the document. Cambria Math and STIX Two Math MS are examples of math fonts. (RTF: \mmathFontN)

Reducing size of nested fractions in displayed equations

Specifies that nested fractions should be displayed such that the numerator and denominator are written in a script or script-script size instead of regular-text size. Specifically, characters in the outermost fraction’s numerator and denominator are displayed using the full text size, characters in a nested fraction are displayed in the script size (about 70% as large as the text size), and fractions nested inside a nested fraction are displayed in scriptscript size (about 60% as large as the text size). TeX uses this “small fraction” choice by default, but Word 2007 does not, basically because in all the physics books I’ve read I don’t remember seeing reduced sizes used in display math. But if you prefer them, you can change them. For in-line math expressions, small fractions are used. (RTF: \msmallFracN; SetMathProperty—tomMathDispFracTeX)

Breaking lines with binary or relational operators

By default, a line break occurs before the binary operator. That is, the binary operator is the first control word on the wrapped line. But you can change it so that a line break occurs after the operator (tomMathBrkBinAfter), or so that the operator is duplicated (tomMathBrkBinDup), that is, it appears at the end of the first line and at the start of the second. (RTF: \mbrkBinN; SetMathProperty)

Duplicating operators for subtraction

If the minus operator (U+2212) coincides with a line break, by default the minus appears after the line break. But it can appear before and after the break (tomMathBrkBinSubMM) or a plus before the break and a minus after the break (tomMathBrkBinSubPM), or vice versa (tomMathBrkBinSubMP). (RTF: \mbrkBinSubN; SetMathProperty)

Placement of integral limits

Limits of integrals in display-mode equations can be either centered above and below the integral or positioned just to the right of the integral. The default setting is to position the limits to the right of the operator (subscript/superscript). (RTF: \mintLimN; SetMathProperties—tomMathDispIntUnderOver)

Placement of n-ary limits

Limits of summations, products, and other n-ary operators can be either centered above and below the n-ary operator, or positioned just to the right of the operator.  The default setting is above and below the operator. (RTF: \mnaryLimN; SetMathProperties—tomMathDispNarySubSup)

Math style for differential d and related characters (U+2145..U+2149)

In the United States, the differential d (ⅆ – U+2146) is almost always displayed as a math italic d, but in Europe, an upright d is standard. The latter choice emphasizes that the differential d is different from regular mathematical variables. Similarly, the Napierian logarithm base ⅇ (U+2147) and the imaginary unit ⅈ (square root of -1, U+2148) are displayed as math italic in the United States and upright in Europe. (RTF: \mdispDefN; SetMathProperties—tomMathDocDiffDefault, tomMathDocDiffUpright, tomMathDocDiffItalic, tomMathDocDiffOpenItalic).

Empty argument display

Math object arguments may be optional, e.g., integral limits, or essential, e.g., numerator or denominator. To control what is displayed for empty arguments there are three possibilities: tomMathDocEmptyArgAuto, tomMathDocEmptyArgAlways (display ⬚), and tomMathDocEmptyArgNever. The first of these doesn’t display anything for optional arguments unless you use the arrow keys to move into the argument, at which point the ⬚ is displayed and you can enter math text. This setting is controlled by SetMathProperties() and isn’t persisted since it’s a UI property, not a document property. Note that if tomMathDocEmptyArgAlways is active, you can still display nothing by entering a zero-width space (U+200B).

Spacings for display-mode math

Document properties to use the default math paragraph settings for equations, i.e., use values given by \mlMarginN, \mrMarginN, \mdefJcN, \mwrapIndentN, \mwrapRightN, etc., defined below. The default is to use the default math settings described below, but you can change it to use the text paragraph settings. (RTF: \mdispDefN; SetMathProperties—tomMathDispDef)

Left margin

Document property for the left margin for math. Math margins are added to the paragraph settings for margins. (RTF: \mlMarginN; SetProperty—tomMathLMargin)

Right margin

Right margin for math. (RTF: \mrMarginN; SetProperty—tomMathRMargin))

Justification

Document property for the default justification of displayed math zones. Individual equations can overrule the default setting. Displayed math zones can be left justified, right justified, centered, or centered as a group. When a displayed math zone is centered as a group, the equation(s) are ordinarily left aligned within a block, and the entire block is centered with respect to column margins. The user can use a context menu to align equations in more general ways, e.g., on the equal signs. (RTF: \mdefJcN; SetMathProperties—tomMathParaAlignCenterGroup, tomMathParaAlignCenter, tomMathParaAlignLeft, tomMathParaAlignRight)

Wrapped line indentation

Indent of wrapped line of an equation. The line or lines of a wrapped equation after the line break can either be indented by a specified amount from the left margin, or right-aligned. The default indent is 1”. (RTF: \mwrapIndentN; SetProperty—tomMathWrapIndent)

Right alignment of wrapped lines

If enabled, right justify wrapped lines of an equation. If disabled, the line or lines of a wrapped equation after the line break are indented by \mwrapIndentN from the left margin. (RTF: \mwrapRightN; SetProperty—tomMathWrapRight)

Spacing before math paragraph

(RTF: \mpreSpN; SetProperty—tomMathPreSpace).

Intraequation spacing between lines in an equation

(\RTF: mintraSpN; SetProperty—tomMathPostSpace).

Spacing between equations within a display math paragraph

(RTF: \minterSpN; SetProperty—tomMathIntraSpace).

Spacing after math paragraph

(RTF: \mpostSpN; SetProperty—tomMathInterSpace).

Math-zone surround spacing

The property tomMathZoneSurround (RTF: \mzSurround) inserts the spacing given by Value before and after math zones.

Build-up flags

The Value argument for the property tomDocMathBuild can consist of any combination of the flags tomMathAutoCorrect, tomTeX, and tomMathAlphabetics. The flag tomMathAutoCorrect autocorrects using entries in the built-in math autocorrection list, which includes most standard TeX control words. The flag tomTeX uses [La]TeX build-up/down rules instead of UnicodeMath rules. The flag tomMathAlphabetics converts ASCII and lower-case Greek letters to math italic, math bold, and math bold-italic characters according to the UI bold and italic font settings. These values are used by math UI but are not persisted in file formats.

Discussion

If a line break occurs at the invisible times (U+2063), ordinarily one would use the \times (× U+00D7) for a visible times character, but a raised dot is another possibility. This document property isn’t currently implemented.

MathML 4 introduces a new attribute called “intent”. This attribute allows you to disambiguate math notation. For example, it lets you specify whether a superscript is a power or an index. To reduce the number of places the intent attribute is needed, there is a set of document default intent values. With them, you only need the intent attribute when the instance differs from the default values.

Currently, MathML doesn’t formalize document defaults for math, but MathML math zones can inherit them from the host container, e.g., from HTML5. Such defaults are compatible with MathML and need to be stored outside the individual MathML <math> elements. In principle, MathML could have a new element <mdefaults> that contains the default properties. The container document would need to recognize this element and use the properties it contains. Making this a MathML element seems desirable since MathML is responsible for the needs of mathematics.

Author

Murray Sargent
Principal Software Engineer

Yale BS, MS, PhD in theoretical physics. Worked 22 years in laser theory & applications first at Bell Labs and then Professor of Optical Sciences, University of Arizona. Worked on technical word processing, writing the first math display program (1969) and the technical word processor PS (1980s). Developed the SST debugger we used to get Windows 2.0 running in protected mode thereby eliminating the 640KB DOS barrier (1988). Have more than 100 refereed publications, 3 laser-physics books, 4 ...

More about author

0 comments

Discussion are closed.