Chapter 4: Presentation Markup

 < Day Day Up > 



This chapter provides detailed information on the syntax of MathML presentation markup. It includes descriptions and examples of the major types of presentation elements, such as token elements, general layout elements, and elements for representing scripts, indices, tables, and matrices.

4.1 Introduction

Some simple examples of presentation markup were discussed in Section 3.2. We saw there that presentation markup consists of approximately 30 elements and 50 attributes that describe the visual structure of mathematical notation. Most presentation elements can be divided into two categories: token elements and layout schemata. Token elements represent the smallest building blocks of mathematical notation; that is, numbers, operators, and identifiers used to denote names of variables and functions. There are also separate token elements for representing text, blank space, strings, and character glyphs. Table 4.1 summarizes the different types of token elements.

Table 4.1: Types of Token Elements

Element

Role

mn

Number

mo

Operator, fence, separator, or accent

mi

Identifier

mtext

Text

mspace

Blank space

ms

String

mglyph

Character glyph

Numbers, operators, and identifiers are each represented by a different token element (mn, mo, and mi, respectively) because each of these types of items has slightly different notational conventions. For example, numbers are usually rendered in an upright font, whereas variables are usually rendered in an italic font. Further, the space left around operators is different from that left around numbers or variables.

Token elements are the only presentation elements that can directly contain character data. They can contain any sequence of zero or more Unicode characters as well as entity references. Token elements can include whitespace, but any whitespace in the content is trimmed from the ends, as explained in Section 3.2. In general, token elements cannot contain other elements. However, there are two exceptions. The mglyph element, used for representing nonstandard characters, and the malignmark element, used for aligning parts of an expression, can appear inside token elements.

Layout schemata specify templates for constructing expressions out of smaller parts. Table 4.2 summarizes the different types of layout schemata.

Table 4.2: Types of Layout Schemata

Element

Role

mrow

Horizontal row

mfrac

Fraction

msqrt

Square root

mroot

Root

mstyle

Apply style

mspace

Blank space

mphantom

Make content invisible

mfenced

Add fences around content

menclose

Enclose content in a stretchy symbol

merror

Error messages

msub

Add subscript to a base

msup

Add superscript to a base

msubsup

Add subscript-superscript pair to a base

munder

Add underscript to a base

mover

Add overscript to a base

munderover

Add underscript-overscript pair to a base

mmultiscripts

Add multiple prescripts and postscripts to a base

mtable

Table or matrix

mtr

Row of a table

mlabeledtr

Labeled row of a table

mtd

Cell in a table

maligngroup

Alignment group

malignmark

Alignment marker

Layout schemata can contain only other elements as content; they cannot contain character data except for whitespace, which they ignore. The rules for rendering layout schemata are more complex than those for token elements since layout schemata specify how to construct a two-dimensional notational structure out of smaller subexpressions. MathML suggests rules for rendering each type of layout schemata but these rules are only suggestions, not requirements. In general, each processing application can choose its own rendering rules for different MathML elements as long as the rules are consistent with the basic conventions of mathematical typesetting.

In addition to token elements and layout schemata, there are a few other elements that do not belong to either category. These include the elements none and prescripts (which are empty elements used inside other layout schemata) and the maction element (which is used to add interactivity to MathML equations).

Note 

Note that in this and all subsequent chapters of the book, the math element is omitted from all examples for the sake of brevity. However, this element is implied by the context; that is, each instance of MathML markup should be thought of as being enclosed in an outer math element.

Number of Arguments

MathML specifies constraints on the number of child elements that certain layout schemata are allowed to contain. Child elements subject to such constraints are called arguments. Some arguments may also have a special meaning based on their position within the parent element. For example, an msub element must have exactly two arguments, the first of which is interpreted as the base and the second as the subscript attached to that base.

The MathML DTD does not specify either the number of arguments a given element has or their interpretation. The restrictions placed on arguments is an example of the additional rules specified by MathML that go beyond the basic syntax of XML.

Table 4.3 lists the number of arguments for each presentation element as well as any special meaning attached to the argument based on its position.

Table 4.3: Arguments for Each Presentation Element

Element

Number of Arguments

Argument Role

mrow

0 or more

 

mfrac

2

numerator denominator

msqrt

1*

 

mroot

2

base root

mstyle

1*

 

merror

1*

 

mpadded

1*

 

mphantom

1*

 

mfenced

0 or more

 

menclose

*

 

msub

2

base subscript

msup

2

base superscript

msubsup

3

base subscript superscript

munder

2

base underscript

mover

2

base overscript

munderover

3

base underscript overscript

mmultiscripts

1 or more

base (underscript overscript)*

  

[<mprescripts/>(underscript overscript)*]

mtable

0 or more

0 or more mtr or <mlabeledtr> elements

mtr

0 or more

0 or more mtd elements

mlabeledtr

2

A label and 0 or more mtd elements

mtd

1*

 

maction

1 or more

Depends on the actiontype attribute

The elements in Table 4.3 whose required number of arguments is listed as 1* have a special property. They are always interpreted as having a single argument even if they are written with a different number of arguments. In other words, if any of these elements occurs with either zero arguments or more than one argument, the contents of the element are interpreted as being enclosed in an mrow element. Such an mrow element is called an inferred mrow since its presence is inferred from the context. The elements that place an inferred mrow around their arguments are: msqrt, mstyle, merror, mpadded, mphantom, menclose, and mtd.

The advantage of this behavior is that you can omit a large number of mrow elements that would otherwise be necessary. This allows MathML expressions to be written more compactly. For example, the msqrt element below has 2 arguments:

    <msqrt>     <mo>-</mo>     <mn>1</mn>    </msqrt> 

Hence, the above expression is automatically interpreted as:

    <msqrt>     <mrow>       <mo>-</mo>       <mn>1</mn>     </mrow>    </msqrt> 



 < Day Day Up > 



The MathML Handbook
The MathML Handbook (Charles River Media Internet & Web Design)
ISBN: 1584502495
EAN: 2147483647
Year: 2003
Pages: 127
Authors: Pavi Sandhu

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net