(Excerpt from "The MathML Handbook" by Pavi Sandhu)
The mo element is used for representing operators as well as other symbols that should render as operators. This includes fence characters (such as braces, parentheses, or absolute value bars), separators (such as commas or semicolons), and accents (such as a bar or tilde over a character). Here are some examples:
<mo>+</mo> <mo><</mo> <mo>=</mo> <mo>∫</mo> <mo>and</mo> <mo>(</mo> <mo>}</mo>
As discussed under Presentation markup, some operators that are invisible in traditional notation should be specified using explicit named entity references in an mo element. These include ⁢, ⁣, and ⁡. The advantage of using these entity references is that they provide semantic information about the markup. This information can then be used by rendering applications to achieve better results in visual and audio rendering or by computer algebra systems to evaluate an equation. Some examples of expressions involving invisible operators follow.
The following markup could be spoken as "x times y" instead of just "x y":
The following markup could be spoken as "A sub one, two" instead of "A sub twelve":
The following markup could be spoken as "f of x" instead of "f times x":
<mrow> <mi>f</mi> <mo>⁡</mo> <mrow> <mo>(</mo> <mi>x</mi> <mo>)</mo> </mrow> </mrow>
The attributes of the mo element determine the precise details of how individual operators and symbols are rendered. The mo element has the unique property that the default values of its attributes are determined based on its content, using an operator dictionary (described in the "Operator dictionary" section later on this page).
The following table summarizes the various attributes of the mo element and their default values. Each default value is shown with an asterisk (*) to indicate that it is a generic default, which is used only if no match is found for that attribute in the operator dictionary.
Table: Attributes of the mo element.
|fence||true | false||false*|
|separator||true | false||false*|
|accent||true | false||false*|
|form||prefix | infix | postfix||Determined by position in mrow.|
|lspace||number h-unit | namedspace||thickmathspace*|
|rspace||number h-unit | namedspace||thickmathspace*|
|stretchy||true | false||false*|
|symmetric||true | false||true*|
|maxsize||number [v-unit | h-unit] |||infinity|
|minsize||number | namedspace||1*|
|largeop||true | false||false*|
|movablelimits||true | false||false*|
The meaning of these attributes is given here:
- fence, separator, and accent: specify if the content of the mo element should be interpreted as a fence, separator, or accent, respectively. If any of these attributes is set to true, the rendering conventions relevant to that type of object are applied to the operator.
- form: specifies the position in which an operator occurs.
- lspace and rspace: determine the amount of space that should be inserted to the left or right of an operator, respectively.
- stretchy: specifies if an operator should expand or shrink to accommodate the elements it encloses.
- symmetric: specifies if a stretchy operator should stretch in such a way that its height above and depth below the baseline is always the same.
- maxsize: specifies the maximum size to which a stretchy operator can grow.
- minsize: specifies the minimum size to which a stretchy operator can shrink.
The MathML specification defines detailed rules for how stretchy operators should grow in size both vertically and horizontally, based on the context in which the mo element occurs. Here is an example of an operator that stretches vertically:
<mrow> <mo>(</mo> <mfrac> <mi>x</mi> <mi>y</mi> </mfrac> <mo>)</mo> </mrow>
Compare this example to the case where the parentheses are prevented from stretching if you set the attribute maxsize to 1 (this forces the operators to stay at their default size):
<mrow> <mo maxsize="1">(</mo> <mfrac> <mi>a</mi> <mi>b</mi> </mfrac> <mo maxsize="1">)</mo> </mrow>
Here is an example of an operator that stretches horizontally:
The following two attributes affect the rendering of an operator based on the value of the displaystyle attribute of the mstyle element:
- largeop: specifies if an operator should be drawn larger than normal when displaystyle="true" is in its environment.
- movablelimits: specifies if the limits of an operator should be moved to the subscript and superscript positions when displaystyle="false" is in its environment.
Each presentation element inherits a default value of displaystyle from its environment. This attribute specifies if a given expression should be rendered in inline mode or display mode. Inline expressions are typically rendered in a smaller size and with underscripts and overscripts drawn in the subscript and superscript position. Display expressions are typically rendered in a larger size and with any underscripts and overscripts shown in their normal position.
The largeop and movablelimits attributes are used in MathML to control the two key properties that distinguish the inline and display mode of an operator, namely its size and the position of its limits.
Some typical examples of operators for which largeop and movablelimits are both true by default are the integral, summation, and product symbols. Here is an example of an expression for which displaystyle="true":
<mstyle displaystyle="true"> <munderover> <mo>∑</mo> <mi>a</mi> <mi>b</mi> </munderover> <mrow> <mi>f</mi> <mi>⁡</mi> <mrow> <mi>(</mi> <mo>x</mo> <mo>)</mo> </mrow> </mrow> </mstyle>
Here is how the same expression might look if rendered with displaystyle="false":
Notice that the summation symbol is shown in a smaller size and the underscripts and overscript have moved to the subscript and overscript position. These changes are a consequence of the fact that the largeop and movablelimits are both true by default for the mo element that contains the ∑ operator.
Most mathematical operators and symbols have special rendering properties that must be handled on a case-by-case basis. For example, prefix operators are typically rendered with extra space on the left, postfix operators have extra space on the right, and infix operators have extra space on both sides. The mechanism used in presentation markup to respect such rendering conventions is to determine the default attribute values for each operator from an operator dictionary.
The operator dictionary is a table that lists attribute values for a large collection of common operators and symbols. When displaying an <mo> element containing a particular operator, the renderer first checks to see if that operator is listed in the operator dictionary. If so, the default attribute values for that <mo> element are taken from the entry for that operator in the dictionary. If the operator is not listed in the dictionary (or if it is listed but all of its attributes are not assigned explicit values), then the values of all unmatched attributes are determined from their generic defaults.
For example, the entry in the operator dictionary for the "=" operator is shown below:
"=" form="infix" lspace="thickmathspace" rspace="thickmathspace"
This entry specifies default values for the form, lspace, and rspace attributes in an mo element that contains the "=" operator as its content. All other attributes of this <mo> element take their generic default values, since these attributes are not specified explicitly in the operator dictionary entry. In other words, the following markup:
is automatically interpreted as the following:
<mo form="infix" lspace="thickmathspace" rspace="thickmathspace">=</mo>
This operator dictionary entry applies the typesetting convention that the "=" operator is typically used in the infix position and that it should be rendered with extra space on either side.
Here is the operator dictionary entry for the "(" operator:
"(" form="prefix" fence="true" stretchy="true" lspace="0em" rspace="0em"
This entry reflects the fact that the "(" character is typically used in an expression as a fence, it is normally stretched to accommodate its contents, and it does not have extra space around it.
The operator dictionary thus provides a way to automatically apply the typesetting conventions associated with each type of operator that might occur inside an <mo> element. Of course, you can always override the default behavior and change the rendering properties of any operator by explicitly specifying one or more attributes.
|<< back||next >>|
Copyright © CHARLES RIVER MEDIA, INC., Massachusetts (USA) 2003
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "The MathML Handbook" is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.
CHARLES RIVER MEDIA, INC., 20 Downer Avenue, Suite 3, Hingham, Massachusetts 02043, United States of America