W3C

A MathML for CSS profile

W3C Working Draft 27 April 2007

This version:
http://www.w3.org/TR/2007/WD-mathml-for-css-20070427/
Latest version:
http://www.w3.org/TR/mathml-for-css/
Editors:
Bert Bos, W3C
David Carlisle, NAG
George Chavchanidze, Opera Software
Patrick D. F. Ion, Mathematical Reviews, American Mathematical Society
Bruce R. Miller, National Institute of Standards and Technology

Abstract

This document describes a profile of MathML 3.0 designed for ease of formatting with Cascading Style Sheets.

Status of this Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

This document is a W3C First Public Working Draft produced by the W3C Math Working Group as part of W3C Math Activity. The goals of the W3C Math Working Group are discussed in the W3C Math WG Charter. The authors of this document are the W3C Math Working Group members.

Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.

This First Public Working Draft specifies a profile of a specification, MathML 3.0 [mathml], which is itself under development, and is intended to accord with CSS 3 [css], which is also under active development. The Math WG hopes this outline draft will permit informed feedback on this part of its work, although only a few of the elements show a full discussion of their special properties in connection with CSS. There is also a short description of some considerations underlying this work in the W3C Math WG's public Roadmap [roadmap]. Feedback should be sent to the Public W3C Math mailing list (list archives).

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

Table of Contents

1 Introduction
    1.1 Differences in formatting models
2 Math Elements
    2.1 Root element
    2.2 Token elements and layout schemata
    2.3 Required Arguments
    2.4 Common attributes
3 Token Elements
    3.1 Identifier (mi)
    3.2 Number (mn)
    3.3 Operator (mo)
    3.4 Text (mtext)
    3.5 Space (mspace)
    3.6 String Literal (ms)
4 General Layout Schemata
    4.1 Horizontally Group Sub-Expressions (mrow)
    4.2 Fractions (mfrac)
    4.3 Radicals (msqrt, mroot)
    4.4 Error Message (merror)
    4.5 Making Sub-Expressions Invisible (mphantom)
    4.6 Expression Inside Pair of Fences (mfenced)
    4.7 Enclose Expression Inside Notation (menclose)
5 Script and Limit Schemata
    5.1 Subscript (msub)
    5.2 Superscript (msup)
    5.3 Subscript-superscript Pair (msubsup)
    5.4 Underscript (munder)
    5.5 Overscript (mover)
    5.6 Underscript-overscript Pair (munderover)
    5.7 Prescripts (mmultiscripts)
6 Tables and Matrices
    6.1 Table or Matrix (mtable)
    6.2 Row in a Table or Matrix (mtr)
    6.3 Entry in a Table or Matrix (mtd)
    6.4 Bind Action to a Sub-Expression (maction)
    6.5 Add semantic mapping (semantics)
7 Extensibility and Conformance
    7.1 Extensibility
    7.2 Conformance
8 Differences between MathML presentational markup and this CSS-oriented profile
9 Document Type Definition
10 References


1 Introduction

This document presents a subset of MathML 3.0 [mathml3] which can be used to capture the structure of mathematical formulas in a way particularly suitable for further CSS formatting. This subset, called here a MathML profile, is expected to facilitate adoption of MathML in web browsers and CSS formatters, since it emphasizes the widely adopted CSS [css] visual formatting model enhanced with only a few mathematically oriented extensions. These are present to allow formatting some complex inline expressions requiring special layout schemata given in presentational MathML. The development of this CSS-oriented profile is coordinated with ongoing work on CSS3 and may require a limited set of new properties to be added to existing modules. The full MathML specification defines a more extensive markup language for mathematical formalism than can readily be rendered using the present CSS visual formatting model and its realizations.

It may be useful to note, in connection with the need for this profile, that the CSS2 specification [css2] was developed and refined at about the same time as the first MathML specification [mathml1]. Now new versions of both MathML and CSS are being created. This profile is thus part of the ongoing effort to realize the synergy that W3C Recommendations offer to the Web.

1.1 Differences in formatting models

The Math Working Group identified the following issues, which are considered to be the main obstacles delaying fully consistent MathML/CSS integration.

  • Insufficient control over vertical alignment of complex inline expressions such as inline tables with multiple rows.

  • Lack of a mechanism to control stretching of glyphs, or any equivalent functionality, that could be used for sizing of mathematical delimiters and stretchy operators.

  • Limited scope in the use of selectors and generation of content, which makes it difficult to apply complex formatting to basic structural markup.

  • The order of children in presentational elements such as mover, munderover, mmultiscripts and mroot does not match their in-flow positions; this makes formatting of such elements more difficult.

  • Handling of operators, delimiters and accents governed by an operator dictionary (that is by element content rather than attribute values) rather than by explicit markup makes matching of such operators using CSS selectors impossible.

  • There are conflicts between some usage of presentational elements such as mpadded, mspace, mstyle and some attributes, and parts of CSS functionality.

2 Math Elements

2.1 Root element

MathML specifies a single top-level or root math element, which encapsulates each instance of MathML markup within a document. All other MathML markup must be contained in a math element, which must always be the outermost element of a MathML expression and can contain an arbitrary number of children. The math element carries the display attribute that specifies whether the enclosed MathML expression should be rendered in a display style or an in-line style. Allowed values are "block" and "inline" (default). It also accepts altimg and alttext attributes that provide fall-back for User Applications (UAs) that do not support MathML layout schemata. The values of altimg and alttext attributes are URI and CDATA respectively. All MathML elements should be in the MathML namespace http://www.w3.org/1998/Math/MathML [rec-xmlns]. This can be ensured by adding a default namespace declaration to math elements, or by using namespace prefixes bound to the MathML namespace.

2.2 Token elements and layout schemata

MathML elements included in the current profile can be divided into two classes. Token elements represent individual symbols, names, numbers, labels, etc. In general, tokens can have only character data as content. Layout schemata build expressions out of parts, and can only have elements as content except for whitespace, which they ignore. There are also a few empty elements used only in conjunction with specific layout schemata.

All individual "symbols" in a mathematical expression should be represented by MathML token elements. The primary MathML token element types are identifiers (e.g. variables or function names), numbers, and operators (including fences, such as parentheses, and separators, such as commas). There are also token elements for representing text or whitespace that has more aesthetic than mathematical significance, and for representing "string literals" for compatibility with computer algebra systems. Note that although a token element represents a single meaningful "symbol" (name, number, label, mathematical symbol, etc.), such symbols may be comprised of more than one character. For example sin and 24 are represented by the single tokens <mi>sin</mi> and <mn>24</mn> respectively.

Token elements included in the current profile are summarized in the table below.

miidentifier
mnnumber
mooperator, fence, or separator
mtexttext
mspacespace
msstring literal

In traditional mathematical notation, expressions are recursively constructed out of smaller expressions, and ultimately out of single symbols, with the parts grouped and positioned using one of a small set of notational structures, which can be thought of as "expression constructors". In MathML, expressions are constructed in the same way, with the layout schemata playing the role of the expression constructors. The layout schemata specify the way in which sub-expressions are built into larger expressions. The terminology derives from the fact that each layout schema corresponds to a different way of "laying out" its sub-expressions to form a larger expression in traditional mathematical typesetting.

Basic expression constructions included in the current profile are listed in the table below.

mrowgroups any number of sub-expressions horizontally
mfracforms a fraction from two sub-expressions
msqrtforms a square root (radical without an index)
mrootforms a radical with specified index
merrorencloses a syntax error message from a preprocessor
mphantommakes content invisible but preserve its size
mfencedsurrounds content with a pair of fences
mencloseencloses content with a stretching symbol
msubattaches a subscript to a base
msupattaches a superscript to a base
msubsupattaches a subscript-superscript pair to a base
munderattaches an underscript to a base
moverattaches an overscript to a base
munderoverattaches an underscript-overscript pair to a base
mmultiscriptsattaches prescripts to a base
mtablemarks a table or matrix
mtrmarks a row in a table or matrix
mtdmarks a one entry in a table or matrix
mactionbinds actions to a sub-expression

2.3 Required Arguments

Many of the elements described herein require a specific number of arguments. In the detailed descriptions of element syntax given below, the number of required arguments is implicitly indicated by giving names for the arguments at various positions. Note that the current profile imposes extra restrictions on the number of arguments that mfenced, mmultiscripts and maction elements may have, beyond those in the full MathML 3.0 specification.

ElementRequired argument countArgument roles (when these differ by position)
mfrac2numerator denominator
mroot2base index
mfenced1base
msub2base subscript
msup2base superscript
msubsup3base subscript superscript
munder2base underscript
mover2base overscript
munderover3base underscript overscript
mmultiscripts4base mprescripts presubscript presuperscript
maction1 or 2depends on actiontype attribute

The elements mrow,msqrt, merror, mphantom, menclose, mtable, mtr, mtd and math accept any number of arguments.

2.4 Common attributes

The attributes xml:id, class and style can be used on any element included in the current profile: xml:id provides a mechanism for annotating elements with unique identifiers [rec-xmlid], class assigns one or more class names to an element and style specifies style information for the current element. The attribute mathvariant is allowed on token elements except for mspace; this attribute is included in the profile for interoperability reasons and may be used to pass information relevant to formatting to CSS unaware UAs.

The following table lists common attributes, their values and the elements on which they can be used.

Namevaluesdefaultvalid on
xml:idIDall elements
classNMTOKENSall elements
styleCDATAall elements
mathvariantnormal  | bold | italic | bold‑italic | sans-serif | bold‑sans‑serif | sans‑serif‑italic | sans‑serif‑bold‑italic | monospacenormalmn, mo, ms, mtext
mathvariantnormal  | bold | italic | bold‑italic | sans-serif | bold‑sans‑serif | sans‑serif‑italic | sans‑serif‑bold‑italic | monospaceitalicmi

3 Token Elements

Token elements in presentation markup are, broadly speaking, intended to represent the smallest units of mathematical notation which carry meaning. Tokens are roughly analogous to words in text. However, because of the precise, symbolic nature of mathematical notation, the various categories and properties of token elements figure prominently in MathML markup. By contrast, in textual data, individual words rarely need to be marked up or styled specially.

Frequently tokens consist of a single character denoting a mathematical symbol. Other cases, e.g., function names, involve multi-character tokens. Further, because traditional mathematical notation makes extensive use of symbols distinguished by their typographical properties, care must be taken to ensure that styling mechanisms respect typographical properties which carry meaning. Consequently, characters, tokens, and typographical properties of symbols are closely related to one another in MathML.

3.1 Identifier (mi)

3.1.1 Background

An mi element represents a mathematical identifier; its rendering consists of the text content displayed in a typeface corresponding to the mathvariant attribute. Since the typeface used can distinguish similar identifiers, it often serves an important semantic function.

For standard MathML, the default value of mathvariant depends on the content of the element: "italic" for single character content (e.g., <mi>x</mi>); "normal" otherwise (e.g., <mi>sin</mi>). Unfortunately there is no CSS selector (through CSS3) that can distinguish these two cases, and so we choose the more common case ("italic") as the default independently of the element content.

Mathematical identifiers for which a non-italic typeface is desired (e.g., multi-character identifiers), must explicitly specify the mathvariant attribute.

3.1.2 Conformance

UAs must support the mi element and the attribute mathvariant.

3.1.3 CSS Implementation

(This section is non-normative.)

The following rules show a possible implementation in CSS level 2:

mi[mathvariant="bold"], mi[mathvariant="bold-italic"], 
mi[mathvariant="bold-sans-serif"], mi[mathvariant="sans-serif-bold-italic"]
	{font-weight:bold;
	font-style:normal;}
mi[mathvariant="monospace"]
	{font-family:monospace;
	font-style:normal;}
mi[mathvariant="sans-serif"], mi[mathvariant="bold-sans-serif"], 
mi[mathvariant="bold-sans-serif"], mi[mathvariant="sans-serif-italic"], 
mi[mathvariant="sans-serif-bold-italic"]
	{font-family:sans-serif;
	font-style:normal;}
mi, mi[mathvariant="italic"], mi[mathvariant="bold-italic"],
mi[mathvariant="sans-serif-italic"], mi[mathvariant="sans-serif-bold-italic"]
	{font-style:italic;}
mi[mathvariant="normal"]
	{font-style:normal;}

3.2 Number (mn)

3.2.1 Background

An mn element represents a "numeric literal" or other data that should be rendered as a numeric literal. Generally speaking, a numeric literal is a sequence of digits, perhaps including a decimal point, representing an unsigned integer or real number.

A typical graphical renderer would render an mn element as the characters of its content, with no extra spacing around them (except spacing from neighboring elements such as mo).

3.2.2 Conformance

UAs must support the mn element and the attribute mathvariant.

3.2.3 CSS Implementation

(This section is non-normative.)

The following rules show a possible implementation in CSS level 2:

mn[mathvariant="bold"], mn[mathvariant="bold-italic"], 
mn[mathvariant="bold-sans-serif"], mn[mathvariant="sans-serif-bold-italic"]
	{font-weight:bold;
	font-style:normal;}
mn[mathvariant="monospace"]
	{font-family:monospace;
	font-style:normal;}
mn[mathvariant="bold-sans-serif"], mn[mathvariant="sans-serif"], 
mn[mathvariant="bold-sans-serif"], mn[mathvariant="sans-serif-italic"], 
mn[mathvariant="sans-serif-bold-italic"]
	{font-family:sans-serif;
	font-style:normal;}
mn[mathvariant="italic"], mn[mathvariant="bold-italic"],
mn[mathvariant="sans-serif-italic"], mn[mathvariant="sans-serif-bold-italic"]
	{font-style:italic;}
mn[mathvariant="normal"]
	{font-style:normal;}

3.3 Operator (mo)

3.3.1 Background

An mo element represents an operator or anything that should be rendered as an operator. In MathML the list of things that should "render as an operator" is widely inclusive. Besides ordinary operators with infix, prefix, or postfix forms, fence characters such as braces, parentheses, and separators such as comma and semicolon are included. In the current profile the mo element is not expected to produce vertically stretchable delimiters; instead the mfenced element should be used for vertically stretchy delimiters such as stretchy brackets, braces, parentheses and vertical bars.

Note also that this profile does not rely on an operator dictionary, but instead it is recommended to mark fences, separators and large operators explicitly using fence, separator and largeop attributes. In particular, prefix, infix and postfix operators may be distinguished using the form attribute. In the present profile, the default value of this attribute is "prefix" if the mo element is the first child of a parent element that has many children, and "postfix" if mo element is the last child of a parent with multiple children; the value is "infix" in all other cases. Those mo tokens that respresent fences such as brackets, braces, parens and vertical bars should be marked using the fence attribute, separators such as comma and semicolon should be marked using the separator attribute, while large operators such as sums, products and integrals may be labeled using the largeop attribute. UAs may rely on these attribute to infer default spacing around operators.

In the present profile stretchy operators are defined by the stretchar attribute's specifying a stretchy character to replaces the content of an mo element. The specified character is supposed to stretch to fill the available space (line height in case of vertically strecthy delimiters and the available width in case of horizontally strechy delimiters). UAs that do not recognize a character specified by an stretchar attribute as stretchy should ignore the attribute and display the content of the mo element instead.

Namevaluesdefault
formprefix | infix | postfixdepends on position of mo element, see exact rules below
fencetrue | falsefalse
separatortrue | falsefalse
largeoptrue | falsefalse
stretcharcharacternone

3.3.2 Conformance

UAs must support the mo element and the attributes mathvariant, fence, separator, largeop, form and stretchar.

3.3.3 CSS Implementation

(This section is non-normative.)

The following rules show a possible implementation in CSS level 2:

mo, mo[form="infix"]
	{padding:0 0.5ex;}
mrow > mo:first-child, mtd > mo:first-child, 
math > mo:first-child, menclose > mo:first-child, 
msqrt > mo:first-child, mo[form="prefix"]
	{padding-right:0;}
mrow > mo:last-child, mtd > mo:last-child, 
math > mo:last-child, menclose > mo:last-child, 
msqrt > mo:last-child, mo[form="postfix"]
	{padding-left:0;}
mo[fence="true"], mo[separator="true"]
	{padding:0;}
mo[largeop="true"]
	{font-size:1.3em;
	vertical-align:-0.1ex;}
mo[mathvariant="bold"], mo[mathvariant="bold-italic"], 
mo[mathvariant="bold-sans-serif"], mo[mathvariant="sans-serif-bold-italic"]
	{font-weight:bold;
	font-style:normal;}
mo[mathvariant="monospace"]
	{font-family:monospace;
	font-style:normal;}
mo[mathvariant="sans-serif"], mo[mathvariant="bold-sans-serif"], 
mo[mathvariant="bold-sans-serif"], mo[mathvariant="sans-serif-italic"], 
mo[mathvariant="sans-serif-bold-italic"]
	{font-family:sans-serif;
	font-style:normal;}
mo[mathvariant="italic"], mo[mathvariant="bold-italic"],
mo[mathvariant="sans-serif-italic"], mo[mathvariant="sans-serif-bold-italic"]
	{font-style:italic;}
mo[mathvariant="normal"]
	{font-style:normal;}

3.4 Text (mtext)

3.4.1 Background

An mtext element is intended to denote commentary text.

3.4.2 Conformance

UAs must support the mtext element and the attribute mathvariant.

3.4.3 CSS Implementation

(This section is non-normative.)

The following rules show a possible implementation in CSS level 2:

mtext[mathvariant="bold"], mtext[mathvariant="bold-italic"], 
mtext[mathvariant="bold-sans-serif"], mtext[mathvariant="sans-serif-bold-italic"]
	{font-weight:bold;
	font-style:normal;}
mtext[mathvariant="monospace"]
	{font-family:monospace;
	font-style:normal;}
mtext[mathvariant="sans-serif"], mtext[mathvariant="bold-sans-serif"], 
mtext[mathvariant="bold-sans-serif"], mtext[mathvariant="sans-serif-italic"],
mtext[mathvariant="sans-serif-bold-italic"]
	{font-family:sans-serif;
	font-style:normal;}
mtext[mathvariant="italic"], mtext[mathvariant="bold-italic"],
mtext[mathvariant="sans-serif-italic"], mtext[mathvariant="sans-serif-bold-italic"]
	{font-style:italic;}
mtext[mathvariant="normal"]
	{font-style:normal;}

3.5 Space (mspace)

3.5.1 Background

An mspace empty element represents a blank space of any desired size, as set by its attributes. It can also be used to make linebreaking suggestions to a visual renderer.

Namevaluesdefault
widthverythinmathspace | thinmathspace | mediummathspace | thickmathspace | verythickmathspace0
linebreakauto | newline | goodbreakauto

The width attribute defines the width of the space produced by an mspace element. The default value is zero.

The linebreak attribute is used to give a linebreaking hint to a visual renderer. The default value is "auto", which indicates that a renderer should use whatever default linebreaking algorithm it would usually use.

In the case when both the width attribute and the linebreak attribute are set, the linebreak attribute is ignored.

3.5.2 Conformance

UAs must support the mspace element and the attributes linebreak and width .

3.5.3 CSS Implementation

(This section is non-normative.)

The following rules show a possible implementation in CSS level 2:

mspace[linebreak="goodbreak"]:before
	{content:"\200B";
	white-space:normal;}
mspace[linebreak="newline"]:before
	{content:"\000A";
	 white-space:pre;}
mspace[width][linebreak]:before
	{content:normal;}
mspace[width]
	{display:inline-block}
mspace[width="verythinmathspace"]
	{width:0.1em}
mspace[width="thinmathspace"]
	{width:0.2em}
mspace[width="mediummathspace"]
	{width:0.5em}
mspace[width="thickmathspace"]
	{width:1em}
mspace[width="verythickmathspace"]
	{width:3em}

3.6 String Literal (ms)

3.6.1 Background

The ms element is used to represent "string literals" in expressions meant to be interpreted by computer algebra systems or other systems containing "programming languages". By default, string literals are displayed surrounded by double quotes.

In visual renderers, the content of an ms element is typically rendered with no extra spacing added around the string, and quote characters at the beginning and the end of the string. By default, the left and right quote characters are both the standard double quote character ". However, these characters can be changed with the lquote and rquote attributes defined below.

Namevaluesdefault
lquotestring"
rquotestring"

3.6.2 Conformance

UAs must support the ms element and the attributes mathvariant, lquote and rquote .

3.6.3 CSS Implementation

(This section is non-normative.)

The following rules show a possible implementation in CSS level 2:

ms[mathvariant="bold"], ms[mathvariant="bold-italic"], 
ms[mathvariant="bold-sans-serif"], ms[mathvariant="sans-serif-bold-italic"]
	{font-weight:bold;
	font-style:normal;}
ms[mathvariant="monospace"]
	{font-family:monospace;
	font-style:normal;}
ms[mathvariant="sans-serif"], ms[mathvariant="bold-sans-serif"], 
ms[mathvariant="bold-sans-serif"], ms[mathvariant="sans-serif-italic"], 
ms[mathvariant="sans-serif-bold-italic"], mtext[mathvariant="sans-serif"]
	{font-family:sans-serif;
	font-style:normal;}
ms[mathvariant="italic"], ms[mathvariant="bold-italic"],
ms[mathvariant="sans-serif-italic"], ms[mathvariant="sans-serif-bold-italic"]
	{font-style:italic;}
ms[mathvariant="normal"]
	{font-style:normal;}
ms:before, ms:after 
	{content:"\0022"}
ms[lquote]:before 
	{content:attr(lquote)}
ms[rquote]:after 
	{content:attr(rquote)}

4 General Layout Schemata

Besides tokens there are several families of MathML presentation elements. One family of elements deals with various "scripting" notations, such as subscript and superscript. Another family is concerned with matrices and tables. The remainder of the elements, discussed in this section, describe other basic notations such as fractions and radicals, or deal with general functions such as action binding and error handling.

4.1 Horizontally Group Sub-Expressions (mrow)

4.1.1 Background

An mrow element is used to group together any number of sub-expressions, usually consisting of one or more mo elements acting as "operators" on one or more other expressions that are their "operands".

4.1.2 Conformance

UAs must support the mrow element.

4.1.3 CSS Implementation

(This section is non-normative.)

The following rules show a possible implementation in CSS level 2:

mrow
	{white-space:nowrap;}

4.2 Fractions (mfrac)

4.2.1 Background

The mfrac element is used for fractions. It can also be used to mark up the presentation of fraction-like objects such as binomial coefficients and Legendre symbols. The syntax for mfrac is:

<mfrac> numerator denominator </mfrac>

In addition to common attributes, mfrac has additional attributes that could be used to control horizontal alignment of numerator and denominator and thickness of fraction bar.

Namevaluesdefault
linethickness0 | 1 | thin | medium | thick1
numalignleft | center | rightcenter
denomalignleft | center | rightcenter

The linethickness attribute indicates the thickness of the horizontal "fraction bar", or "rule", typically used to render fractions. Value "0" indicates that no bar should be rendered, values "thin", "medium" (the same as "1"), and "thick" are UA dependent, with "1" being the default value.

The numalign and denomalign attributes control the horizontal alignment of the numerator and denominator, respectively. Typically, numerators and denominators are centered.

4.2.2 Conformance

UAs must support the mfrac element and the attributes linethickness, numalign and denomalign.

4.2.3 CSS Implementation

(This section is non-normative.)

The following rules show a possible implementation in CSS level 3:

mfrac
	{display:inline-table;
	white-space:nowrap;
	text-align:center;
	vertical-align:-0.65em;
	line-height:1.4em;
	font-size:0.9em;
	margin:1px;
	table-baseline:2;}
mfrac > *:first-child::outside(2), mfrac > * + *::outside(4)
	{display:table-row;}
mfrac > *:first-child::outside, mfrac > * + *::outside(3)
	{display:table-cell;}
mfrac > *:first-child::outside
	{border-bottom:solid thin;}
mfrac > * + *::outside(2)
	{display:inline-table;
	vertical-align:text-top;}

4.3 Radicals (msqrt, mroot)

4.3.1 Background

These elements construct radicals. The msqrt element is used for square roots, while the mroot element is used to draw radicals with indices, e.g., a cube root. The syntax for these elements is:

<msqrt> base </msqrt>
<mroot> base index </mroot>

The mroot element requires exactly 2 arguments. However, msqrt accepts any number of arguments.

4.3.2 Conformance

UAs must support the mroot and msqrt elements

4.3.3 CSS Implementation

(This section is non-normative.)

The following rules show a possible implementation in CSS level 3:

mroot
	{display:inline-table;
	white-space:nowrap;
	line-height:1.1em;
	text-align:center;
	margin:1px;
	table-baseline:2;}
mroot > *:first-child::outside(2), mroot > * + *::outside(3)
	{display:table-row;}
mroot > * + *::outside(4)
	{display:table-header-group;}
mroot > *:first-child::outside, mroot > * + *::outside(2)
	{display:table-cell;}
mroot > * + *::outside(3)::after
	{display:table-cell;
	content:"\A0";
	line-height:0;}
mroot > * + *::outside(2)
	{font-size:0.75em;
	line-height:1.1em;
	vertical-align:bottom;}
mroot > * + *::outside
	{display:block;
	margin-bottom:-1em;}
mroot > *:first-child::outside
	{display:table-cell;
	border-top:solid 1px;
	padding:2px 5px 0 3px;
	border-left:solid thin;}
mroot > *:first-child::outside(2)::before
	{display:table-cell;
	content:"\A0";
	width:20px;
	background-position:bottom left;
	background-repeat:no-repeat;}
msqrt
	{display:inline-block;
	position:relative;
	margin:1px 0 1px 0.8em;
	padding:2px 5px 0 3px;
	border-top:solid 1px;
	border-left:groove 2px;
	z-index:1;}
msqrt::before
	{display:block;
	content:"";
	width:20px;
	height:20px;
	margin-bottom:-2px;
	position:absolute;
	z-index:1;
	bottom:0;
	left:-22px;}
msqrt::before, mroot > *:first-child::outside(2)::before
	{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABgElEQVR42q2TMUjDQBhGG5EQkCq4SB20WVwcXYTs4lCk0K5CZ%2Bno4pghmbJk7eIgZCsE2kFC03RVRHEoQUERClaxiEVpq2DP78IVoqXhJPnhQej9eTSPJEUISfGAEbj2OETz4AC0wWosIWYP%2BIAwXDD3byFmC3hUkslkepVK5dw0zWsmPeIWYtbACfhOp9NDTdPOPM8btVotQikWi7c4%2BwLbkULMItDBQBTFcblcvnRdt89EDlBAu9lsDmRZ7mPvDizNeLog%2BLMgCKRQKPiO43SZ6ArsTBZxvQk%2B6vV6R5Ikeqc1S0gURenUarV7JnoA%2B2AqPn4r0R3DMG5Yz9KU0LIsn4lewSGQoqLj%2FJju5%2FP5RwjfwcYvIQ6HwADLPC8u9hZoTzQeZrPZTwgvgBgWrvN%2BLX972rbdZT0N7i8lQhr01HW9A%2BEY7MYShnvmcrk3CJ%2FASlxh0LPRaIzQk%2F7L01jCcM9qtdoLesYVhnuqqvqSiDDcM0lh0DMx4aRnokLKD0gmJM1mPGUFAAAAAElFTkSuQmCC");}

4.4 Error Message (merror)

4.4.1 Background

The merror element displays its contents as an "error message". The contents can be any expression or expression sequence.

4.4.2 Conformance

UAs must support the merror element

4.4.3 CSS Implementation

(This section is non-normative.)

The following rules show a possible implementation in CSS level 2:

merror
	{display:inline-block;
	white-space:nowrap;
	outline:solid thin red}
merror::before
	{content:"Error: "}

4.5 Making Sub-Expressions Invisible (mphantom)

4.5.1 Background

The mphantom element renders its content as invisible, but with the same size and other dimensions, including baseline position, that its contents would have if they were rendered normally; mphantom can be used to align parts of an expression by invisibly duplicating sub-expressions.

4.5.2 Conformance

UAs must support the mphantom element.

4.5.3 CSS Implementation

(This section is non-normative.)

The following rules show a possible implementation in CSS level 2:

mphantom 
	{visibility:hidden}

4.6 Expression Inside Pair of Fences (mfenced)

4.6.1 Background

The mfenced element provides a convenient way of expressing common constructs involving fences (i.e., braces, brackets, and parentheses). The size of the fences depends on the size of the expression enclosed by the fence element. Opening and closing fences are specified using the open and close attributes defined below. This profile does not allow an mfenced element to have multiple children; authors are encouraged to group multiple children into one mrow element if this can be done.

Namevaluesdefault
openCDATA(
closeCDATA)

4.6.2 Conformance

UAs must support the mfenced element and the attributes open and close.

4.6.3 CSS Implementation

(This section is non-normative.)

The following rules show a possible implementation in CSS level 3:

mfenced
	{display:inline-table;
	white-space:nowrap;
	text-align:center;
	margin:1px;}
mfenced > *:first-child::outside(2)
	{display:table-row;}
mfenced > *:first-child::outside
	{display:table-cell;}
mfenced > *:first-child::outside(2)::before,
mfenced > *:first-child::outside(2)::after
	{display:table-cell;
	content:"\A0";
	background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAABQCAYAAAAZQFV3AAACw0lEQVR42sXZTYhSURQHcCcnW1SLItwYgeDCeEZkbYI2TqQRrm0WBSGBFJiI4aJAcEAIN7mYcCOtWgQuSg0czdRNMBBBtSiKms1ATIu%2Ba6Kh6XYmvHbm%2BHTeHc%2BlC%2F%2BN8H74fO%2Fec%2B%2FRJoSwjRsY2yCXIQfGhSYg05AFyNoHc%2BNgRyDzPehfNomdhfwYwFRBGFsg1yjidDpFLBZbjUQi91SwnZAqhjwej8hms6LVaolut7uWeavYJOQ%2BxsLhsGg2mxLqxyo4KyGHwyHS6fQAZBmEcUFidrtdFAqFYdgTyPmNsOOQFQkmEgkz6Ctkun%2FNCGw7ZFFioVDIDHsB2b%2FuuhHgjMTcbrdoNBoUewPZPXDdEGwfZFmCuVyOYt8hB02vHQLelpjX6xXtdpuCZ4bemQl2FPJbgvl8nmIPRz5IE%2FCWxAzDMHsQU5ZBGLvwb5dKpSjW2fC9JeBF%2FBJXKpVVAp5UBR9L0O%2F302%2F3HrLVMgjjEJ78yWSSgjctzXsEZjFYrVZ%2FEvCUKtiRmMvlot%2FuM8RhGexVrf7TDQQCFHxgeSHugcfw7cbj8S8EzKuCVzBYKpWWCHhaFZzDICztywT0qIJLuIIR7CNkQqGY%2FV1I%2B4uBz%2Bf7RcBHiqXWZuDbDQaD7wh4VxUMYzAajb4k4A1V8BIGM5nMUwJeVQWvY7BYLFLwnCp4B4Plcvk5AU%2Bogm0M1mq1VwQ8rAqu2%2BPV6%2FUFAhqq4DMySxY3O0sk%2BBqDsDWj83ivKvgWg1CDPxBwjyr4CYOdTucbAXeogisEpHN58r%2BD7LfM%2FlDYXxv2F5t96rEvDuzLF%2FsCy14C2IsUexnlLfTsWxFdmyX27Rz7hpN3S8y%2Badd1rOA9%2BLAfzXQdHnmPt%2BwHcC0tAvYmhpY2C3sjSEurir2ZpqXdp6UhqaVlyt7U1dJ21tIY19a61%2FLnwrC%2FP%2F4Ao%2FDcmC83BlAAAAAASUVORK5CYII%3D");
	background-size:100% 100%;
	background-repeat:no-repeat;}
mfenced > *:first-child::outside(2)::after
	{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAABQCAYAAAAZQFV3AAACo0lEQVR42sXZP2gTcRQH8GtT06E6KJIlIgQyRC4iRpdClygmIpljBwUJQlCIIUQyWAikEJAsZlCyBCcHIYMmEdLEmMsiFKRQHRRFuxSkDrb1X6Wl9ecL%2FAqP14L32ncY%2BMJNH7jc737v%2Fd4ZhmGchNyGjCqljP1m8JuBDK4WIJOQof2CimQWclYSHOQ35OqewHg8%2FiyZTG55PJ7d4LuQYRbY7%2FdnIarb7apCoaD8fj9FG5BDHFDhdDodFYvFKPocMrIncDu5XE653W6M3rcLXofM74aWy2XlcrkweuOf4PYFAJOQHxRNp9MY3ICctwVq9ATkHUWj0ShGFyFjtkCNHoF8wmC73VY%2Bnw%2Bj07ZBjZ6C%2FMJosVjE4BrkuG1Qo1cw2Ov1VCAQwOhjFqjRlxgtlUoY%2FAMZ54Ln6AMyTROjj1igRi0MZrNZ%2Bl8e5oIXMViv17fIYr%2FJBQ9AvmI0FAphcI4FavQhBjOZDN08TnPBSxhsNBrrBCxwQTfkG0a9Xi8GLRao0RcYDIfD9GmPcsESBlOp1Hdy2xNc8DIGq9XqEgHvcEE%2FKRVrBJzhgkOQFYySSrnEAjX6CoPBYHCTbBZjXPApBiORyBdy2yYXfIDBRCLxnoAxLjiFwXw%2B%2F5qAt7jgNQxWKhUK3uOCFzBYq9XeEvAJFzyDwWaz%2BYGAPS5oYrDVai3s6C2ZIH1bFgn4hgsewyC0gPR9%2FsgFj5JavUzAz1zwIAYty%2FpJwFUuOELATQJu%2FHdQ%2FJbFH4r4shFf2OKvnvjmIL59iW%2Bw4iVAvEiJl1G5Qi%2FeijjRLIm3c%2BINp1xLLN60O3GskDv4iB%2FNnDg8yh1vxQ%2FgoiMC0SGG6JhFdBAkOqoSG6aJj%2FucGEiKj0xlh7riY2fxwbgTo3vxjwuinz%2F%2BAspg3JgGTba0AAAAAElFTkSuQmCC");}
mfenced[open="["] > *:first-child::outside(2)::before
	{border-style:solid;
	border-width:1px 0 1px 1px;
	background-image:none;}
mfenced[close="]"] > *:first-child::outside(2)::after
	{border-style:solid;
	border-width:1px 1px 1px 0;
	background-image:none;}
mfenced[open="\2016"] > *:first-child::outside(2)::before
	{border-style:double;
	border-width:0 0 0 3px;
	background-image:none;}
mfenced[close="\2016"] > *:first-child::outside(2)::after
	{border-style:double;
	border-width:0 3px 0 0;
	background-image:none;}
mfenced[open="\27e6"] > *:first-child::outside(2)::before
	{border-style:double;
	border-width:2px 0 2px 3px;
	background-image:none;}
mfenced[close="\27e7"] > *:first-child::outside(2)::after
	{border-style:double;
	border-width:2px 3px 2px 0;
	background-image:none;}
mfenced[open="|"] > *:first-child::outside(2)::before
	{border-style:solid;
	border-width:0 0 0 1px;
	background-image:none;}
mfenced[close="|"] > *:first-child::outside(2)::after
	{border-style:solid;
	border-width:0 1px 0 0;
	background-image:none;}
mfenced[open="\230a"] > *:first-child::outside(2)::before
	{border-style:solid;
	border-width:0 0 1px 1px;
	background-image:none;}
mfenced[close="\230b"] > *:first-child::outside(2)::after
	{border-style:solid;
	border-width:0 1px 1px 0;
	background-image:none;}
mfenced[open="\2308"] > *:first-child::outside(2)::before
	{border-style:solid;
	border-width:1px 0 0 1px;
	background-image:none;}
mfenced[close="\2309"] > *:first-child::outside(2)::after
	{border-style:solid;
	border-width:1px 1px 0 0;
	background-image:none;}
mfenced[open="{"] > *:first-child::outside(2)::before
	{content:"\A0\A0";
	background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAABQCAYAAAAZQFV3AAACzElEQVR42rXZT4gSYRQA8F0dhBjwUB3sVKhFB0GWNQg85aEOiycPRhvrpQWPhQQh2MFYvAl1CQNPEmF6WRQvsuraoSj6txCUXfbQfyLYsnbdoq%2F35M2yzWY6871v4J0cfjyd%2Bd73vueUEGKKI%2BCagVjigJwQVyAGENLYEYguQsFgUGSz2acy2EmIDbfbLdLp9I92uy06nY5tbD%2FEeiAQELVabRshiE2IjB1sGmJZ13VRrVYHhK1AHBt%2BbgO8hL9ZJpMxMnsAoe18bhGbxacZiUQEYd8gjv51j0XwtqZpotFobBG4uOceC5gO0Q%2BFQkZ2a%2F%2B8zwJ4Dn87eEXeE3hNFqwjWK%2FXvxB4wjYI10GIbZ%2FP94uwdxDTMuA8ZpdMJl8SeGvkvROCuPhFLpd7TOBFWfA6goVC4QmB52XBuwiWy%2BU1As%2FIgl16wj0CZ2XB1wg2m03jHTwsC%2FYRhJq3SaBuG4TLjRiUq75REP57%2FwTgcQS9Xu86gT1Z8BSC4XD4OYGrsuBwlcTj8fsE3pEFLyOYSqXuEZiXBZcRLJVKzwi8YBuEax%2FEd5fLJVqtFr4yvyEOyYBzmB3sIcYKeTj2G40BbyKYz%2BcfEXjVNgiXBvHG6XTikvtE4IwMuIDZRaPRD4S9GlWlx4KUXQ%2BzgwpjgAsTrfsJs%2Bvt7g4sgTLZjQIXMbtYLPbRanZ7QGogNzweDz5Zo%2FadtdSumFrbrsPhEMVi8TNhFcvdmXmrTCQSXwl7C3HAFkgd%2FMDv9%2BOa%2FUlr9rTN7nZYAF5gAahUKkbfckOi92YG2b%2Bykoei5LVhf7GVLD0lxYG9fCkpsOxbgJJNin0bVbXR87Yi7M2SqnaOveFkb4nZm3beYwX7wUfV0Yz98Mh%2BvGU%2FgLOPCNiHGLxjFvZBkKpRFe8wjX3cp2QgyT4yVTLUJZRv7LwL5RuMmxpUntG9qZXm%2BXPBBA%2F%2F%2FvgDPxTMk2RIO1IAAAAASUVORK5CYII%3D");}
mfenced[close="}"] > *:first-child::outside(2)::after
	{content:"\A0\A0";
	background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAABQCAYAAAAZQFV3AAACq0lEQVR42s3ZTYhSURQHcEcfQgguqoWtGtSihSAyBoGrXNQiXLkwKsZNAy4LCQbBFka4E2oTBq4kwnQzKG6k0WpRFH0NBGWbWfQxRQxUls0Uvc4Z%2Fq9FEGP3HCHhuPxx9L577rnnuVwu10WKmG3bLo3gD39vUCxSeMRgqVR6HI1GbcC3KWZF4GAwsPv9vl0oFL76%2FX5GP1IckoBFijHD7XZ7MxKJMLpKsdMI5C%2FC9lPcZLTVam34fD5GlyhmjECgFsU9RovF4ib%2B07PGINB9FJ8ZTSaTzurPGYNAFxjsdrvfLMti9JoIBLrCaDweZ3BE4ZOCFxikR%2Bkt%2FssTUvAgg51OZx1gRwrOULxhNBQK%2FSCQV323MQj0KoO5XO45sjwpBc8wWC6XHwJclIKnGKxWq48AXpKCRxlsNBorAG9IwTms9NApbVJwL4O9Xs95Fl9KQR9q5RjgSAQC3SoUVM5GQP1ScMhgMBhcBXhACt5iMJFIPAV4WApeZzCTydyddLdsB1YYzOfzdwCek4KnGazX608ALknBPRQ%2Fl5eXx16vl8EvFDuMQaD3ccY4O%2BaYFDzPYKVSeQDwihSMYQu%2B93g8DL6isCQgV%2B8XjKZSqTVkOW8MAp1H5VlDlsO%2FZTkpaDnbcLssJz7AJ83yX8DfWabT6XfIcsEYBHocKz4OBAJOLzlrDAJtMlqr1T643W6n6%2FVIwF0UrxnNZrOf%2Fjxijdpewo5gj38Ph8NO2xczBoFe5iybzeY6CsczLhz%2FB6j6k9UXRfWxUX2w1beeanFQL1%2BqBVb9CJjGIaV%2BjOod9OqtyDSaJfV2Tr3hVG%2BJ1Zt2vWuF%2BsVnGlcz9cuj%2BvVW%2FQKuPiLQG2Koj1mmMQhSH1XpDdNUx32qA0nVkanqUFd97Kw%2BGFcf3au%2FXNB%2B%2FfELMUfMky4O9u8AAAAASUVORK5CYII%3D");}
mfenced[open=""] > *:first-child::outside(2)::before, mfenced[close=""] > *:first-child::outside(2)::after
	{content:normal;}

4.7 Enclose Expression Inside Notation (menclose)

4.7.1 Background

The menclose element renders its content inside the enclosing notation specified by its notation attribute, menclose accepts any number of arguments.

The values allowed for notation are open-ended. Conforming renderers may ignore any value they do not handle, although renderers are supposed to recognize at least the values listed below.

Namevalues
notationbox | left | right | top | bottom | horizontalstrike

The value "box" can be used to enclose content of the element in a frame. The values "left", "right", "top" and "bottom" should result in lines drawn on the corresponding sides of the contents, "horizontalstrike" should result in strikeout lines being superimposed over the content of the menclose.

4.7.2 Conformance

UAs must support the menclose element and the attribute notation

4.7.3 CSS Implementation

(This section is non-normative.)

The following rules show a possible implementation in CSS level 2:

menclose
	{display:inline-block;}
menclose[notation="top"]
	{border-top:solid thin;}
menclose[notation="bottom"]
	{border-bottom:solid thin;}
menclose[notation="left"]
	{border-left:solid thin;}
menclose[notation="right"]
	{border-right:solid thin;}
menclose[notation="box"]
	{border:solid thin;}
menclose[notation="horizontalstrike"]
	{text-decoration:line-through}

5 Script and Limit Schemata

The elements described in this section position one or more scripts around a base. In addition to subscript and superscript elements, MathML has overscript and underscript elements that place scripts above and below the base.

Because presentation elements should be used to describe the abstract notational structure of expressions, it is important that the base expression in all "scripting" elements (i.e., the first argument expression) should be the entire expression that is being scripted, not just, as has been common, the rightmost character.

5.1 Subscript (msub)

5.1.1 Background

The syntax for the msub element is:

 <msub> base subscript </msub>

The element is used to attach a subscript to a base.

5.1.2 Conformance

UAs must support the msub element.

5.1.3 CSS Implementation

(This section is non-normative.)

The following rules show a possible implementation in CSS level 3:

msub
	{display:inline-table;
	white-space:nowrap;
	text-align:left;}
msub > *:first-child::outside(2), msub > * + *::outside(3)
	{display:table-row;}
msub > *:first-child::outside, msub > * + *::outside(2)
	{display:table-cell;}
msub > *:first-child::outside(2)::after, msub > * + *::outside(3)::before
	{display:table-cell;
	content:"\A0";
	line-height:0;}
msub > * + *::outside(2)
	{font-size:0.75em;
	line-height:1.1em;
	vertical-align:top;}
msub > * + *::outside
	{display:block;
	margin-top:-0.7em;}

5.2 Superscript (msup)

5.2.1 Background

The syntax for the msup element is:

<msup> base superscript </msup>

The element is used to attach a superscript to a base.

5.2.2 Conformance

UAs must support the msup element.

5.2.3 CSS Implementation

(This section is non-normative.)

The following rules show a possible implementation in CSS level 3:

msup
	{display:inline-table;
	white-space:nowrap;
	text-align:left;
	table-baseline:2;}
msup > *:first-child::outside(2), msup > * + *::outside(3)
	{display:table-row;}
msup > * + *::outside(4)
	{display:table-header-group;}
msup > *:first-child::outside, msup > * + *::outside(2)
	{display:table-cell;}
msup > *:first-child::outside(2)::after, msup > * + *::outside(3)::before
	{display:table-cell;
	content:"\A0";
	line-height:0;}
msup > * + *::outside(2)
	{font-size:0.75em;
	line-height:1.1em;
	vertical-align:bottom;}
msup > * + *::outside
	{display:block;
	margin-bottom:-0.7em;}

5.3 Subscript-superscript Pair (msubsup)

5.3.1 Background

The msubsup element is used to attach both a subscript and a superscript to a base expression.

The syntax for the msubsup element is:

<msubsup> base subscript superscript </msubsup>

5.3.2 Conformance

UAs must support the msubsup

5.3.3 CSS Implementation

(This section is non-normative.)

The following rules show a possible implementation in CSS level 3:

msubsup
	{display:inline-table;
	white-space:nowrap;
	text-align:left;
	table-baseline:2;}
msubsup > *:first-child::outside(2), msubsup > * + *::outside(3)
	{display:table-row;}
msubsup > * + * + *::outside(4)
	{display:table-header-group;}
msubsup > *:first-child::outside, msubsup > *:first-child + *::outside(2), 
msubsup > *:first-child + * + *::outside(2)
	{display:table-cell;}
msubsup > *:first-child::outside(2)::after, msubsup > * + *::outside(3)::before
	{display:table-cell;
	content:"\A0";
	line-height:0;}
msubsup > *:first-child + *::outside(2), msubsup > * + * + *::outside(2)
	{font-size:0.75em;
	line-height:1.1em;}
msubsup > *:first-child + *::outside(2)
	{vertical-align:top;}
msubsup > * + * + *::outside(2)
	{vertical-align:bottom;}
msubsup > *:first-child + *::outside
	{display:block;
	margin-top:-0.7em;}
msubsup > * + * + *::outside
	{display:block;
	margin-bottom:-0.7em;}

5.4 Underscript (munder)

5.4.1 Background

(This section is non-normative.)

The syntax for the munder element is:

<munder> base underscript </munder>

The element is used to attach an underscript below a base.

The element accepts one optional attribute:

Namevaluesdefault
accentundertrue | falseautomatic

5.4.2 Conformance

UAs must support the munder element and its attribute accentunder.

5.4.3 CSS Implementation

(This section is non-normative.)

The following rules show a possible implementation in CSS level 3:

munder
	{display:inline-table;
	white-space:nowrap;
	text-align:center;}
munder > *::outside(2)
	{display:table-row;}
munder > *::outside
	{display:table-cell;}
munder > * + *::outside
	{font-size:0.75em;
	line-height:1.1em;}
munder > *:first-child::outside
	{line-height:1.2em;}

5.5 Overscript (mover)

5.5.1 Background

The syntax for the mover element is:

<mover> base overscript </mover>

The element is used to attach an overscript over a base.

5.5.2 Conformance

UAs must support the mover element.

5.5.3 CSS Implementation

(This section is non-normative.)

The following rules show a possible implementation in CSS level 3:

mover
	{display:inline-table;
	white-space:nowrap;
	text-align:center;
	table-baseline:2;}
mover > *::outside(2)
	{display:table-row;}
mover > * + *::outside(3)
	{display:table-header-group;}
mover > *::outside
	{display:table-cell;}
mover > * + *::outside
	{font-size:0.75em;
	line-height:1.1em;}
mover > *:first-child::outside
	{line-height:1.2em;}

5.6 Underscript-overscript Pair (munderover)

5.6.1 Background

The syntax for the munderover element is:

 <munderover> base underscript overscript</munderover>

The element is used to attach both an underscript and an overscript to a base.

5.6.2 Conformance

UAs must support the munderover element.

5.6.3 CSS Implementation

(This section is non-normative.)

The following rules show a possible implementation in CSS level 3:

munderover
	{display:inline-table;
	white-space:nowrap;
	text-align:center;
	table-baseline:2;}
munderover > *::outside(2)
	{display:table-row;}
munderover > * + * + *::outside(3)
	{display:table-header-group;}
munderover > *::outside
	{display:table-cell;}
munderover > * + *::outside
	{font-size:0.75em;
	line-height:1.1em;}
munderover > *:first-child::outside
	{line-height:1.2em;}

5.7 Prescripts (mmultiscripts)

5.7.1 Background

In the current profile the syntax for the mmultiscripts element is:

<mmultiscripts> base <prescripts/> presubscript presuperscript</mmultiscripts>

This element allows adding pairs of prescripts to one base expression. Missing scripts can be represented by the empty element none.

The argument sequence consists of the base followed by an empty element mprescripts and a pair of, vertically aligned, a presubscript and a presuperscript.

5.7.2 Conformance

UAs must be able to handle up to two prescripts specified in mmmultiscripts layout schemata.

5.7.3 CSS Implementation

(This section is non-normative.)

The following rules show a possible implementation in CSS level 3:

mmultiscripts
	{display:inline-table;
	white-space:nowrap;
	text-align:center;
	text-align:right;
	table-baseline:2;}
mmultiscripts > *
	{display:none;}
mmultiscripts > *:first-child::outside(2), 
mprescripts + *::outside(3), mprescripts + * + *::outside(3)
	{display:table-row;}
mprescripts + * + *::outside(4)
	{display:table-header-group;}
mmultiscripts > *:first-child::outside, 
mprescripts + *::outside(2), mprescripts + * + *::outside(2)
	{display:table-cell;}
mmultiscripts > *:first-child::outside(2)::before,
mprescripts + *::outside(3)::after, mprescripts + * + *::outside(3)::after
	{display:table-cell;
	content:"\A0";
	line-height:0;}
mprescripts + *::outside(2), mprescripts + * + *::outside(2)
	{font-size:0.75em;
	line-height:1.1em;}
mprescripts + *::outside(2)
	{vertical-align:top;}
mprescripts + * + *::outside(2)
	{vertical-align:bottom;}
mprescripts + *::outside
	{display:block;
	margin-top:-0.7em;}
mprescripts + * + *::outside
	{display:block;
	margin-bottom:-0.7em;}

6 Tables and Matrices

Matrices, arrays and other table-like mathematical notation are marked up using mtable, mtr, and mtd elements. These elements are similar to the table, tr and td elements of XHTML.

6.1 Table or Matrix (mtable)

6.1.1 Background

A matrix or table is specified using the mtable element.

The following attributes may be used to specify alignment and to add frames and rules to the table.

Namevaluesdefault
rowaligntop | bottom | center | baselinebaseline
columnalignleft | center | rightcenter
rowlines"none" | solid | dashed"none"
columnlines"none" | solid | dashed"none"
frame"none" | solid | dashed"none"

Note that the default value for each of rowlines, columnlines and frame is the literal string "none", meaning that the default is to render no lines, rather than that there is no default.

The rowalign attribute specifies how the entries in each row should be aligned. For example, "top" means that the tops of each entry in each row should be aligned with the tops of the other entries in that row. The columnalign attribute specifies how the entries in each column should be aligned.

6.1.2 Conformance

UAs must support the mtable element and the attributes rowalign, columnalign, rowlines, columnlines and frame.

6.1.3 CSS Implementation

(This section is non-normative.)

The following rules show a possible implementation in CSS level 2:

mtable
	{vertical-align:middle;
	display:inline-table;
	white-space:nowrap;
	text-align:center;
	margin:1px;}
mtable[columnalign="left"]
	{text-align:left;}
mtable[columnalign="right"]
	{text-align:right;}
mtable[rowalign="top"] mtd
	{vertical-align:top}
mtable[rowalign="bottom"] mtd
	{vertical-align:bottom}
mtable[rowalign="center"] mtd
	{vertical-align:middle}
mtable[frame="solid"]
	{border:solid thin;}
mtable[frame="dashed"]
	{border:dashed thin;}
mtable[rowlines="solid"], mtable[rowlines="dashed"], 
mtable[columnlines="solid"], mtable[columnlines="dashed"]
	{border-collapse:collapse;}
mtable[rowlines="solid"] > mtr + mtr
	{border-top:solid thin;}
mtable[rowlines="dashed"] > mtr + mtr
	{border-top:dashed thin;}
mtable[columnlines="solid"] > mtr > mtd + mtd
	{border-left:solid thin;}
mtable[columnlines="dashed"] > mtr > mtd + mtd
	{border-left:dashed thin;}

6.2 Row in a Table or Matrix (mtr)

6.2.1 Background

An mtr element represents one row in a table or matrix. An mtr element is only allowed as a direct sub-expression of an mtable element, and specifies that its contents should form one row of the table. Each argument of mtr is placed in a different column of the table, starting at the leftmost column.

The following attributes may be used to specify alignment

Namevaluesdefault
rowaligntop | bottom | center | baselineinherited
columnalignleft | center | rightinherited

The rowalign and columnalign attributes allow a specific row to override the alignment specified by the same attributes in the surrounding mtable element.

6.2.2 Conformance

UAs must support the mtr element and the attributes rowalign and columnalign.

6.2.3 CSS Implementation

(This section is non-normative.)

The following rules show a possible implementation in CSS level 2:

mtr
	{display:table-row;}
mtr[columnalign="left"]
	{text-align:left;}
mtr[columnalign="right"]
	{text-align:right;}
math mtable mtr[rowalign="top"] mtd
	{vertical-align:top}
math mtable mtr[rowalign="bottom"] mtd
	{vertical-align:bottom}
math mtable mtr[rowalign="center"] mtd
	{vertical-align:middle}

6.3 Entry in a Table or Matrix (mtd)

6.3.1 Background

An mtd element represents one entry, or cell, in a table or matrix. An mtd element is only allowed as a direct sub-expression of an mtr.

The following attributes may be used to specify alignment

Namevaluesdefault
rowaligntop | bottom | center | baselineinherited
columnalignleft | center | rightinherited

The rowalign and columnalign attributes allow a specific matrix element to override the alignment specified by a surrounding mtable or mtr element.

6.3.2 Conformance

UAs must support the mtd element and the attributes rowalign and columnalign.

6.3.3 CSS Implementation

(This section is non-normative.)

The following rules show a possible implementation in CSS level 2:

mtd
	{display:table-cell;
	padding:0 0.5ex;}
mtd[columnalign="left"]
	{text-align:left;}
mtd[columnalign="right"]
	{text-align:right;}
math mtable mtr mtd[rowalign="top"]
	{vertical-align:top}
math mtable mtr mtd[rowalign="bottom"]
	{vertical-align:bottom}
math mtable mtr mtd[rowalign="center"]
	{vertical-align:middle}

6.4 Bind Action to a Sub-Expression (maction)

6.4.1 Background

To provide a mechanism for binding actions to expressions, MathML provides the maction element. The action type is specified by the actiontype attribute.

Namevaluesdefault
actiontypetoggle | tooltip | highlight(required attribute, no default value)
  • <maction actiontype="toggle"> (first expression) (second expression) </maction>

    In this case the maction element is expected to have to child elements, with the first child being displayed by default. UAs that support this action type should provide a mechanism to toggle between two expressions.

  • <maction actiontype="tooltip"> (expression) (message) </maction>

    Here the maction element is expected to have to child elements, with first child being displayed by default. When a mouse cursor is placed over an expression UAs that support this action type should display the content of the second child in a "tooltip" box.

  • <maction actiontype="highlight"> (expression) </maction>

    In this case, a renderer might highlight the enclosed expression on a "mouse-over" event.

6.4.2 Conformance

UAs must support the maction element and the attribute actiontype

6.4.3 CSS Implementation

(This section is non-normative.)

The following rules show a possible implementation in CSS level 3:

maction[actiontype="toggle"] > * + *:not(maction[actiontype="toggle"]:hover > * + *), 
maction[actiontype="toggle"]:hover > *:first-child
	{display:none;}
maction[actiontype="highlight"]:hover
	{background-color:yellow;
	color:black;}
maction[actiontype="tooltip"] > * + *:not(maction[actiontype="tooltip"]:hover > * + *)
	{display:none;}
maction[actiontype="tooltip"]:hover > * + *::outside
	{position:fixed;
	display:block;
	top:0;
	left:0;
	background-color:InfoBackground;
	color:InfoText;
	padding:0.5ex;
	border:solid 1px;}

6.5 Add semantic mapping (semantics)

6.5.1 Background

The current profile deals with layout schemata that reflect the visual structure of mathematical formulae. To attach extra semantic information that describes the content of formulae or provides an alternative encoding of a mathematical expression one can use the Content MathML semantics element.

UAs that do not support the annotation mechanism provided by the semantics element should process the content of its first child, ignoring the element itself and the rest of its child elements.

6.5.2 Conformance

UAs must support the semantics element.

6.5.3 CSS Implementation

(This section is non-normative.)

The following rules show a possible implementation in CSS level 2:

semantics > * + *
	{display:none;}

7 Extensibility and Conformance

7.1 Extensibility

Since the current profile is designed to be suitable for use in an XML/CSS environment, it is relatively easy to extend it by adding new elements or attributes [rec-xml] to a DTD and specifying the default formatting in a style sheet. However any new elements should be placed in their own namespace and any new attributes added to existing MathML elements should have a namespace prefix; authors and implementors are strongly encouraged to use standard markup whenever possible. Similarly, maintainers of documents employing MathML extension mechanisms are encouraged to monitor relevant standards activity and to update documents to use more standardized markup as it becomes available.

7.2 Conformance

Documents that conform to this MathML for CSS profile should be conformant MathML 3.0 documents and should use only those MathML elements and attributes included in the current profile. The content of layout schemata with a fixed number of arguments should match the content model specified in the list of required arguments and the profile's DTD.

UAs that conform to the MathML for CSS profile should be able to handle MathML expressions that conform to the current profile. When a conformant UA encounters an element that it does not recognize it may ignore that element, but should process its content. UAs that support the standard DOM are encouraged to expose such elements through generic DOM Element interface. UAs that support style sheets are encouraged to apply formatting specified in style sheets to such elements.

8 Differences between MathML presentational markup and this CSS-oriented profile

The MathML for CSS profile differs from full MathML presentational markup in a number of ways. The present section is intended to highlight main differences.

9 Document Type Definition

The DTD included in the first working draft does not follow the conventions specified in [xhtml-modularization]; it will be changed appropriately in time for the Last Call WD

<!ENTITY % common "class NMTOKENS #IMPLIED xml:id ID #IMPLIED style CDATA #IMPLIED">
<!ENTITY % mrow "(maction | menclose | merror | mfenced | mfrac | mi | mmultiscripts | mn | mo | 
		mover | mphantom | mroot | mrow | ms | msqrt | msub | msubsup | msup | mtable | mtext | munder | munderover | semantics)">
<!ENTITY % math "(%mrow;)+">
<!ATTLIST maction actiontype (toggle | tooltip | highlight) #REQUIRED %common;>
<!ELEMENT maction (%mrow;,(%mrow;)?)>
<!ATTLIST math display (block | inline) #IMPLIED xmlns CDATA #REQUIRED
		alttext CDATA #IMPLIED altimage CDATA #IMPLIED %common;>
<!ELEMENT math %math;>
<!ATTLIST menclose notation (bottom | box | left | right | top | horizontalstrike) #REQUIRED %common;>
<!ELEMENT menclose %math;>
<!ATTLIST merror %common;>
<!ELEMENT merror %math;>
<!ATTLIST mfenced open CDATA #IMPLIED close CDATA #IMPLIED %common;>
<!ELEMENT mfenced %mrow;>
<!ATTLIST mfrac linethickness (0 | 1 | thin | medium | thick) #IMPLIED 
		numalign (center | left | right) #IMPLIED denalign (center | left | right) #IMPLIED %common;>
<!ELEMENT mfrac (%mrow;,%mrow;)>
<!ATTLIST mi mathvariant (normal | bold | italic | bold-italic | sans-serif | bold-sans-serif | 
		sans-serif-italic | sans-serif-bold-italic | monospace) #IMPLIED %common;>
<!ELEMENT mi (#PCDATA)>
<!ATTLIST mmultiscripts %common;>
<!ELEMENT mmultiscripts (%mrow;, mprescripts, ((none, %mrow;)|(%mrow;,(none|%mrow;))))>
<!ATTLIST mn mathvariant (normal | bold | italic | bold-italic | sans-serif | bold-sans-serif | 
		sans-serif-italic | sans-serif-bold-italic | monospace) #IMPLIED %common;>
<!ELEMENT mn (#PCDATA)>
<!ATTLIST mo largeop (true | false) #IMPLIED separator (true | false) #IMPLIED fence (true | false) #IMPLIED
		form (prefix | infix | postfix) #IMPLIED stretchar CDATA #IMPLIED
		mathvariant (normal | bold | italic | bold-italic | sans-serif | 
		bold-sans-serif | sans-serif-italic | sans-serif-bold-italic | monospace) #IMPLIED %common;>
<!ELEMENT mo (#PCDATA)>
<!ATTLIST mover %common;>
<!ELEMENT mover (%mrow;,%mrow;)>
<!ATTLIST mphantom %common;>
<!ELEMENT mphantom %math;>
<!ATTLIST mprescripts %common;>
<!ELEMENT mprescripts EMPTY>
<!ATTLIST mroot %common;>
<!ELEMENT mroot (%mrow;,%mrow;)>
<!ATTLIST mrow %common;>
<!ELEMENT mrow %math;>
<!ELEMENT ms (#PCDATA)>
<!ATTLIST ms lquote CDATA #IMPLIED rquote CDATA #IMPLIED %common;>
<!ATTLIST msqrt %common;>
<!ELEMENT msqrt %math;>
<!ATTLIST msub %common;>
<!ELEMENT msub (%mrow;,%mrow;)>
<!ATTLIST msubsup %common;>
<!ELEMENT msubsup (%mrow;,%mrow;,%mrow;)>
<!ATTLIST msup %common;>
<!ELEMENT msup (%mrow;,%mrow;)>
<!ATTLIST mtable 
	rowalign (top | bottom | center | baseline) #IMPLIED
	columnalign (left | center | right) #IMPLIED
	rowlines (none | solid | dashed) #IMPLIED
	columnlines (none | solid | dashed) #IMPLIED
	frame (none | solid | dashed) #IMPLIED %common;>
<!ELEMENT mtable (mtr+)>
<!ATTLIST mtd 
	rowalign (top | bottom | center | baseline | inherit) #IMPLIED
	columnalign (left | center | right | inherit) #IMPLIED %common;>
<!ELEMENT mtd %math;>
<!ATTLIST mtext mathvariant (normal | bold | italic | bold-italic | sans-serif | bold-sans-serif | 
		sans-serif-italic | sans-serif-bold-italic | monospace) #IMPLIED %common;>
<!ELEMENT mtext (#PCDATA)>
<!ATTLIST mtr 
	rowalign (top | bottom | center | baseline | inherit) #IMPLIED 
	columnalign (left | center | right | inherit) #IMPLIED %common;>
<!ELEMENT mtr (mtd+)>
<!ATTLIST munder %common;>
<!ELEMENT munder (%mrow;,%mrow;)>
<!ATTLIST munderover %common;>
<!ELEMENT munderover (%mrow;,%mrow;,%mrow;)>
<!ATTLIST none %common;>
<!ELEMENT none EMPTY>
<!ATTLIST mspace width (verythinmathspace | thinmathspace | mediummathspace | thickmathspace | verythickmathspace) #IMPLIED 
		linebreak (auto | newline | goodbreak) #IMPLIED %common;>
<!ELEMENT mspace EMPTY>
<!ATTLIST semantics definitionURL CDATA #IMPLIED encoding CDATA #IMPLIED>
<!ELEMENT semantics ANY>

10 References

css
Cascading Style Sheets, level 2 revision 1, Bert Bos, Tantek Çelik, Ian Hickson, Håkon Wium Lie. W3C Working Draft 06 November 2006.
css2
Cascading Style Sheets, level 2 CSS2 Specification, Bert Bos, Håkon Wium Lie, Chris Lilley, Ian Jacobs. May 1998.
rec-xml
Extensible Markup Language (XML) 1.0 (Fourth Edition), Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, et. al. editors. W3C Recommendation 16 August 2006.
rec-xmlns
Namespaces in XML 1.0 (Second Edition), Tim Bray, Dave Hollander, Andrew Layman, Richard Tobin. W3C Recommendation 16 August 2006.
mathml
Mathematical Markup Language (MathML) Version 3.0, in preparation.
mathml1
Mathematical Markup Language (MathML) 1.0 Specification, Patrick Ion, Robert Miner. April 1998.
roadmap
Math Working Group Roadmap 2007/8, Patrick Ion, Robert Miner. March 2007, document subject to update. [See especially 2.2.1]
xhtml-modularization
XHTML™ Modularization 1.1, Daniel Austin, Subramanian Peruvemba, Shane McCarron, Masayasu Ishikawa, W3C Proposed Recommendation 13 February 2006.
rec-xmlid
xml:id Version 1.0, Jonathan Marsh, Daniel Veillard, Norman Walsh. W3C Recommendation 9 September 2005.