Style Editor: controlling style properties

There are numerous MathML style and layout properties you can modify for most templates. These MathML properties can be tricky to use, since they interact with each other and their effects can change as the structure of the equation changes during editing. Proper use of style and layout properties is the most complicated aspect of MathML authoring.

To simplify controlling style and layout properties, the MathFlow Editor automatically handles most of the details. Select an expression, open its properties dialog box and change the appropriate values. In most cases the process is intuitive, and only a basic understanding of MathML properties is necessary.

To set style properties, you must begin by identifying the part of an equation to which they should apply by selecting it. Once an expression is selected, all the property options available for the selection become active on the Properties Menu. Choosing an item from the Properties Menu opens a dialog displaying a collection of related MathML properties applicable to the current selection. Within a particular properties dialog, some of the items may be disabled if they are not relevant to the current selection.

The MathML ancestry also provides a convenient way to open property dialogs. By double-clicking an ancestry label, you can highlight the corresponding area of the current equation and simultaneously open the default Properties dialog for that selection. Each kind of MathML template has a default Properties panel, depending on what MathML properties it supports. To open other properties dialogs, you must use the Properties Menu.

In most cases, you don't need to know anything about the syntax and legal values for MathML properties. In the Editor properties dialogs, you merely make selections from pull-down menus, mark checkboxes, and so on. The two main exceptions to this rule are sizes and colors. Some table properties must also be entered directly.

Size and color values are specified using a syntax very similar to that used by Cascading Style Sheets (CSS). Since legal values can take many forms, in the property dialogs, size and color values are just text areas where you can type any legal value. The MathFlow Editor checks what you enter, and will alert you if you enter an illegal value.

Colors can be specified either by keyword ('red', 'fuchsia', etc.) or by numerical value ('#ff0000', '#58a', etc.).  Sizes are specified by a number and a unit, or as percentages. See Size and color values for the precise formats used by MathFlow Editor.

Special property values

There are also two special property values MathFlow uses to make property management easier. Some properties, mostly operator properties, can be set to automatic. In this case, the property value is looked up in a table of default values that depend on the character and surrounding context. These automatic values produce the typography most people expect in mathematics typesetting, and are usually the default.

Specifying a value as inherited tells MathFlow the templates and characters in the current selection should inherit their values from the template inside which they are nested. Values inherited from the top-level template are initialized with default values.

The concept of an inherited property value is closely tied to the idea of "sticky" and "non-sticky" font properties, described in more detail in Working with math properties in the Tutorials.

The Font Properties dialog lets you change the font size and color scheme used to display characters. As with all property dialogs, the Font Properties dialog is opened from the Properties menu. It is also the default property dialog for identifier, number and text tokens, and can thus be opened by double-clicking the corresponding MathML elements in the MathML Ancestry panel.

MathFlow Style Editor Font Properties dialog

The following properties can be set from the Font Properties dialog:

Logical Font

You can use predefined MathML font styles to control the MathML font attributes for characters and expressions.

System Font (deprecated)

This is available for legacy purposes, but we recommend not using it for new documents. Use Logical Font styles instead, or attributes.

Font Size

The size of characters can be specified using normal MathML size values. In addition, you may use the relative sizes "big" and "small".

Font Color (foreground)

This property determines the font color for characters. Note in order to specify the color for non-character symbols such as radicals and fraction lines, you need to specify the property be applied "as defaults for selected expression.

It's possible to select one color for radicals and other similar "container" templates (such as fractions, parentheses, etc.), and another color for their contents. To do that, first apply color to the radical as described above ("Set as defaults for selected expression"), then deselect the radical and select only the contents. Apply color now to the contents. For this second step, either radio button will work.

Applying mixed colors to an expression

Any MathML color value is acceptable here.

Font Background (color)

This property determines the background color for the expression. The background color affects the bounding box of the current expression.

Any MathML color value is acceptable here.

"Sticky" vs. "non-sticky" properties

At the bottom of the Font Properties dialog are two checkboxes that determine whether the property settings will be sticky or not. If "Apply to each token element in the selection" is chosen, the properties are set for each individual character, and they will stick with them if you cut part of the expression and paste it elsewhere.

By contrast, if you choose "Set as default for selected expression", the MathFlow Editor will insert a style change template as needed, and set the properties once for the entire selection. In this case, the properties also apply to non-character data such as fraction lines. However, since the properties are associated with the expression and not the individual characters within it, they are not sticky, and if you cut data out of the expression and paste it elsewhere, the properties will no longer apply. Conversely, the properties you set for the expression will also apply to any new data you add to it.

The Operator Properties dialog has ten somewhat obscure options dealing with operators. "Operator" is used in a very general sense in MathML, and includes things like stretchy arrows and braces.

As with all property dialogs, the Operator Properties dialog is opened from the Properties menu. It is also the default property dialog for operator tokens, and can thus be opened by double-clicking the corresponding MathML elements in the MathML Ancestry panel.

MathFlow Operator Properties dialog

Attributes

You can set the following properties (attribute values) from this dialog:

Form

This property lets you flag this operator as being an infix, prefix or postfix operator. Changing the form may adjust spacing around the operator slightly. For example, a prefix minus sign has slightly less spacing around it than an infix minus sign.

a prefix minus sign vs. an infix minus sign

Usually the proper form is set automatically by the Editor. The form property may also be used by some MathML software to aid in translation to other formats.

Space to left of operator and Space to right of operator

Setting this property can increase or decrease the default spacing around the operator. You can enter any MathML size value except percentages. If you specify no units, the default is "em", a unit of space used in printing roughly the width of a capital 'M'. Enter "automatic" to select MathFlow's default spacing.

Allow stretching, Stretch symmetrically, Min Size, and Max Size

These four options work together to control how operators stretch. Most characters cannot be sensibly stretched, but characters such as parentheses and arrows often "stretch" to match the height or width of some adjacent expression. By setting "allow stretching" to false, you can disable stretching of parentheses, and other characters stretchy in MathML by default.

For example, these outer parentheses are stretchy:

example of stretchy parentheses

Those in this example are not:

example of non-stretchy parentheses

If an enclosing character (arrow, brace, etc.) is stretchy, then you also have a choice as to whether you want the stretching to be symmetric around the math axis of the equation (the middle of the = sign). Enclosing characters normally stretch symmetrically. However, in situations where a non-symmetric expression is being bracketed by stretchy characters, non-symmetric stretching may look more appealing.

Non-symmetric around math axis: ""

Symmetric around math axis: ""

In some situations, you may wish to specify a minimum or maximum amount a stretchy character can grow or shrink, using the min size and max size options. These properties take MathML size values.

Enlarge in display style and Move limits to script positions in inline style

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. In MathML, characters can be marked as having a large display form to cause them to set their size depending on how they are used. You can turn off this automatic behavior by setting the property to "false."

""
The "sum" operator is shown here in display style on the left, and inline style on the right.

Similarly, 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."

Treat as an accent for positioning

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."

""
The left tilde is treated as an accent whereas the tilde on the right is not.

As with all property dialogs, the Layout Properties dialog is opened from the Properties menu. It is also the default property dialog for non-token templates, and can thus be opened by double-clicking the corresponding MathML elements in the MathML Ancestry panel.

Layout Properties dialog

The following layout properties deal with all the non-character related options in MathML, except those specifically for tables:

Layout in Display Style

In traditional math typesetting, equations that appear interspersed with text in a paragraph are laid out differently than equations that appear by themselves, centered and set off from the surrounding text. The two styles are called inline style and display style respectively. The main difference is that in inline style, vertical space is at a premium since it is undesirable to have to change the spacing between adjacent lines of text. The following example illustrates some of the differences:

Example of display style Example of inline style
Display style Inline style

Script Level

MathFlow, like MathType and TeX, generally tries to use just three font sizes per equation — the base font size, a superscript size, and a size for scripts of scripts. The default size in any subexpression depends mostly on algorithms that happen automatically, such as switching to the script font for a superscript. However, by setting the Script Level property directly, you can force a particular script level. Thus, for example, by setting the script level to 0, you can prevent a superscript from shrinking.

Foreground Color and Background Color

These properties are mostly self-explanatory. The only subtlety is how they differ from the foreground and background color properties on the Font Properties dialog. The point here is that some templates, such as matrices and fractions, don't contain any characters directly -- they only contain other templates. Thus they have areas of background that are not behind any characters at all. In order to set the background uniformly in such a template, you need to use the Layout Properties version of background color, rather than changing the background for all the characters nested inside it. Similarly, you must use the foreground property in the Layout Properties dialog to change the color of things like the fraction bar, which don't come from an alphanumeric font character.

These properties accept any legal MathML color value. Behind the scene, the MathFlow Editor inserts style change templates as necessary, so these properties are always non-sticky in the sense described above in the discussion of font properties.

Treat Underscript/Overscript as Accent

As explained above in the discussion of the "Treat As Accent" operator property, accent characters are typeset differently than non-accent characters when displayed as underscripts and overscripts. By setting this property on the script template directly, you can specify that an underscript or overscript be treated as an accent, even when it isn't an operator symbol.

Fraction Line Thickness

This property only applies to fraction templates (<mfrac>), and controls the thickness of the horizontal line between the numerator and denominator. The default setting is "1." Enter a number greater than one to increase the thickness of the line. You can also use the keywords 'thick', 'medium' and 'thin'.

Beveled

This property only applies to fraction templates (<mfrac>), and controls the linear orientation of the fraction. The default setting is "Automatic." Value may be set to "True" or "False."

Numerator Alignment and Denominator Alignment

This property only applies to fraction templates (<mfrac>), and controls the alignment of the numerator or denominator with respect to the vertical axis. The default setting is "Center." Value may also be set to "Left" or "Right."

There are three property dialogs for controlling table properties, one for an entire table, one for a table row and one for a table cell. There is only a single entry on the Properties Menu for Table Properties. Which dialog opens depends on the current selection. Each of these property dialogs is the default for the table, row and cell templates respectively. Thus, they can also be opened by double-clicking the corresponding MathML elements in the MathML Ancestry panel.

In MathFlow editor, you generally don't deal directly with table rows and cells. However, rows and cells are nonetheless present in the underlying MathML. Most properties only apply to a table as a whole and won't be active if only a row is selected. Row alignment and column alignment, however, may be set for the whole table, a row, or for just a single cell. Consequently, the properties panels for table rows and cells consist of just these two properties. Since the meaning of the property values is the same in all three dialogs, we discuss them all together with the rest of the table properties.

Table properties are divided into three tab-separated sections: Spacing, Alignment, and Lines.

Spacing

table properties dialog, spacing tab

The Spacing tab allows you to modify these table properties:

Row Spacing and Column Spacing

Setting the row and column spacing determines how much spacing is inserted between the individual rows and columns of a table. Column and row spacing can have multiple values in the same manner as row and column lines. In other words, you can specify the spacing for all rows or columns using one value or specify space-separated values for each row or column in the table. If there are fewer values than rows or columns, the last value for the remaining rows and columns is used. These properties accept MathML size values and can only be set for the entire table.

For further documentation, see the MathML spec. For row spacing and column spacing, entries in the "values" column have a plus next to them, which means you can enter values for each column or row separated by a space. For example, if you have four columns, you could enter one value for Column Spacing in the dialog and that value would be applied to all the columns; or you could put in four different values, separated by a space, which would be applied to the columns in order.

Frame Spacing

You can control the spacing between the box frame and the table. The Frame Spacing property expects a list of two MathML size values separated by a space. The first value is the space between the table and the sides of the frame, while the second specifies the space between the top and bottom of the table and the frame.

Table Width

This property specifies the desired width of the entire table. When the value is set to "automatic," the width of the table will be calculated automatically, based on the layout of the table's contents. However, a user may also specify a numerical value for the table width, as well as a desired unit of measurement.

Minimum Label Spacing

This MathML property deals with the placement of equation numbers. MathML 2.0 introduced the concept of a "labeled table row". You can enter the mlabeledtr element by going into source view. This property will set the minimum appropriate attributes in the underlying MathML source, and change the rendering accordingly.

Alignment

alignment options on the Table Properties dialog

The Alignment tab allows you to modify these table properties:

Alignment

This property determines the alignment of the entire table with respect to the surrounding equation. Use the drop-down menu to choose from the following 5 values:

  • axis — align the center of the table with the math axis of the surrounding equation, i.e. the line through a minus sign
  • top — align the top of the table with the baseline of the surrounding equation
  • center — align the center of the table with the baseline of the surrounding equation
  • bottom — align the bottom of the table with the baseline of the surrounding equation
  • baseline — same as center

Row Number

This property acts in conjunction with the Alignment property. You may select a particular row to align with respect to the surrounding equation.

Row Alignment and Column Alignment

These properties specify the vertical alignment of rows and the horizontal alignment of columns. They can be set for an entire table, a single row or column, or a single cell.

The syntax for the alignment values varies slightly in each of these situations. For a single cell, the accepted values for Column Alignment are "left", "center" and "right", and the accepted values for Row Alignment are "axis," "top," "center," "bottom," and "baseline."

However, when these properties are applied to more than one row or column, the value can be set to a list of values, which apply to the affected rows or columns in order. If there are fewer values in the list than the number of rows or columns, the last value is repeated for all remaining rows or columns.

""
This table's Column Alignment property is set to "left right".

Label Side

This MathML property again deals with the placement of equation numbers, in that it sets the label orientation attribute in the underlying MathML source, and changes the rendering accordingly. You can enter the mlabeledtr element by going into source view.

Lines

lines options in the Table Properties dialog

The Lines tab allows you to modify these table properties:

Row Lines and Column Lines

These properties determine what separator lines should be drawn and in what styles. Accepted values are "none," "solid," or "dashed." The value can be set to a list of values, which apply to the rows or columns in order. If there are fewer values in the list than the number of rows or columns, the last value is repeated for all remaining rows or columns.

Note that you may universally (in any of the three tabs) change the Equal Rows and Equal Columns properties.

Frame

This property determines whether a box should be drawn around the entire table. You can choose between solid and dashed line styles.

Equal Rows and Equal Columns

By enabling these properties, you can make all rows and/or all columns the same size. Ordinarily, rows and columns grow or shrink depending on the size of the cells in them. Forcing rows or columns to be equal in size can be useful for some kinds of tabular alignment.

When an mspace element is selected, the MSpace Properties option on the Properties menu becomes active. Double-clicking an <mspace> element in the MathML Ancestry also opens this dialog.

Insert MSpace dialog

The fields in this dialog correspond to attributes of the mspace element:

  • width is the width of the space
  • height is the ascent (distance above the baseline) of the space
  • depth is the descent (distance below the baseline) of the space

Each field accepts one MathML size value. Note that the default value is 0 for all three attributes, so even though a percentage is an admissible value, it will have no effect.

When an Action template is selected, the Action Properties option becomes active on the Properties menu. The Action Properties dialog is also the default for action templates, so you can open it by double-clicking an <maction> element in the MathML Ancestry. The Action Properties dialogs are also opened automatically when you insert an action template from the Insert menu.

The Common Attributes dialog allows you to set the listed attributes for selected elements (MathML tags). As with all properties dialogs, the Common Attributes dialog is opened from the Properties menu. When a MathML tag that you want to apply these attributes to is highlighted, such as mrow, mn, mo, etc., the Common Attributes option on the Properties menu becomes active and the dialog can be opened. Any attribute set in this dialog will apply to whatever is selected in the editor.

Common Attributes dialog

MathFlow uses the class attribute to set user-defined font styles on an element, but the rest of these attributes are not directly used (and therefore ignored) by MathFlow. However, since these attributes are shared by all MathML elements, each one can be set to facilitate the use of style sheet mechanisms such as XSLT and CSS2.

All MathML elements accept class, style, and id attributes in addition to the attributes described specifically for each element. MathML specifies these attribute values as general strings, even if style sheet mechanisms have more restrictive syntaxes for them. That is, any value used for them is valid in MathML.

The Linebreak Attributes dialog allows you to control MathML 3 linebreaking and indentation attributes. If there's a linebreak already in the equation, open the linebreak dialog by looking in the MathML Ancestry for the element containing the linebreak (usually an mspace). Once you find it, double-click it to open the dialog.

The Linebreak Attributes dialog

The linebreaks themselves will be attributes associated with either an mspace or mo element, so look for the attributes there. There's an example below if you'd like to see how some of these attributes are used. The attributes you see in the screen shot above are those contained in the example below.

Linebreak attributes

AttributeValuesDefault
linebreak "auto" | "newline" | "nobreak" | "goodbreak" | "badbreak" auto
Specifies the desirability of a linebreak occurring at this operator: the default "auto" indicates the renderer should use its default linebreaking algorithm to determine whether to break; "newline" is used to force a linebreak; For automatic linebreaking, "nobreak" forbids a break; "goodbreak" suggests a good position; "badbreak" suggests a poor position.
lineleading length inherited (100%)
Specifies the amount of vertical space to use after a linebreak. For tall lines, it is often clearer to use more leading at linebreaks. Rendering agents are free to choose an appropriate default.
linebreakstyle "before" | "after" | "duplicate" | "infixlinebreakstyle" set by dictionary (before)
Specifies whether a linebreak occurs 'before' or 'after' the operator when a linebreaks occur on this operator; or whether the operator is duplicated. "before" causes the operator to appear at the beginning of the new line (but possibly indented); "after" causes it to appear at the end of the line before the break. "duplicate" places the operator at both positions. "infixlinebreakstyle" uses the value that has been specified for infix operators. This value ("before", "after", or "duplicate") can be specified by the application or bound by mstyle ("before" corresponds to the most common style of linebreaking).
linebreakmultchar string inherited (&InvisibleTimes;)
Specifies the character used to make an &InvisibleTimes; operator visible at a linebreak. For example, linebreakmultchar="&#xB7;" would make the multiplication visible as a center dot.

Indentation attributes

AttributeValuesDefault
indentalign "left" | "center" | "right" | "auto" | "id" inherited (auto)
Specifies the positioning of lines when linebreaking takes place within an mrow.
indentshift length inherited (0)
Specifies an additional indentation offset relative to the position determined by indentalign.
indenttarget idref inherited (none)
Specifies the id of another element whose horizontal position determines the position of indented lines when indentalign="id". Note that the identified element may be outside of the current math element, allowing for inter-expression alignment, or may be within invisible content such as mphantom; it must appear before being referenced, however. This may lead to an id being unavailable to a given renderer; in such cases, the indentalign should revert to "auto".
indentalignfirst "left" | "center" | "right" | "auto" | "id" | "indentalign" inherited (indentalign)
Specifies the indentation style to use for the first line of a formula; the value "indentalign" (the default) means to indent the same way as used for the general line.
indentshiftfirst length | "indentshift" inherited (indentshift)
Specifies the offset to use for the first line of a formula; the value "indentshift" (the default) means to use the same offset as used for the general line.
indentalignlast "left" | "center" | "right" | "auto" | "id" | "indentalign" inherited (indentalign)
Specifies the indentation style to use for the last line when a linebreak occurs within a given mrow; the value "indentalign" (the default) means to indent the same way as used for the general line. When there are exactly two lines, the value of this attribute should be used for the second line in preference to indentalign.
indentshiftlast length | "indentshift" inherited (indentshift)
Specifies the offset to use for the last line when a linebreak occurs within a given mrow; the value "indentshift" (the default) means to indent the same way as used for the general line. When there are exactly two lines, the value of this attribute should be used for the second line in preference to indentshift.

Example

Here's a simple example you can copy and paste into the Style Editor to see some of these attributes in use:

<math>
   <mi>y</mi>
   <mo id='equals'>=</mo>
   <mi>x</mi>
   <mo>&sdot;</mo>
   <mi>x</mi>
   <mspace indenttarget='equals'
           indentalign='id'
           linebreak='newline'/>
   <mo>=</mo>
   <msup>
      <mi>x</mi>
      <mn>2</mn>
   </msup>
</math>

See also:

There are about a dozen MathML properties whose values can be expressed in a wide variety of formats. In the property dialogs, these values are set by text fields where you can type any valid value. In many cases, the values are either sizes or colors. The format for these two kinds of values are explained below.

Size values

A number of MathML properties involve sizes, such as "font size". In the Editor, sizes can be specified in two formats:

FormatExample
number with unit 1 cm, .8 em
percentage 120% (of normal size)

Valid MathML units

Unit identifierUnit description
em em (font-relative unit traditionally used for horizontal lengths -- width of an 'M')
ex ex (font-relative unit traditionally used for vertical lengths -- height of an 'x')
px pixels, or pixel size of the current display
in inches (1 inch = 2.54 centimeters)
cm centimeters
mm millimeters
pt points (1 point = 1/72 inch)
pc picas (1 pica = 12 points)

Color values

MathML color properties accept normal CSS color values. The following table summarizes the valid formats for specifying color values:

FormatExample
3-digit hexadecimal RGB values #00f (blue), #000 (black)
6-digit hexadecimal RRGGBB values #00ff00 (green), #999999 (medium gray)
color keyword 'aqua', 'black', 'blue', 'fuchsia', 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'purple', 'red', 'silver', 'teal', 'white', or 'yellow'