Skip to main content

Configuring the operator dictionary

Operators have certain properties that are set in an operator dictionary, such as the size of the space to the left or right of the operator, how it changes when in display or inline style, how it stretches, etc.

MathFlow sets these properties to sensible values, but in some instances you may want to fine-tune them. To do that, create a file named mfopdict.txt. In the MathFlow Composers, you can specify the path to the operator dictionary using the SetOperatorDictionary() method or function or use the -opdict parameter in a command line call. To specify the path to the operator dictionary for the MathFlow Editors, use the webeq3.util.DSIProductInfo.setOperatorDictionary() method.

Note there is a sample mfopdict.txt file located in the MathFlow directory.

Format of the configurable operator dictionaries

The properties (e.g., spacing) may be different according to the position of the operator in the formula; whether it is in the middle (infix), at the beginning (prefix), or the end (postfix) of an expression. To reflect this, mfopdict.txt should have three tables, each one started by a line with its name: INFIX, PREFIX, or POSTFIX. It is also possible to change the default spacing for all operators (only the spacing, not other properties), by writing a line with an operator name of "default". Values that are not explicitly set for an operator, or not in a "default" line for spacing use MathFlow internal values.

In brief:

  • Empty lines are ignored.

  • Lines starting with // are considered comments and are ignored.

  • Operators can be more than a single character.

  • There are three keywords: INFIX, PREFIX, and POSTFIX to indicate the beginning of each table. Each one should appear in a line by itself.

  • Each meaningful line is a comma-separated list, in the form opname, lspace, rspace [, largeop=true|false, stretchy=true|false, accent=true|false, moveablelimits=true|false, dsi:linebreakop=true|false, dsi:stretchby=segments|scaling, dsi:scaleratiopct=integer]

    • opname is a character, a MathML entity name, or a numerical reference (#xNNNN for hexadecimal, #NNNN for decimal). For example, comma could be represented by the name "comma", the character ",", or the numerical references #x02C or #44.

    • lspace and rspace are numbers+unit, where the optional unit could be 'u' (1/100 em) or 'em'. The default is 'u'.

    • The other properties should come at the end of the line, and are optional. See the table below for further description of each property.

  • Default spacings for each table can be given by using opname='default'.

  • Numerical references start with #, e.g. #x3b1 (hexadecimal reference) or #2271 (decimal reference).

  • Do not include spaces at the ends of the lines.

Attribute

Description

Values

largeop

A few characters like integrals and summation signs are typically set in a larger font in a display equation than they are in inline equations where it is good to save space vertically. If true, the operator is rendered at the large font size.

Boolean (default: MathFlow internal value)

stretchy

Certain characters, such as parentheses and arrows, can stretch to match the height or width of an adjacent expression. A value of "true" allows the character to stretch, whereas a value of "false" disables stretching.

Boolean (default: MathFlow internal value)

accent

In normal math typesetting, an underscript or an overscript is displayed in a reduced font size, just as with a normal superscript. However, in many situations, this is not what looks best. In particular, with accent characters like tildes and bars, the size for the accent should match the size of the character over which it is placed. Also, these accent-type characters are usually typeset a bit closer to the character. You can tell MathFlow to treat an overscript as an accent for typesetting purposes by setting this property to "true."

Boolean (default: MathFlow internal value)

moveablelimits

Some large operators, such as summation signs, are traditionally typeset with associated limits in the subscript and superscript positions when the equation appears inline, and they appear above and below the sum in a display equation. You can disable this automatic shift between typesetting styles depending on the context by setting this property to "false."

Boolean (default: MathFlow internal value)

dsi:linebreakop

If true, the operator is used when linebreak="dsi-linebreakop" to control line-breaking behavior and when indentalign="dsi-linebreakop" to control indenting behavior. See Line-breaking and Indentation for further details.

Boolean (default: false)

dsi:stretchby

Only supported in the Windows Composers. Controls whether the stretchy character should use segments (connecting pieces of the character) or scaling (stretching a character). This only applies to characters that have segments that can be put together to make the character.

segments | scaling (default: segments)

dsi:scaleratiopct

Only supported in the Windows Composers. When scaling a stretchy character, this is the percentage of growth in a non-sizing direction. It allows a character to maintain a more natural look when scaled, but still not appear too thick.

Integer, typically between 30 and 100 (default: 70%)

Example:

////////////////////////////////////////////////
INFIX
////////////////////////////////////////////////
default, 17, 17
minus, 33, 33
plus, 33, 33
sum, 33, 33, moveablelimits=false
////////////////////////////////////////////////
PREFIX
////////////////////////////////////////////////
default, 17, 17
plus, 3em, 5
sum, 33, 33, moveablelimits=false
////////////////////////////////////////////////
POSTFIX
////////////////////////////////////////////////
plus, 5u, 3em
sum, 33, 33, moveablelimits=true

This mfopdict.txt file:

  • changes the default spacing of all INFIX and PREFIX operators to 0.17em on both sides, but uses MathFlow default values for postfix operators,

  • sets the spacing for the INFIX minus, plus, and sum operators to 0.33em on both sides,

  • sets the moveablelimits property for the INFIX sum operator to false,

  • sets a larger left space (3em) and a smaller right space (0.05em) for the PREFIX plus operator, and

  • specifies moveablelimits for the sum operator when used as a POSTFIX operator.