HTML-Math
October 2, 1997
Patrick D.F. Ion and Robert R. Miner
HTML-Math
Mathematical Markup Language Working Draft
Robert R. Miner, Patrick D.F. Ion
Abstract
The HTML-Math Working Group recently released another revision of its Working Draft of MathML. The full text of this Working Draft is available at http://www.w3.org/TR/WD-math. This note should serve to point the way to the proposal outlined in the full Working Draft, and will describe a little of the history, current state, and future of the HTML-Math work.
Communicating mathematical and other technical notation is a challenging and important task. The intricate expression structure of mathematical notation reflects the internal logic of mathematics in a subtle way. Mathematical notation not only involves the use of a large extended symbol set, it relies on a rich collection of 2-dimensional layout schema, such as fractions, exponents, radicals, and matrices.
At present, HTML has limited utility for the transmission of scientific and technical material over the Web. At the same time, the demand is high for an effective means of electronic scientific communication. Increasingly researchers, scientists, engineers, educators, students, and technicians find themselves working at a distance and relying on electronic communication.
The HTML-Math Working Group [1] of the World Wide Web Consortium (W3C) has been working on the problem of getting mathematics onto the Web in a way that gives it a presence as a native form of text in that environment. The Working Group brings together a disparate group of interests and concerns united by their belief that mathematical discourse should be natural in the context of the Web, but differing in what they feel the content of mathematical discourse is.
The Working Group, after considerable discussion resulting from the need for members to get to know each others' points of view, decided upon a layered approach. First, a fundamental language, at least capable of expressing the complexities of the visual conventions of everyday mathematics, is to be developed, along with prototype implementations of renderers. The first renderers are, of course, for visual presentation, but the language design is intended to facilitate support of audio output.
Then, in a second phase, facilities for the extension of this basic language, such as macros, will be added, and a variety of input types explored. Unlike conventional printed rendering of mathematical notation, a uniform style has not been developed for inputting mathematical expressions into computers. There are already several established ways of input ranging from proprietary pick and place methods, through publicly accepted codings (such as those of TeX and eqn), to the sometimes arcane proprietary encodings of production typesetting and computer algebra systems.
The fundamental language, which came to be known as Mathematical Markup Language (MathML), will be put forward to the W3C as the Working Group's proposed recommendation in October 1997, after the group's next face-to-face meeting. By that time there will be at least two prototype renderers available.
During the rest of the presently chartered life of the Working Group, which runs until August, 1998, recommendations will be made on macros; on input methods; on further extensions to basic MathML; and on other implementations.
MathML Background
Efforts to define a specification for mathematics in HTML have been underway in the World Wide Web Consortium (W3C) for several years. Dave Raggett of the W3C made a proposal for Math extensions to HTML in 1994. That proposal was not ultimately incorporated into the HTML 3.2 revision, although it was mentioned in several published books on HTML. However, a panel discussion at the WWW4 Conference in Darmstadt, April 1995, demonstrated that there was clear interest in pursuing specifications for mathematics on the Web. A group was formed to discuss the problem further.
In the intervening two years, the W3C and the Math Working Group have both evolved substantially. The small informal math group has grown, and has been formally reconstituted as the W3C HTML-Math Working Group. The current Working Group is composed of experts from commercial publishers and software vendors, as well as from not-for-profit publishers and research organizations in both Europe and North America.
Now that the first phase of its work has almost ended, the Working Group is in the process of reaching out to a wider circle of experts by forming an Advisory Interest Group to encourage better feedback from the community of math users and to promote awareness of the progress it has achieved.
Early on in the Working Group's discussions, a few fundamental observations were noted:
- The potential audience for a mathematics specification for the Web is large, encompassing students and teachers at nearly all educational levels, professional researchers from many different scientific disciplines, software vendors, scientific publishers, etc.
- Current technologies for rendering mathematics on the Web (e.g., as in-line graphics or using complex HTML font and positioning commands) contain drawbacks serious enough to prevent their widespread use.
As the Working Group began its progress toward a more robust method of rendering mathematics in the Web environment, it also became evident that the motivation within the Group for defining a mathematics specification for the Web came primarily from two distinct sources:
- From publishers, who have an immediate need for displaying mathematical content on the Web. Publishers have legacy data marked up using TeX and SGML, and they presently have very limited options for displaying such documents on the Web. Publishing production using existing SGML compliant methods is too complicated when high quality typography is a goal.
- From software vendors, who wish to link their products for manipulating mathematical expressions to the mathematics in Web pages. This might be accomplished by cutting and pasting a mathematical expression from a Web page into the mathematical software, or by other more direct means.
The HTML-Math group, therefore, began its work by taking on the definition of a markup language that would be rich enough to capture all that the various interested parties needed for their intended processing. An attempt has been made to include concerns from the ICADD community, but this has not dominated the development. It is clear that just defining a relatively low-level markup language for mathematics does not make the appearance of mathematical formalism on the Web automatic. The authoring aspect of things has to be addressed too, and implementations using the language provided.
In just over a year since the HTML-Math WG's formal constitution, it will come up with a recommendation to be proposed to the W3C for MathML. MathML was written as compliant with the emergent XML standard; in its second year, the WG will extend that language by macro mechanisms, and will address the ease of use of alternative input syntaxes for different groups of users. These subjects are being discussed on the side thus far, since the main effort has been devoted to the development of the MathML proposal.
The MathML specification responds directly to the needs of both publishers, to ensure an effective language for a production environment, and those of the software industry, for a public portable standard. The HTML-Math WG has amongst its members people who can implement prototype engines that use MathML. There are already two early rendering prototypes:
- WebEQ, a Java development, from the Geometry Center at the University of Minnesota
- An inclusion in the Techexplorer product from the Interactive Document labs of IBM
In addition, there is a project planned by a consortium including scientific societies to produce a LaTeX to MathML conversion utility. Design Science, makers of the popular MathType tool and of the equation editor for Microsoft Word, have also announced that they will support MathML as an output option from MathType. Moreover, it is hoped--indeed expected--that both Mathematica and Maple, who are well represented on the HTML-Math WG, will soon be supporting MathML. Early examples of parsing have been demonstrated as aids to the WG discussions.
MathML has been prepared with a true SGML DTD, but this is not enough to capture fully the specifications required. The full language description, including examples of encouraged and deprecated usage, is much longer. MathML provides both Presentation elements to specify how mathematics should be rendered within a Web page, and Content elements that can be used to capture the meaning of the mathematics being encoded. The tag sets for these elements are further explained below.
The MathML Specification
MathML is an XML application that adheres to the current XML specification, which itself is a Working Draft under the W3C. XML, which stands for eXtensible Markup Language, is a proposed extension to HTML for delivering content on the Web. XML is designed to interoperate with current HTML specifications. See [2] for the full XML Working Draft.
The MathML Presentation Tags correspond to the constructors of traditional math notation, while also providing mechanisms to finetune the visual rendering of mathematics in a Web environment. MathML Presentation elements are at least as powerful as the markup of TeX in their ability to control the visual representation of math. MathML Presentation Tags can therefore be used to render sophisticated research-level mathematical notation on the Web.
The MathML Content Tags are intended to support the encoding of the underlying mathematical content of an expression. Mathematics encoded with Content Tags could, for example, be cut from a Web document and pasted into mathematical software (such as computer algebra systems) where the mathematics could be further manipulated. MathML Content Tags should be adequate for coding most formulas used in education through the U.S. high school level, and probably beyond that, through the first two years of U.S. college.
MathML Presentation and Content Tags may be mixed within the encoding of a single mathematical expression. By proper use of Presentation Tags alone, the mathematical structure of an expression can, in principle, be represented well enough to permit its manipulation by computer algebra systems which make appropriate assumptions about the meanings of individual symbols. When a potential for ambiguity exists, Content Tags may be employed to specify more precisely the intended mathematical meaning. An author may in fact choose to write at any level along a spectrum of specification, from purely using Presentation Tags to purely using Content Tags, according to how precisely the mathematical content of an expression needs to be specified.
Whether using Presentation Tags or Content Tags, MathML is designed to be mixed in with ordinary HTML commands, just, for example, as markup for frames mixes with HTML. However, MathML markup is necessarily verbose and is not optimized for hand entry. While some simple examples may be entered by hand, it is likely that most MathML markup will be generated by translators or filters that convert from other mathematical markup languages (e.g., TeX, some SGML specifications, etc.) into MathML, or by authoring tools that output MathML directly. Translators from SGML or TeX will probably choose to convert these formats into MathML Presentation Tags, while WYSIWYG authoring tools may choose to output either MathML Content Tags or MathML Presentation Tags.
The HTML-Math Working Group fully recognizes the need for simplified mathematical input syntaxes that are better suited for human entry, in addition to the more machine-friendly MathML notation. The Working Group's first task in its second year is to come up with support for other suitable input forms.
Embedding MathML in HTML Pages
Within an HTML document, MathML notation appears between the tags <MATH>...</MATH> (for in-line math) and <MATHDISP>...</MATHDISP> (for display math). In SGML parlance, the pair of tags <MATH> and </MATH> mark the extent of a MATH element whose content is the material between the tags. In a short note such as this all one can do is illustrate some of the basic principles involved in as complex a specification as that for MathML, which is over 100 standard printed pages long (not counting extensive appendices listing such things as default values and several hundred special entities). Example 1 illustrates MathML encoding using both Presentation Tags and Content Tags for the expression X^{2} + 4X +4 =0.
<MATH> <MROW> <MROW> <MSUP> <MI>x</MI> <MN>2</MN> </MSUP> <MO>+</MO> <MROW> <MN>4</MN> <MO>⁢</MO> <MI>x</MI> </MROW> <MO>+</MO> <MN>4</MN> </MROW> <MO>=</MO> <MN>0</MN> </MROW> </MATH>
On the outside we have the <MATH>...</MATH> that identify math markup to a browser, and immediately within that an <MROW>...</MROW> pair, delimiting a horizontal row construction containing a list of subexpressions. Here the first subexpression, the left-hand side of the quadratic equation, is itself an MROW element containing a superscript construction between <MSUP>...</MSUP> tags. There are two arguments that make up the content of an MSUP element, the base expression and its superscript. Here they are an identifier, explicitly tagged as such in <MI>x</MI> and an explicitly tagged number, <MN>2</MN>, which is to be a superscript.
After the superscript fragment comes a symbol explicitly tagged as a math operator <MO>+</MO>, and then another subexpression in an MROW element. The numerical coefficient <MN>4</MN> and the variable identifier <MI>x</MI> are separated by an operator, <MO>⁢</MO>, whose content is a special entity, ⁢, which will not be printed but is useful as a clue to audio rendering and for fine typesetting. The left-hand side is closed with another operator, <MO>+</MO>, and a final number, <MN>4 </MN>.
The outer MROW finishes with the equality operator <MO>=</MO> and a number <MN>0</MN>.
This description makes obvious how much we save with ordinary math notation over the description of equations in prose. It should also bring out how much of notation's interpretation we draw from the mental contexts we have acquired from long years of schooling. In fact the notation even for equations as simple as this one was not always the modern one. The pedantic completeness of the tagging serves the machinery we want to work with, which requires complete clarity of description in order to do a high-quality job of rendering.
There is a vocabulary of about 30 Presentation Tags covering all the layout types that are presently common in math. The elements have many special attributes permitting fine control of rendering. For simplicity, none of these attributes was mentioned above.
In Example 2, we consider the markup of the same simple equation using Content tagging. The intent of MathML Content markup is to encode mathematical expressions in such a way that they retain a clear, unambiguous meaning that can be dependably evaluated. It will be noted that this markup emphasizes the tree structure of mathematical notation. There about 50 different Content tags.
<MATH> <EXPR> <EXPR> <EXPR> <MCI>x</MCI> <POWER/> <MCN>2</MCN> </EXPR> <PLUS/> <EXPR> <MCN>4</MCN> <TIMES/> <MCI>x</MCI> </EXPR> <PLUS/> <MCN>4</MCN> </EXPR> <E/> <MCN>0</MCN> </EXPR> </MATH>
Within the outer tags of the MATH element we find the <EXPR>...</EXPR> pair, which serve to group the contents as a mathematical unit. The MROW element, by contrast, connotes no assumption about the mathematical significance of its contents; it just specifies a horizontal row type of layout. Subexpressions are similarly marked with <EXPR>...</EXPR> pairs. The first subunit here is the square term, specified here by an expression containing the identifier <MCI>x</MCI> and the numerical exponent <MCN>2</MCN>, separated by the tag <POWER/>, indicating the algebraic type of the expression.
Note
The POWER element is (in a technical sense) empty since it has no corresponding end tag (it already has an ending / in its name) and contains no data. It is, however, a marker full of significance.
Another change is to the tags <MCI> and <MCN> for identifiers and numbers, respectively. The attributes which may be added to these will be able to carry more semantic information over to other math processing platforms than the information about presentation that goes with the presentational <MI> and <MN> tags.
The rest of the equation is marked up similarly using the analogous non-container elements with the tags <PLUS/> <TIMES/>, and <E/> within EXPR containers.
Note
There is a difference between the printable character entities and their corresponding Content tags. For each of the Content tags there has also to be specified a standard presentation form which will normally be used for display. Though there are facilities for over-riding these defaults, this discussion is not within the scope of this article.
The additional top-level HTML tags <F>...</F> and <FD>...</FD> are being reserved for alternate mathematical input notation (i.e., notations other than MathML). <F>...</F> and <FD>...</FD> are mnemonics for "formula" and "formula display," in analogy to the <MATH> and <MATHDISP> tags. Until Web browsers provide a native implementation of MathML, rendering plug-ins will have to be invoked to do the rendering job. The dialect of math input chosen will be conveyed through a MIME-type attribute. For example, a plug-in capable of interpreting some restricted form of TeX, arbitrarily called pTeX here, might be invoked as follows:
<FD TYPE="application/x-ptex">2x^2+3y=z</FD>
The rendering plug-in would convert the TeX-style syntax to an internal representation of MathML, which would be passed to a MathML rendering engine. MathML compliance requires that the program can be queried for a corresponding MathML markup.
The examples mentioned above are to be used in this fashion. Both IBM's techexplorer [3] (a plug-in) and WebEQ [4] (a Java applet) from the Geometry Center at the University of Minnesota are beginning to support MathML. Both are freely available.
MathML Timetable
The HTML-Math Working Group issued the initial MathML Working Draft on May 15, 1997 on schedule, according to its publicly announced timetable. Revisions have been taking place through the summer and fall of 1997. The Working Group has the goal of promoting the Working Draft to a W3C Proposed Recommendation in October 1997.
After the MathML specification is put forward for ratification by the W3C, the HTML-Math Working Group will turn its attention to several other matters, such as simplified input syntaxes suitable for hand editing elementary mathematical notation to be put inside the <F> and <FD> tags, and macro mechanisms for MathML itself. A second Working Draft covering these and other considerations extending MathML to a workable solution for HTML-Math, is planned for May 1998. Implementation prototypes will continue to appear along with the development of the specifications.
- http://www.w3.org/Math/
- www.w3.org/TR/WD-xml.html
- http://www.ics.raleigh.ibm.com/ics/techexp.htm
- http://www.geom.umn.edu/software/WebEQ
About the Authors
- Robert R. Miner
- The Geometry Center
- 400 Lind Hall 207 Church Street S.E.
- Minneapolis, MN 55455
- rminer@geom.umn.edu
Robert Miner, W3C HTML-Math Working Group co-chair, has been a technical researcher since 1995 at the Geometry Center at the University of Minnesota, a National Science Foundation Science and Technology Center. Prior to that, Miner was a memeber of the mathematics faculty at the University of Oklahoma (1991-95) after receiving his Ph.D. from the University of Maryland. His current research interests focus on the uses of electronic media in scientific research and teaching. His primary mathematical interest is differential geometry.
- Patrick D.F. Ion
- Mathematical Reviews
- P. O. Box 8604
- 416 Fourth Street
- Ann Arbor, MI 48107-8604
- ion@math.ams.org
Patrick Ion, W3C HTML-Math Working Group co-chair, has been a mathematician Associate Editor at Mathematical Reviews for the American Mathematical Society since 1980. Previous positions in Heidelberg (1974-80), Kyoto (1972-74), Groningen, and London, England followed a Ph.D. from Imperial College, London. His present interests include the communication of mathematics, the preservation and use of its permanent record, quantum probability and quantum groups, special functions and non-commutative geometry.