7 The MathML Interface

Overview: Mathematical Markup Language (MathML) Version 2.0
Previous: 6 Characters, Entities and Fonts
Next: 8 Document Object Model for MathML
 
7 The MathML Interface
7.1 Embedding MathML in other Documents
   7.1.1 MathML and Namespaces
   7.1.2 The Top-Level math Element
   7.1.3 Invoking MathML Processors
   7.1.4 Mixing and Linking MathML and HTML
7.2 Generating, Processing and Rendering MathML
   7.2.1 MathML Compliance
   7.2.2 Handling of Errors
   7.2.3 Attributes for unspecified data
7.3 Future Extensions
   7.3.1 Macros and Style Sheets
   7.3.2 XML Extensions to MathML

To be effective, MathML must work well with a wide variety of renderers, processors, translators and editors. This chapter addresses some of the interface issues involved in generating and rendering MathML. Since MathML exists primarily to encode mathematics in Web documents, perhaps the most important interface issues are related to embedding MathML in HTML [HTML4.0] and XHTML [XHTML1.0] and [XHTML1.1].

There are three kinds of interface issues that arise in embedding MathML in other XML documents. First, MathML must be semantically integrated. MathML markup must be recognized as valid embedded XML content, and not as an error. This is primarily a question of managing namespaces in XML [Namespaces].

Second, in the case of HTML/XHTML, MathML rendering must be integrated into browser software. Some browsers already implement MathML rendering natively, and one can expect more browsers will do so in the future. At the same time, other browsers have developed infrastructure to facilitate the rendering of MathML and other embedded XML content by third-party software. Using these browser specific mechanisms generally requires some additional interface markup of some sort to activate.

Third, other tools for generating and processing MathML must be able to intercommunicate. A number of MathML tools have been or are being developed, including editors, translators, computer algebra systems, and other scientific software. However, since MathML expressions tend to be lengthy, and prone to error when entered by hand, special emphasis must be given to insuring that MathML can be easily generated by user-friendly conversion and authoring tools, and that these tools work together in a dependable, platform and vendor independent way.

The W3C Math working group is committed to providing support to software vendors developing all kinds of MathML tools. The working group monitors the public mailing list [email protected], and will attempt to answer questions about the MathML specification. The working group works with MathML developer and user groups. For current information about MathML tools, applications and user support activities, consult the home page of the W3C Math Working Group.

7.1 Embedding MathML in other Documents

While MathML can be used in isolation as a language for exchanging mathematical expressions between MathML-aware applications, the primary anticipated use of MathML is to encode mathematical expression within larger documents. MathML is ideal for embedding math expressions in other applications of XML.

In particular, we focus here on the mechanics of embedding MathML in XHTML. XHTML [XHTML1.0] is a recently released W3C Recommendation formulating a family of current and future XML-based document types and modules that reproduce, subset, and extend HTML 4. While HTML 4 [HTML4.0] is the dominant language of the Web today, one may anticipate a shift from HTML 4 to XHTML. Indeed, XHTML already renders properly in HTML 4 user agents.

Since MathML and XHTML share a common XML framework, namespaces provide a standard mechanism for embedding MathML in XHTML. While some popular user agents also support inclusion of MathML directly in HTML 4 as "XML data islands," the view point we adopt here is that this is a transitional strategy, and we don't elaborate on it. Consult your user agent documentation for specific information on its support for embedding XML in HTML.

7.1.1 MathML and Namespaces

Embedding MathML in XML-based documents in general, and XHTML in particular, is a matter of managing namespaces. See the W3C Recommendation "Namespaces in XML" [Namespaces] for full details.

An XML namespace is a collection of names identified by a URI resource. The URI for the MathML namespace is:

http://www.w3.org/1998/Math/MathML

Using namespaces, embedding a MathML expression in a larger XML document is merely a matter of identifying the MathML markup as residing in the MathML namespace. This can be accomplished by either explicitly identifying each MathML element name by attaching a namespace prefix, or by declaring a default namespace on an enclosing element.

To declare a namespace, one uses an xmlns attribute, or an attribute with an xmlns prefix. When the xmlns attribute is used alone, it sets the namespace for the element on which it appears, and for any children elements.

Example:

<math xmlns="http://www.w3.org/1998/Math/MathML">
<mrow>...</mrow>
</math>

When the xmlns attribute is used as a prefix, it declares a prefix which can then be used to explicitly associate other elements and attributes with a particular namespace.

Example:

<body xmlns:m="http://www.w3.org/1998/Math/MathML">
...
<m:math><m:mrow>...</m:mrow></m:math>
...
</body>

These two methods of namespace declaration can be used together. For example, by using both an explicit document-wide namespace prefix, and default namespace declarations on individual math elements, it is possible to localize namespace related markup to the top-level math' element. This is also important for implementation with some user agents, since attaching rendering behaviors to element currently requires an explicit namespace prefix in these browsers. At the same time, a number of MathML authoring tools are not yet namespace-aware, and thus the ability to use markup without prefixes is also desirable in the short term.

Example:

<body xmlns:m="http://www.w3.org/1998/Math/MathML">
...
<m:math xmlns="http://www.w3.org/1998/Math/MathML">
<mrow>...<mrow>
</m:math>
...
</body>

7.1.1.1 Document Validation Issues

The use of namespace prefixes creates an issue for DTD validation of documents embedding MathML. DTD validation requires knowing the literal (possibly prefixed) element names used in the document. However, the Namespaces in XML Recommendation [Namespaces] allows the prefix to be changed at arbitrary points in the document, since namespace prefixes may be declared on any element.

The `historical' method of bridging this gap was to write a DTD with a fixed prefix, or in the case of XHTML and MathML, with no prefix, and mandate that the specified form must be used throughout the document. However, this is somewhat restricting for a modular DTD that is intended for use in conjunction with another DTD, which is exactly the situation with MathML in XHTML. In essence, the MathML DTD would have to `allocate' a prefix for itself and hope no other module uses the same prefix to avoid name clashes, thus losing one of the main benefits of XML namespaces.

One strategy for addressing this problem is to make every element name in the DTD be accessed by an entity reference. This means that by declaring a couple of entities to specify the prefix before the DTD is loaded, the prefix can be chosen by a document author, and compound DTDs that include several modules can, without changing the module DTDs, specify unique prefixes for each module to avoid clashes. The MathML DTD has been designed in this fashion. See Section A.1 [The MathML DTD], [Modularization] and [Building] for details.

An extra issue arises in the case where explicit prefixes are used on the top-level math element, but a default namespace is used for other MathML elements. In this case, one wants the MathML module to be included into XHTML with the prefix set to empty. However, the `driver' DTD file that sets up the inclusion of the MathML module would then need to define a new element called m:math. This would allow the top-level math element to use an explicit prefix, for attaching rendering behaviors in current browsers, while the contents would not need an explicit prefix, for ease of interoperability between authoring tools, etc.

7.1.1.2 Compatibility Suggestions

While the use of namespaces to embed MathML in other XML applications is completely described by the relevant W3C recommendations, a certain degree of pragmatism is still called for at present. Support for XML, namespaces and rendering behaviors in popular user agents is not always fully in alignment with W3C Recommendations. In some cases the software predates the relevant standard, and in other cases, the relevant standards are not yet complete.

During the transitional period in which some software may not be fully namespace-aware, a few conventional practices will ease compatibility problems. After surveying a number of user agents and other MathML-aware software applications, we offer the following suggestions.

  1. If you use namespace prefixes with MathML markup, use m: as a conventional prefix for the MathML namespace. Using an explicit prefix is probably safer for compatibility in current user agents.
  2. If you use namespace prefixes, pick one and use it consistently within a document.
  3. Explicitly declare the MathML namespace on all math elements.

Examples.

<body>
...
<m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
<m:mrow>...<m:mrow>
</m:math>
...
</body>

Or

<body>
...
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mrow>...<mrow>
</math>
...
</body>

Note that these suggestions alone may not be sufficient for creating functional Web pages containing MathML markup. It will generally be the case that some additional document-wide markup will be required. Additional work may also be required to make all MathML instances in a document compatible with document-wide declarations. This is particularly true when documents are created by cutting and pasting MathML expressions, since current tools will probably not be able to query global namespace information.

Consult the W3C Math Working Group homepage for compatibility and implementation suggestions for current browsers and other MathML-aware tools.

7.1.2 The Top-Level math Element

MathML specifies a single top-level or root math element, which encapsulates each instance of MathML markup within a document. All other MathML content must be contained in a math element; equivalently, every valid, complete MathML expression must be contained in <math> tags. The math element must always be the outermost element in a MathML expression; it is an error for one math element to contain another.

Applications that return sub-expressions of other MathML expressions, for example as the result of a cut-and-paste operation, should always wrap them in <math> tags. Ideally, the presence of enclosing <math> tags should be a very good heuristic test for MathML content. Similarly, applications which insert MathML expressions in other MathML expressions must take care to remove the <math> tags from the inner expressions.

The math element can contain an arbitrary number of children schemata. The children schemata render by default as if they were contained in a mrow element.

The attributes of the math element are:

class, id, style
Provided for style sheet and DOM compatibility.
macros
This attribute provides a way of pointing to external macro definition files. Macros are not part of the MathML specification, and much of the functionality provided by macros in MathML can be accommodated by XSL transformations [XSLT]. However, the macros attribute is provided to make possible future development of more streamlined, MathML-specific macro mechanisms. The value of this attribute is a sequence of URLs or URIs, separated by whitespace
mode
The mode attribute specifies whether the enclosed MathML expression should be rendered in a display style or an in-line style. Allowed values are display and inline (default). This attribute is deprecated in favor of the new display attribute, or the standard CSS2 `display' property with the analogous block and inline values.
display
The display attribute replaces the deprecated mode element. It 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).

The attributes of the math element affect the entire enclosed expression. It is, in a sense, `inward looking'. However, to render MathML properly in a browser, and to integrate it properly into an XHTML document, a second collection of `outward looking' attributes are also useful.

While general mechanisms for attaching rendering behaviors to elements in XML documents are under development, wide variations in strategy and level of implementation remain between various existing user agents. Consequently, the remainder of this section describes attributes and functionality that are desirable for integrating third-party rendering modules with user agents:

overflow
In cases where size negotiation is not possible or fails (for example in the case of an extremely long equation), this attribute is provided to suggest an alternative processing method to the renderer. Allowed values are
scroll
The window provides a viewport into the larger complete display of the mathematical expression. Horizontal or vertical scrollbars are added to the window as necessary to allow the viewport to be moved to a different position.
elide
The display is abbreviated by removing enough of it so that the remainder fits into the window. For example, a large polynomial might have the first and last terms displayed with `+ ... +' between them. Advanced renderers may provide a facility to zoom in on elided areas.
truncate
The display is abbreviated by simply truncating it at the right and bottom borders. It is recommended that some indication of truncation is made to the viewer.
scale
The fonts used to display the mathematical expression are chosen so that the full expression fits in the window. Note that this only happens if the expression is too large. In the case of a window larger than necessary, the expression is shown at its normal size within the larger window.
altimg
This attribute provides a graceful fall-back for browsers that do not support embedded elements. The value of the attribute is an URL.
alttext
This attribute provides a graceful fall-back for browsers that do not support embedded elements or images. The value of the attribute is a text string.

7.1.3 Invoking MathML Processors

In browsers where MathML is not natively supported, we anticipate that MathML rendering will be carried out via embedded objects such as plug-ins, applets, or helper applications. The direction which has begun emerging for invoking third-party rendering and processing software is elucidated in the W3C Working Draft "Behavioral Extensions to CSS" [Behaviors].

Behavioral extensions use the linking mechanism of CSS to attach executable components to elements. Typically, the executable components involve script code which manipulate the DOM to instantiate other MathML processing components. Using experimental implementations of behavior extensions in current user agents, it is possible to attach processing components to math elements which use applets or plug-ins to render MathML markup in an XHTML page.

Work on on Behavior Extensions to CSS is ongoing at W3C, and existing implementations must be regarded as experimental at the time. However, it offers a very promising direction for powerful and flexible invocation of third-party MathML processors.

MIME types offer an alternative strategy that can also be used in current user agents to invoke a MathML renderer. This is primarily useful when referencing separate files containing MathML markup from an EMBED or OBJECT element. The W3C Math Working Group suggests that generic MathML be assigned the MIME type text/x-mathml, and for browser registry, we suggest the standard file extension .mml be used. In MathML 1.0, text/mathml was given as the suggested MIME type. However, the assignment of MIME types to XML applications has come into question in the interim. Thus, beginning with MathML 2.0, we suggest instead using the less-regulated experimental MIME type text/x-mathml.

Although rendering MathML expressions typically occurs in place in a Web browser, other MathML processing functions take place more naturally in other applications. Particularly common tasks include opening a MathML expression in an equation editor or computer algebra system.

At present, there is no standard way of selecting between various applications which might be used to render or process embedded MathML. As work progresses on coordination between browsers and embedded elements and the Document Object Model [DOM], providing this kind of functionality should be a priority. Both authors and readers should be able to indicate a preference about what MathML application to use in a given context. For example, one might imagine that some mouse gesture over a MathML expression causes a browser to present the reader with a pop-up menu, showing the various kinds of MathML processing available on the system, and the MathML processors recommended by the author.

Since MathML is most often generated by authoring tools, it is particularly important that opening a MathML expression in an editor should be easy to do and to implement. In many cases, it will be desirable for an authoring tool to record some information about its internal state along with a MathML expression, so that an author can pick up editing where he or she left off. The MathML specification does not explicitly contain provisions for recording information about the authoring tool. In some circumstances, it may be possible to include authoring tool information that applies to an entire document in the form of meta-data; interested readers are encouraged to consult the W3C Metadata Activity for current information about metadata and resource definition. For encoding authoring tool state information that applies to a particular MathML instance, readers are referred to the possible use of the semantics element for this purpose.

In the short term, regardless of the methodology, implementors of embedded MathML processing applications are encouraged to try to allow for the following kinds of functionality:

7.1.4 Mixing and Linking MathML and HTML

In order to be fully integrated into XHTML, it should be possible not only to embed MathML in XHTML, but also to embed XHTML in MathML. However, the problem of supporting XHTML in MathML presents many difficulties. Moreover, the problems are not specific to MathML; they are problems for XML applications in XHTML generally. Therefore, at present, the MathML specification does not permit any XHTML elements within a MathML expression, although this may be subject to change in a future revision of MathML.

In most cases, XHTML elements either do not apply in mathematical contexts (headings, paragraphs, lists, etc.), or MathML already provides equivalent or better functionality specifically tailored to mathematical content (tables, style changes, etc.). However, there are two notable exceptions.

7.1.4.1 Linking

MathML has no element that corresponds to the XHTML anchor element a. In XHTML, anchors are used both to make links, and to provide locations to which a link can be made. MathML, as an XML application, defines links by the use of the mechanism described in the W3C Working Draft "XML Linking Language" [XLink]. The reader is cautioned that this is at present still a working draft, and is therefore subject to future revision. Since the MathML linking mechanism is defined in terms of the XML linking specification, the same proviso holds for it as well.

A MathML element is designated as a link by the presence of the attribute xlink:href. To use the attribute xlink:href, it is also necessary to declare the appropriate namespace. Thus, a typical MathML link might look like:

<mrow xmlns:xlink="http://www.w3.org/1999/xlink"
      xlink:href="sample.xml">
  ...
</mrow>

MathML designates that almost all elements can be used as XML linking elements. The only elements that cannot serve as linking elements are those such as the sep element, which exist primarily to disambiguate other MathML constructs and in general do not correspond to any part of a typical visual rendering. The full list of exceptional elements that cannot be used as linking elements is given in the table below.

MathML elements that cannot be linking elements.
mprescripts none sep
malignmark maligngroup  

Note that the XML Linking [XLink] and XML Pointer Language [XPointer] specifications also define how to link into a MathML expressions. Be aware, however, that such links may or may not be properly interpreted in current software.

7.1.4.2 Images

The IMG element has no MathML equivalent. The decision to omit a general mechanism for image inclusion from MathML was based on several factors. However, the main reason for not providing an image facility is that MathML takes great pains to make the notational structure and mathematical content it encodes easily available to processors, whereas information contained in images is only available to a human reader looking at a visual representation. Thus, for example, in the MathML paradigm, it would be preferable to introduce new glyphs via the mglyph element which at a minimum identifies them as glyphs, rather than simply including them as images.

Finally, apart from the introduction of new glyphs, many of the situations where one might be inclined to use an image amount to some sort of labeled diagram. For example, knot diagrams, Venn diagrams, Dynkin diagrams, Feynman diagrams and complicated commutative diagrams all fall into this category. As such, their content would be better encoded via some combination of structured graphics and MathML markup. Because of the generality of the `labeled diagram' construction, the definition of a markup language to encode such constructions extends beyond the scope of the current W3C Math activity. (See http://www.w3.org/Graphics for further W3C activity in this area.)

7.2 Generating, Processing and Rendering MathML

Information is increasingly generated, processed and rendered by software tools. The exponential growth of the Web is fueling the development of advanced systems for automatically searching, categorizing, and interconnecting information. Thus, although MathML can be written by hand and read by humans, the future of MathML is also tied to the ability to process it with software tools.

There are many different kinds of MathML editors, translators, processors and renderers. What it means to support MathML varies widely between applications. For example, the issues that arise with a MathML-compliant validating parser are very different from those for a MathML-compliant equation editor.

In this section, guidelines are given for describing different types of MathML support, and for quantifying the extent of MathML support in a given application. Developers, users and reviewers are encouraged to use these guidelines in characterizing products. The intention behind these guidelines is to facilitate reuse and interoperability between MathML applications by accurately characterizing their capabilities in quantifiable terms.

7.2.1 MathML Compliance

A valid MathML expression is an XML construct determined by the MathML DTD together with the additional requirements given in the specifications of the MathML document.

We define a `MathML processor' to mean any application that can accept, produce, or `roundtrip' a valid MathML expression. An example of an application that might round-trip a MathML expression might be an editor that writes a new file even though no modifications are made.

We specify three forms of MathML compliance:

  1. A MathML-input-compliant processor must accept all valid MathML expressions, and faithfully translate all MathML expressions into application-specific form allowing native application operations to be performed.
  2. A MathML-output-compliant processor must generate valid MathML, faithfully representing all application-specific data.
  3. A MathML-roundtrip-compliant processor must preserve MathML equivalence. Two MathML expressions are `equivalent' if and only if both expressions have the same interpretation (as stated by the MathML DTD and specification) under any circumstances, by any MathML processor. Equivalence on an element-by-element basis is discussed elsewhere in this document.

Beyond the above definitions, the MathML specification makes no demands of individual processors. In order to guide developers, the MathML specification includes advisory material; for example, there are suggested rendering rules included in Chapter 3 [Presentation Markup]. However, in general, developers are given wide latitude in interpreting what kind of MathML implementation is meaningful for their own particular application.

To clarify the difference between compliance and interpretation of what is meaningful, consider some examples:

  1. In order to be MathML-input-compliant, a validating parser needs only to accept expressions, and return `true' for expressions that are valid MathML. In particular, it need not render or interpret the MathML expressions at all.
  2. A MathML computer-algebra interface based on content markup might choose to ignore all presentation markup. Provided the interface accepts all valid MathML expressions included those containing presentation markup, it would be technically correct to characterize the application as MathML-input-compliant.
  3. A equation editor might have an internal data representation that makes it easy to export some equations as MathML but not others. If the editor exports the simple equations as valid MathML, and merely displays an error message to the effect that conversion failed for the others, it is still technically MathML-output-compliant.

As the previous examples show, to be useful, the concept of MathML compliance frequently involves a judgment about what parts of the language are meaningfully implemented, as opposed to parts that are merely processed in a technically correct way with respect to the definitions of compliance. This requires some mechanism for giving a quantitative statement about which parts of MathML are meaningfully implemented by a given application. To this end, the W3C Math working group has provided a test suite of MathML expressions at http://www.w3.org/Math/testsuite.

The test suite consists of a large number of MathML expressions categorized by markup category and dominant MathML element being tested. The existence of this test suite makes is possible, for example, to characterize quantitatively the hypothetical computer algebra interface mentioned above by saying that it is a MathML-input compliant processor which meaningfully implements MathML content markup, including all of the expressions given under http://www.w3.org/Math/testsuite/tests/4.

Developers who choose not to implement parts of the MathML specification in a meaningful way are encouraged to itemize the parts they leave out by referring to specific categories in the test suite.

For MathML-output-compliant processors, there is also a MathML validator online at http://www.w3.org/Math/validator. Developers of MathML-output-compliant processors are encouraged to verify their output using this validator.

Customers of MathML applications who wish to verify claims as to which parts of the MathML specification are implemented by an application are encouraged to use the test suites as a part of their decision processes.

7.2.1.1 Deprecated MathML 1.x Features

MathML 2.0 contains a number of MathML 1.x constructs which are now deprecated. We now clarify the relation between deprecated features and MathML 2.0 compliance.

  1. In order to be MathML-output-compliant, authoring tools may not generate MathML markup containing deprecated features.
  2. In order to be MathML-input-compliant, rendering/reading tools must support deprecated features if they are to be MathML 1.x compliant. They do not have to support deprecated features to be considered MathML 2.0 compliant. However, all tools are encouraged to support the old forms as much as possible.
  3. In order to be MathML-roundtrip-compliant, a processor need only preserve MathML equivalence on expressions containing no deprecated features.

7.2.2 Handling of Errors

If a MathML-input-compliant application receives input containing one or more elements with an illegal number or type of attributes or child schemata, it should nonetheless attempt to render all the input in an intelligible way, i.e. to render normally those parts of the input that were valid, and to render error messages (rendered as if enclosed in an merror element) in place of invalid expressions.

MathML-output-compliant applications such as editors and translators may choose to generate merror expressions to signal errors in their input. This is usually preferable to generating valid, but possibly erroneous, MathML.

7.2.3 Attributes for unspecified data

The MathML attributes described in the MathML specification are necessary for presentation and content markup. Ideally, the MathML attributes should be an open-ended list so that users can add specific attributes for specific renderers. However, this cannot be done within the confines of a single XML DTD. Although it can be done using extensions of the standard DTD, some authors will wish to use non-standard attributes to take advantage of renderer-specific capabilities while remaining strictly in compliance with the standard DTD.

To allow this, the MathML 1.0 specification allowed the attribute other on all elements, for use as a hook to pass on renderer-specific information. In particular, it was intended as a hook for passing information to audio renderers, computer algebra systems, and for pattern matching in future macro/extension mechanisms. The motivation for this approach to the problem was historical, looking to PostScript, for example, where comments are widely used to pass information that is not part of PostScript.

In the mean time, however, the development of a general XML namespace mechanism has made the use of the other attribute obsolete. In MathML 2.0, the other attribute is deprecated in favor of the use of namespace prefixes to identify non-MathML attributes.

For example, in MathML 1.0, it was recommended that if additional information was used in a renderer-specific implementation for the maction element (Section 3.6.1 [Bind Action to Sub-Expression (maction)]), that information should be passed in using the other attribute:

<maction actiontype="highlight" other="color='#ff0000'"> expression </maction>

In MathML 2.0, a color attribute from another namespace would be used:

<body xmlns:my="http://www.myrenderer.com/MathML/extensions">
...
<maction actiontype="highlight" my:color="#ff0000"> expression </maction>
...
</body>

Note that the intent of allowing non-standard attributes is not to encourage software developers to use this as a loop-hole for circumventing the core conventions for MathML markup. We trust both authors and applications will use non-standard attributes judiciously.

7.3 Future Extensions

If MathML is to remain useful in the future, it is to be expected that MathML will need to be extended and revised in various ways. Some of these extensions can be easily foreseen; for example, as work on behavioral extensions to CSS proceeds, MathML will likely need to be extended as well.

Similarly, there are several kinds of functionality that are fairly obvious candidates for future MathML extensions. These include macros, style sheets, and perhaps a general facility for `labeled diagrams'. However, there will no doubt be other desirable extensions to MathML that will only emerge as MathML is widely used. For these extensions, the W3C Math working group relies on the extensible architecture of XML, and the common sense of the larger Web community.

7.3.1 Macros and Style Sheets

The development of style-sheet mechanisms for XML is part of the ongoing XML activity of the World Wide Web Consortium. Both XSL and CSS are working to incorporate greater support for mathematics.

In particular, XSL Transformations [XSLT] are likely to have a large impact on the future development of MathML. Macros has traditionally contributed greatly the usability and effectiveness of mathematics encodings. Further work developing applications of XSLT tailored specifically to MathML is clearly called for.

Some of the possible uses of macro capabilities for MathML include:

Abbreviation
One common use of macros is for abbreviation. Authors needing to repeat some complicated but constant notation can define a macro. This greatly facilitates hand authoring. Macros that allow for substitution of parameters facilitate such usage even further.
Extension of Content Markup
By defining macros for semantic objects, for example a binomial coefficient, or a Bessel function, one can in effect extend the content markup for MathML. Such a macro could include an explicit semantic binding, or such a binding could be easily added by an external applications. Narrowly defined disciplines should be able to easily introduce standardized content markup by using standard macro packages. For example, the OpenMath project could release macro packages for attaching OpenMath content markup.
Rendering and Style Control
Another basic way in which macros are often used is to provide a way of controlling style and rendering behavior by replacing high-level macro definitions. This is especially important for controlling the rendering behavior of MathML content tags in a context sensitive way. Such a macro capability is also necessary to provide a way of attaching renderings to user-defined XML extensions to the MathML core.
Accessibility
Reader-controlled style sheets are important in providing accessibility to MathML. For example, a reader listening to a voice renderer might, by default, hear a bit of MathML presentation markup read as `D sub x sup 2 of f'. Knowing the context to be multi-variable calculus, the reader may wish to use a style sheet or macro package that instructs the renderer to render this <msubsup> element as `second derivative with respect to x of f'.

7.3.2 XML Extensions to MathML

The set of elements and attributes specified in the MathML specification are necessary for rendering common mathematical expressions. It is recognized that not all mathematical notation is covered by this set of elements, that new notations are continually invented, and that sub-communities within mathematics often have specialized notations; and furthermore that the explicit extension of a standard is a necessarily slow and conservative process. This implies that the MathML standard could never explicitly cover all the presentational forms used by every sub-community of authors and readers of mathematics, much less encode all mathematical content.

In order to facilitate the use of MathML by the widest possible audience, and to enable its smooth evolution to encompass more notational forms and more mathematical content (perhaps eventually covered by explicit extensions to the standard), the set of tags and attributes is open-ended, in the sense described in this section.

MathML is described by an XML DTD, which necessarily limits the elements and attributes to those occurring in the DTD. Renderers desiring to accept non-standard elements or attributes, and authors desiring to include these in documents, should accept or produce documents that conform to an appropriately extended XML DTD that has the standard MathML DTD as a subset.

MathML-compliant renderers are allowed, but not required, to accept non-standard elements and attributes, and to render them in any way. If a renderer does not accept some or all non-standard tags, it is encouraged either to handle them as errors as described above for elements with the wrong number of arguments, or to render their arguments as if they were arguments to an mrow, in either case rendering all standard parts of the input in the normal way.

Overview: Mathematical Markup Language (MathML) Version 2.0
Previous: 6 Characters, Entities and Fonts
Next: 8 Document Object Model for MathML