Web Technologies II Tutorial MathML

Revision History
Revision 0.1 April 5, 2005

1. What is MathML ?
2. Presentation and Content Encoding
3. Basic MathML Presentation Elements
4. Expression Trees
5. Layout Boxes
6. Basic MathML Content Elements
7. Containers and Operators
8. MathML, XML and XHTML
9. Incorporating MathML in the Web Page
10. Summary of Presentation Elements (MathML 2.0)
11. A simple example
12. More Examples
13. Some tools which have support for MathML

1. What is MathML ?

The Mathematical Markup Language (MathML) provides the structure of mathematical expressions in the form capable to display and utilize them over the Internet. It was first as a recommendation in 1998 by the W3C Math Working Group which described MathML as: "an XML application for describing mathematical notation and capturing both its structure and content." The objective of MathML is to make possible to utilize the field of mathematics for scientific use over the Internet, similar to the use of HTML and its implementation of text functionalities.

2. Presentation and Content Encoding

MathML provides two styles of encoding: content encoding and presentation encoding. Content encoding tries to "catch" the meaning of mathematical expression presented with MathML, being not concerned with the notation. However, presentation encoding put the emphasis on the notation, so looking at the mathematical expression, the user can understand the meaning. Provided by both types of encodings, the user can decide which encoding is more suitable for a performed task.

Anatomy of a MathML expression formulates some 30 MathML presentation elements that accept about 50 attributes. The elements encode the notation of mathematical expressions. For instance, msqrt element forms square roots. Attributes provide additional optional information about the element. For instance, msqrt element may have the attribute with the name linethickness and the value 2.

Presentation elements control the way how mathematical expressions appear in browsers. Since MathML performs also as a mark-up language, it is quite easy to obtain the mathematical expression to look correct, without paying attention on the correct mathematical structure behind the presentation in the browser.

Consequently, in computer algebra software which needs to understand the meaning of a mathematical expression, rather than just its appearance, ask for precisely encoded MathML expression.

For facilitating precisely encoded mathematical expression the content encoding is proposed. For content encoding, there exists about 100 elements, with a number of attributes. Many of these 100 elements belong to the families, such as relation family, and represent mathematical operations and functions, such as plus, sin or vector. As a consequence of the use of content encoding, it is more difficult to directly control how a mathematical expression will be displayed.

3. Basic MathML Presentation Elements

The most common MathML presentation elements are the token elements mi, mn and mo, which are the only elements that directly contain character data, so each single identifier, operator, and number that appears in the mathematical expression has to be enclosed in the following MathML presentation token elements:

  • <mi> </mi> element indicates that its content, such as variable, function, name or constant, is to be displayed as an identifier. Its attributes include font properties such as fontweight, fontfamily and fontstyle as well as general properties like color.

  • <mn> </mn> element indicates that its content is to be displayed as numbers. Its attributes are the same as for mi

  • <mo> </mo> element indicates that its content, such as summation, fence or accent, is to be displayed as operators. Since it is quite complicated to display operators, therefore the MathML software is supposed to include so-called the "operator dictionary", with information how different operators are rendered usually. Additionally, attributes of operators include properties like lspace, rspace, stretchy, and movablelimits that assist in controlling of displaying the operators.

4. Expression Trees

Studying common mathematical expression, the user can realize that it is usually arranged by a row, subscript and superscripts, fractions, and some few more notations. These notational patterns or layout schemata appear quite often nested inside one another, such as fraction within a square root, and they usually obtain a number of parameters which depend on the context of the mathematical expression. The main issue is that even complicated mathematical expressions are created from a number of simple layout schemata.

Before basic MathML presentation elements, which mark up individual characters and symbols, encode the mathematical expression from the nested layout schemata, let us introduce the most common layout schema, and that is the mrow element.

  • <mrow> child1 ... </mrow> element can include any number of child elements, displayed aligned along the baseline in a horizontal row. Besides positioning the layout schemata in a row, the mrow is quite practical for grouping together elements in a single unit.

  • <mfrac> numerator denominator </mfrac> element expects exactly two children, the numerator is to be positioned as the numerator of a fraction, and the second is the denominator.

  • <msqrt> child1 ... </msqrt> element accepts any number of children, and displays them under a radical sign.

  • <mroot> base index</mroot> element is quite identical to the msqrt element, except a second child that is displayed above the radical in the location of the n in an n-th root.

  • <mfenced> child ... </mfenced> element is similar to the mrow, except that it displays child elements enclosed in parentheses. Using attributes is possible to set the beginning and ending delimiter character, as well as internal separator characters such as commas.

  • <mstyle> child ... </mstyle> element is also similar to the mrow except that mstyle element can be used to set any MathML attribute.

Example 1. First MathML code

The best way to understand how the mathematical expression is displayed with MathML using presentation elements and layout schemata is to look at an example:

(x+y)^2

The decomposition process of this mathematical expression breaks into a (x+y)"base", and a single character 2 as a "script". The base further breaks into a sequence of two characters (x and y) and three symbols ( (, + and )). The MathML presentation encoding of this mathematical expression is:

	<msup> // Expression with superscript
	 <mfenced> // "base" expression (x+y) 
	  <mi>x</mi> // surrounded by parentheses 
	  <mo>+</mo>
	  <mi>y</mi>
	 </mfenced>
	 <mn>2</mn> // "script" expression 2
	</msup>
	

Observing the above presentation encoding of the MathML example, it is common to think abstractive about MathML expressions as tree structures. Each node in the tree is related to a particular layout schema, and its child nodes correspond to its sub-expressions. This abstract expression tree also describes how the MathML tags should be nested to encode the expression, and how typesetting "boxes" should be nested on the screen to display the notation, such as in the figure bellow:

tree structure of mathematical expressions

5. Layout Boxes

MathML presentation is based on the concept of layout boxes, which are a kind of abstract bounding boxes for a specific type of notation of the mathematical expression. Layout boxes are differentiated into categories based on their contents. Simple layout boxes just contain individual characters, and their dimensions depend only on the font being used, whether complex layout boxes arrange their "child boxes" according to certain rule. For instance, a fence box arranges five child boxes to be horizontally stacked with one another, such as in the figure above.

Consequently, MathML presentation elements present abstract typesetting layout boxes. This abstraction is related to the notion of the layout schemata such as in the figure above. Each presentation element is related to the layout schemata that describes how its children schemata are logically related to each other. A browser renders these logical relations into specific algorithm for physically displaying mathematical expressions on the screen. The attributes of each presentation element specify parameters to the display algorithm.

6. Basic MathML Content Elements

In order to capture the idea of applying an operator to arguments computer languages typically employ either prefix, infix, or postfix notation. MathML content encoding uses prefix notation, which is related more closely to natural language construction like "f of y" and "subtract 1 from 2". A nice effect of using prefix notation is that mathematical expressions present in MathML do not longer need parentheses. In MathML, the order of operations is separated from the prefix notation, so parentheses are not necessary.

The content encoding (markup) for the same example performed already with presentation encoding (x+y)^2 is as follows:

	<apply> //application of function to its argument
	  <power/> 
	   <apply>
	     <plus/>
	  <ci>x</ci>
	    <ci>y</ci>
	   </apply>
	<cn>2</cn>
	</apply>
	

Content encoding utilizes the same kind of syntax as presentation encoding. Each layout schemata are related to a pair of start and end tags. The encoding for sub-expressions are enclosed between the start and end tags, and in which order they appear determines what function they have.

The example from above introduces the most fundamental element for content encoding and that is apply element, which group operators with arguments. The apply element expects an operator schema as its first child, further interpreting the remaining children schemata as the arguments of that operator.

The example also illustrates the use of content encoding's token elements:

  • ci that which represent identifiers and

  • cn that represent identifiers and numbers

Since functions and operators are represented by elements, no "co" element is needed.

In MathML, an identifier can by every term or label. For content encoding, this terms are usually things such as the names of variables and function, such as plus or divide. An attribute type related to the element ci can be used to specify the type of object which the identifier represents.

The cn element is mostly intended to encoding integers, rational, real or complex numbers. Any kind of character data is permitted in the cn element, so it is possible to encode expressions such as <cn> xii </cn>. The attribute type specifies what kind of number the cn element encodes. In the same way, the attribute base specifies that the encoding is to a base other than 10.

Token elements ci and cn represent identifiers and numbers. The identifier can be referred to any object in mathematical expression, but in the case of common objects such as vectors, to directly encode the structure of the object would be more elegant solution. Therefore, new elements are needed to represent other kinds of mathematical objects and data types.

7. Containers and Operators

MathML uses container elements to represent basic mathematical objects and data types, such as sets, intervals, vectors, and matrices that are created of other data types:

  • <set> [elt1 elt2 ... | condition] </set> element constructs a mathematical set whose elements are specified by the set element's children.

  • <interval> pt1 pt2 </interval> element specifies intervals in the real line.

  • <vector> elt1 elt2 ... </vector> element constructs a vector whose components are given in order by its children.

  • <matrix> row1 row2 ... </matrix> element expects any number of children, but they all have to be matrixrow elements. Children of the matrixrow elements represent the individual entries in the matrix. All matrix rows are supposed to have the same number of elements.

There are about 90 empty operator elements in the content encoding that represent commonly-used functions and operators. They are grouped into broad categories such as: arithmetic, algebra, logic, calculus, set theory, and so on. There is actually no difference between functions and operators, since MathML utilizes the prefix notation and from the point of view of MathML, they are both operators which may be applied to arguments.

Content encoding has two weaknesses:

  • it does not include everything what might be needed

  • it does not always display the way is preferred

Therefore, the semantics element is included to deal with both of these issues.

Using the content encoding, a certain probability that rendering of the mathematical expression displayed in a browser will not be successful.

For instance, the intention to display prime notation for derivatives, such as f'(x) can be displayed (rendered) as df/dx. To resolve this problem, the semantics element is utilized to specify both the presentation encoding and content encoding observed mathematical expression separately:

	<semantics>     // Semantics element
	<mrow>         // Presentation encoding
	    <msup> 
	     <mi>f</mi> 
	     <mi>'</mi> 
	    </msup>
	    <mi>(</mi> <mi>x</mi> <mi>)</mi>
	</mrow>
	   <apply> // Content encoding
	    <diff/>
	     <ci>f</ci>
	    <bvar><ci>x</ci></bvar>
	   </apply>
	</semantics>
	

Now that the MathML framework and its syntax are presented, further step is to publicize MathML mathematical expressions using Internet browsers.

8. MathML, XML and XHTML

MathML implements a syntax quite similar to HTML syntax. However, since the nature of the subject, the ratio of tags to text in MathML is much higher than in HTML, but the syntax for start tag and end tags, such as <table> and </table>, and the use of attributes, such as <table width="85%">, are the same.

On the other side, differences follow the fact that HTML syntax is based on SGML, while MathML follows the rules of XML. Both SGML and XML are markup languages like HTML and MathML too.

MathML is an XML application while the XML is generally supported in Internet-related software. By mapping MathML as the XML application, it is possible to use standard browsers to implement rendering of MathML mathematical expressions. Disadvantage of XML syntax is that is boring and prone to errors when it is written manually, the same situation as with HTML syntax. However, with web-based editors available on the market, it is not necessary to manually edit MathML (see for example Amaya or the full page of tools from W3C Math Working Group ).

Most elements in MathML have two kinds of elements, start and end tags, in the form: <element_name> </element_name> These elements can have other data in-between, such as text, characters, or other MathML elements.

The second kind of MathML element is an empty element in the form: <element_name/> All MathML elements include in their syntax a number of attributes, which specify additional optional information about the element. Each attribute has a name and a value and it goes in the start tag between the element name and the final />: <element_name attrib_name1='val1' attrib_name2='val2' ... >

Attribute values, such as 'val1' and 'val2' have to be always enclosed in quotes. In XML, both quotes, double or single, are allowed.

Example 2. External elements and token elements

The final point regarding the MathML syntax is related to text and symbol characters needed for mathematical expressions. Firstly, characters and symbols can only appear inside MathML token elements, such as for a+b example:

	<mrow>
	     <mi>a</mi>
	     <mo>+</mo>
	     <mi>b</mi>
	</mrow>
	

The external mrow element is only expected to connect its start and end tags as well as to include other MathML elements in its content. Contrary, the mi and mo elements are token elements, and their contents include characters and symbols. Token elements can contain plain text characters, which display themselves, or special entity references, which represent extended characters, such as Greek letters.

The complete list of MathML entity references is long and comprehensive with more than 1,800 symbols.

9. Incorporating MathML in the Web Page

To generate the rendering of MathML mathematical expression, Internet browsers need special declarations in the web page.

There are two solutions how the browsers can resolve what kind of data needs to be displayed. First solution includes local files that indicate their type with a filename extension, since the data that arrive from the Internet does not have a filename. Therefore, web servers include extra data about what kind of file is being sent to the browsers. This extra data is called a MIME type. Three kinds of files are related to MathML rendering in browser:

  • XML files, which includes XHTML files. Mozila/Netscape 7 only renders MathML in this kind of file.

  • HTML files. Internet Explorer renders only MathML in HTML files and renders XML only with the support of add-on software, such as MathPlayer.

  • XSL files. These are also XML files, but they usually end .xsl instead of .xml

As the outcome, for sufficient MathML rendering in Mozila/Netscape is XML file required, in addition to Internet Explorer which requires HTML file. To satisfy MathML rendering for both major browsers, XHTML document is needed to be created and the MIME type to be added.

Second solution regarding MathML rendering is to place a special declaration at the beginning of an HTML or XML file that defines what kind of markup is in the file. This extra data is called a DOCTYPE. It points to a DTD file, which reside on W3C.org web site, defining the syntax of the markup in the file. Typical DOCTYPE declaration looks as follows:

	<!DOCTYPE html PUBLIC
	"-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
	"http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd"
	[ <!ENTITY MathML http://www.w3.org/1998/Math/MathML"> ]>
	

Mozilla/Netscape requires a DOCTYPE, but does not actually explore the DTD to which it points. Instead the DTD has to match one of a few predefined locations. On the other side, Internet Explorer does not require a DOCTYPE, but it does download the DTD and use it if there is one. As the outcome, for sufficient MathML rendering in both major browsers, the best practice is to put DOCTYPE declaration in the XHTML document. However, complexities take place when two kind of XML markup are combined together, such as the case when MathML mathematical expressions are implemented in XHTML file. As the solution namespaces are to be used. They can be indicated by using an xmlns attribute on an selected element, or by adding a prefix to element names.

Two additional declarations are required to generate rendering of MathML mathematical expressions in Internet Explorer:

  • <object> element defines what piece of software is to load

  • Processing instruction (PI) assigns software components (plug-ins) to render MathML from a particular namespace.

Windows uses a long string of digits and letters called a class id to identify software components. The object tag uses an attribute to specify a class id, such as:

	<OBJECT ID="MathML_behave" CLASSID="clsid:32F66A20-7614-11D4-BD11-00104BD3F987">
	</OBJECT>
	

On the other side, processing instructions with different attributes specify the ID of the object:

	<?import namespace="m" implementation="#MathML_behave" ?>
	

Putting all together, meaning to create a document with MathML mathematical expression, which is displayed in both major browsers Internet Explorer and Netscape, it is required to:

  • write XHTML,

  • Include a DOCTYPE,

  • Include an OBJECT and PI,

  • Include a namespace declaration,

  • Use namespace prefixes on the MathML.

Getting MathML in a document to render in both major browsers, Internet Explorer and Mozilla/Netscape is tricky. A simpler, alternative method which also deals with the MIME types is to use Extensible Stylesheet Language (XSL) set of templates for transforming an input document into an output document. The W3C Math WG has created a Universal MathML Stylesheet which can:

  • Detect which browser is running and generate the output either XML or HTML file accordingly,

  • Detect what software add-ons are installed and generate the output using the necessary Object and PI declarations

  • Convert content markup (encoding) to presentation markup encoding).

The MathML stylesheet looks as follows:

	<?xml-stylesheet type="text/xsl" href="http://www.w3.org/Math/XSL/MathML.xsl" ?>
	

In order to use the Universal MathML Stylesheet to create a document with MathML mathematical expression, it is required to:

  • Include the stylesheet,

  • Write XHTML,

  • Use namespaces to indicate MathML.

10. Summary of Presentation Elements (MathML 2.0)

Token Elements:

Tag Explanation
<mi> identifier
<mn> number
<mo> operator, fence, or separator
<mtext> text
<mspace/> space
<ms> string literal
<mglyph> for using non-standard character glyphs

General Layout:

Tag Explanation
<mrow> group any number of subexpressions horizontally
<mfrac> form a fraction from two subexpressions
<msqrt> form a square root sign (radical without an index)
<mroot> form a radical with specified index
<mstyle> style change
<merror> enclose a syntax error message from a preprocessor
<mpadded> adjust space around content
<mphantom> make content invisible but preserve its size
<mfenced> surround content with a pair of fences
<menclose> enclose content with a stretching symbol such as a long division sign

Scripts and Limits:

Tag Explanation
<msub> attach a subscript to a base
<msup> attach a superscript to a base
<msubsup> attach a subscript-superscript pair to a base
<munder> attach an underscript to a base
<mover> attach an overscript to a base
<munderover> attach an underscript-overscript pair to a base
<mmultiscripts> attach prescripts and tensor indices to a base

Tables:

Tag Explanation
<mtable> table or matrix
<mtr> row in a table or matrix
<mtd> one entry in a table or matrix
<maligngroup/> alignment group marker
<malignmark/> alignment point marker
<mlabeledtr/> row in a table or matrix with a label or equation number

Actions:

Tag Explanation
<maction> bind actions to a subexpression

11. A simple example

This is the code listing:

	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/html">
	<head>
	 <title>Some MathML</title>
	</head>
	<body> <font face="verdana" size="2">
	 <p>
	  <b>E</b><sup>zp</sup>(<b>r</b>,t) =
	   <font size="4"><b>&sum;</b></font><sub>&lambda;=1,2</sub>
	   <font size="4"><b>&int;</b></font>
	   d<sup>3</sup>k (h&omega;/4&pi;<sup>3</sup>)<sup>1/2</sup>
	   <font size="3"><b>&epsilon;</b></font> (<b>k</b>,&lambda;)cos
	   <font size="3">[</font><b>k</b>&middot;<b>r</b> - &omega;t - &theta;
	   (<b>k</b>,&lambda;)
	   <font size="3">]</font>
	 </p>
	 <p>
	  <b>B</b><sup>zp</sup>(<b>r</b>,t) =
	  <font size="4"><b>&sum;</b></font><sub>&lambda;=1,2</sub>
	  <font size="4"><b>&int;</b></font>
	  d<sup>3</sup>k
	  (h&omega;/4&pi;<sup>3</sup>)<sup>1/2</sup>
	  <font size="3">[</font><b>k</b> <b>&times;</b> <font size="3"><b>&epsilon;</b></font>
	  (<b>k</b>,&lambda;)<font size="3">]</font>/k
	  cos<font size="3">[</font><b>k</b>&middot;<b>r</b> - &omega;t - &theta;
	  (<b>k</b>,&lambda;)<font size="3">]</font>
	 </p>
	</body>
	</html>
	

And your browser will rendering:

some MathML...

12. More Examples

The examples below can be well rendered if you will use Amaya.

Example 3. 

	<math xmlns="http://www.w3.org/1998/Math/MathML">
	  <mfenced open="{" close="}">
	  <mrow>
	  <mrow>
	<mfrac>
	<mi>a</mi>
	<mi>b</mi>
	</mfrac>
	  </mrow>
	    <mo>|</mo>
	  <mrow>
	<mi>c</mi>
	<mo>&InvisibleTimes;</mo>
	<mi>d</mi>
	   </mrow>
	  </mrow>
	  </mfenced>
	</math>
	

Example 4. 

	<math xmlns="http://www.w3.org/1998/Math/MathML">
	  <mrow>
	    <mfenced>
	      <mrow>
	<msup>
	<mn>1</mn><mn>2</mn>
	</msup>
	        <mo>+</mo>
	   <mo>...</mo>
	   <mo>+</mo>
	        <msup>
	<mi>n</mi>
	<mn>2</mn>
	         </msup>
	      </mrow>
	    </mfenced>
	    <mo>-</mo>
	    <mfenced>      
	<mrow>
	  <mn>1</mn>
	  <mo>+</mo>
	  <mo>...</mo>
	  <mo>+</mo>     
	  <mi>n</mi>
	      </mrow>
	    </mfenced>
	  </mrow>
	  <mo>=</mo>
	  <mrow>
	    <mfrac>
	      <mrow>
	        <mi>n</mi>
	        <mo>&InvisibleTimes;</mo>
	        <mfenced>
	          <mrow>
	            <mi>n</mi>
	            <mo>+</mo>
	            <mn>1</mn>
	          </mrow>
	        </mfenced>
	        <mo>&InvisibleTimes;</mo>
	        <mfenced>
	          <mrow>
	            <mrow>
	              <mn>2</mn>
	              <mo>&InvisibleTimes;</mo>
	              <mi>n</mi>
	            </mrow>
	            <mo>+</mo>
	            <mn>1</mn>
	          </mrow>
	        </mfenced>
	      </mrow>
	      <mn>6</mn>
	    </mfrac>
	    <mo>-</mo>
	    <mfrac>
	      <mrow>
	        <mi>n</mi>
	        <mo>&InvisibleTimes;</mo>
	        <mfenced>
	          <mrow>
	            <mi>n</mi>
	            <mo>+</mo>
	            <mn>1</mn>
	          </mrow>
	        </mfenced>
	      </mrow>
	      <mn>2</mn>
	    </mfrac>   
	    <mo>=</mo>
	    <mfrac>
	      <mrow>
	        <msup>
	          <mi>n</mi>
	          <mn>3</mn>
	        </msup>
	        <mo>-</mo>
	        <mi>n</mi>
	      </mrow>
	      <mn>3</mn>
	    </mfrac>
	  </mrow>
	</math>
	

Example 5. 

	<math xmlns="http://www.w3.org/1998/Math/MathML">
	  <mrow>
	    <msub>
	      <mi>w</mi>
	      <mn>8</mn>
	    </msub>
	    <mo>=</mo>
	    <mrow>
	      <mi>cos</mi>
	      <mo>&ApplyFunction;</mo>
	      <mfrac>
	        <mrow>
	          <mi>&pi;</mi>
	        </mrow>
	        <mn>4</mn>
	      </mfrac>
	      <mo>+</mo>
	      <mi>i</mi>
	      <mo>&InvisibleTimes;</mo>
	      <mi>sin</mi>
	      <mo>&ApplyFunction;</mo>
	      <mfrac>
	        <mrow>
	          <mi>&pi;</mi>
	        </mrow>
	        <mn>4</mn>
	      </mfrac>
	    </mrow>
	    <mo>=</mo>
	    <mfrac>
	      <mrow>
	        <mn>1</mn>
	        <mo>+</mo>
	        <mi>i</mi>
	      </mrow>
	      <msqrt>
	        <mn>2</mn>
	      </msqrt>
	    </mfrac>
	  </mrow>
	</math>
	

Example 6. 

	<math xmlns="http://www.w3.org/1998/Math/MathML">
	  <mrow>
	    <msup>
	      <mrow>
	        <mo>(</mo>
	        <mtable>
	          <mtr>
	            <mtd>
	              <mn>2</mn>
	              <mo>+</mo>
	              <mi>i</mi>
	            </mtd>
	            <mtd>
	              <mn>3</mn>
	              <mspace width="1ex"/>
	              <mo>&InvisibleTimes;</mo>
	              <mi>i</mi>
	            </mtd>
	          </mtr>
	          <mtr>
	            <mtd>
	              <mn>4</mn>
	              <mo>-</mo>
	              <mi>i</mi>
	            </mtd>
	            <mtd>
	              <mn>5</mn>
	            </mtd>
	          </mtr>
	          <mtr>
	            <mtd>
	              <mn>0</mn>
	            </mtd>
	            <mtd>
	              <mn>0</mn>
	            </mtd>
	          </mtr>
	        </mtable>
	        <mo fence="true">)</mo>
	      </mrow>
	      <mi >H</mi>
	    </msup>
	    <mo>=</mo>
	    <mrow>
	      <mo>(</mo>
	      <mtable>
	        <mtr>
	          <mtd>
	            <mn>2</mn>
	            <mo>-</mo>
	            <mi>i</mi>
	          </mtd>
	          <mtd>
	            <mn>4</mn>
	            <mo>+</mo>
	            <mi>i</mi>
	          </mtd>
	          <mtd>
	            <mn>0</mn>
	          </mtd>
	        </mtr>
	        <mtr>
	          <mtd>
	            <mo>-</mo>
	            <mn>3</mn>
	            <mo>&InvisibleTimes;</mo>
	            <mi>i</mi>
	          </mtd>
	          <mtd>
	            <mn>5</mn>
	          </mtd>
	          <mtd>
	            <mn>0</mn>
	          </mtd>
	        </mtr>
	      </mtable>
	      <mo fence="true">)</mo>
	    </mrow>
	  </mrow>
	</math>
	

Example 7. 

	<math xmlns="http://www.w3.org/1998/Math/MathML">
	  <mrow>
	    <msub>
	      <mrow>
	        <mi>&lambda;</mi>
	      </mrow>
	      <mi>j</mi>
	    </msub>
	    <mo>=</mo>
	    <munder>
	      <mi>min</mi>
	      <msub>
	        <mi>S</mi>
	        <mi>j</mi>
	      </msub>
	    </munder>
	    <mrow>
	      <mo symmetric="true">[</mo>
	      <munder>
	        <mi>max</mi>
	        <mrow>
	          <mi>x</mi>
	          <mo>in</mo>
	          <msub>
	            <mi>S</mi>
	            <mi>j</mi>
	          </msub>
	        </mrow>
	      </munder>
	      <mo>&ApplyFunction;</mo>
	      <mrow>
	        <mi>R</mi>
	        <mo>&ApplyFunction;</mo>
	        <mrow>
	          <mfenced>
	          <mi>x</mi>
	          </mfenced>
	        </mrow>
	      </mrow>
	      <mo symmetric="true">]</mo>
	    </mrow>
	  </mrow>
	</math>
	

Example 8. 

	<math xmlns="http://www.w3.org/1998/Math/MathML">
	  <mrow>
	    <msubsup>
	      <mo>&int;</mo>
	      <mrow>
	        <mo>-</mo>
	        <mn>1</mn>
	      </mrow>
	      <mi>x</mi>
	    </msubsup>
	    <mfrac>
	      <mrow>
	        <mi>d</mi>
	        <mi>&xi;</mi>
	      </mrow>
	      <mi>&xi;</mi>
	    </mfrac>
	    <mi>&thinsp;</mi>
	    <mo>=</mo>
	    <mi>&thinsp;</mi>
	    <mrow>
	      <msubsup>
	        <mo>&int;</mo>
	        <mn>1</mn>
	        <mrow>
	          <mo>-</mo>
	          <mi>x</mi>
	        </mrow>
	      </msubsup>
	      <mfrac>
	        <mrow>
	          <mi>d</mi>
	          <mi>&xi;</mi>
	        </mrow>
	        <mi>&xi;</mi>
	      </mfrac>
	    </mrow>
	    <mi>&thinsp;</mi>
	    <mo>=</mo>
	    <mi>&thinsp;</mi>
	    <mrow>
	      <msubsup>
	        <mo>&int;</mo>
	        <mn>1</mn>
	        <mrow>
	          <mo>|</mo>
	          <mi>x</mi>
	          <mo>|</mo>
	        </mrow>
	      </msubsup>
	      <mfrac>
	        <mrow>
	          <mi>d</mi>
	          <mi>&xi;</mi>
	        </mrow>
	        <mi>&xi;</mi>
	      </mfrac>
	      <mi>&thinsp;</mi>
	      <mo>=</mo>
	      <mi>&thinsp;</mi>
	      <mi>l</mi>
	      <mi>o</mi>
	      <mi>g</mi>
	      <mrow>
	        <mo>|</mo>
	        <mi>x</mi>
	        <mo>|</mo>
	      </mrow>
	    </mrow>
	  </mrow>
	</math>
	

Example 9. 

	<math xmlns="http://www.w3.org/1998/Math/MathML">
	  <mrow>
	    <mi>y</mi>
	    <mo>=</mo>
	    <mfrac>
	      <mroot>
	        <mrow>
	          <mo>(</mo>
	          <mn>7</mn>
	          <msup>
	            <mi>x</mi>
	            <mn>2</mn>
	          </msup>
	          <mo>+</mo>
	          <mn>1</mn>
	          <mo>)</mo>
	        </mrow>
	        <mn>3</mn>
	      </mroot>
	      <mrow>
	        <mroot>
	          <mrow>
	            <mo>(</mo>
	            <mi>x</mi>
	            <mo>-</mo>
	            <mn>2</mn>
	            <mo>)</mo>
	          </mrow>
	          <mn>4</mn>
	        </mroot>
	        <msqrt>
	          <mrow>
	            <mo>(</mo>
	            <msup>
	              <mi>x</mi>
	              <mn>4</mn>
	            </msup>
	            <mo>+</mo>
	            <mn>1</mn>
	            <mo>)</mo>
	          </mrow>
	        </msqrt>
	      </mrow>
	    </mfrac>
	    <mi>&thinsp;</mi>
	  </mrow>
	</math>
	

Example 10. 

	<math xmlns="http://www.w3.org/1998/Math/MathML" mode="display">
	    <mrow>
	        <mi>f</mi>
	        <mrow>
	            <mo>(</mo>
	            <mi>z</mi>
	            <mo>)</mo>
	        </mrow>
	        <mo>=</mo> 
	        <mover>
	          <munder>
	            <mo>&Sum;</mo>
	            <mrow>
	                <mi>n</mi>
	                <mo>=</mo>
	                <mn>0</mn>
	            </mrow>
	          </munder>
	          <mrow>
	              <mi>&infin;</mi>
	          </mrow> 
	        </mover>
	        <mfrac> 
	            <mrow> 
	                <msup>
	                    <mi>f</mi>
	                    <mrow>
	                        <mo>(</mo>
	                        <mi>n</mi>
	                        <mo>)</mo>
	                    </mrow>
	                </msup> 
	                <mrow>
	                    <mo>(</mo>
	                    <mi>a</mi>
	                    <mo>)</mo>
	                </mrow> 
	            </mrow>
	            <mrow>
	                <mi>n</mi>
	                <mi>!</mi>
	            </mrow> 
	        </mfrac> 
	        <msup> 
	        <mrow>
	            <mo>(</mo>
	            <mi>z</mi>
	            <mo>-</mo>
	            <mi>a</mi>
	            <mo>)</mo>
	        </mrow>
	        <mrow>
	            <mi>n</mi>
	        </mrow> 
	        </msup> 
	    </mrow>
	</math>
	

Example 11. 

	<math xmlns="http://www.w3.org/1998/Math/MathML">
	<mrow>
	  <mo>-</mo>
	  <mfrac>
	    <msup>
	  <mi>h</mi>
	  <mn>2</mn>
	</msup>
	<mrow>
	  <mn>2</mn>
	  <mo>&it;</mo>
	  <mi>m</mi>
	</mrow>
	  </mfrac>
	  <mfenced>
	<mrow>
	<mfrac>
	<mrow>
	  <msup>
	<mi> &part; </mi>
	<mn> 2 </mn>
	  </msup>
	  <mi> &Psi; </mi>
	</mrow>
	<mrow>
	  <mi> &part; </mi>
	  <msup>
	    <mi> x </mi>
	<mn> 2 </mn>
	  </msup>
	</mrow>
	</mfrac>

	<mo>+</mo>

	<mfrac>
	<mrow>
	  <msup>
	<mi> &part; </mi>
	<mn> 2 </mn>
	 </msup>
	  <mi> &Psi; </mi>
	</mrow>
	<mrow>
	  <mi> &part; </mi>
	  <msup>
	   <mi> y </mi>
	<mn> 2 </mn>
	  </msup>
	</mrow>
	</mfrac>

	<mo>+</mo>

	<mfrac>
	<mrow>
	  <msup>
	<mi> &part; </mi>
	<mn> 2 </mn>
	  </msup>
	  <mi> &Psi; </mi>
	</mrow>
	<mrow>
	 <mi> &part; </mi>
	 <msup>
	    <mi> z </mi>
	<mn> 2 </mn>
	 </msup>
	</mrow>
	</mfrac>
	</mrow>
	  </mfenced>

	  <mo>=</mo>

	  <mrow>
	<mi>i</mi>
	<mi>&hbar;</mi>
	<mfrac>
	<mrow>
	  <mi> &part; </mi>
	  <mi> &Psi; </mi>
	</mrow>
	<mrow>
	  <mi> &part; </mi>
	  <mi> t </mi>
	</mrow>
	</mfrac>
	  </mrow>
	</mrow>
	</math>
	

Example 12. 

	<math xmlns="http://www.w3.org/1998/Math/MathML">
	<mrow>
	<mmultiscripts>
	<mi>x</mi>
	<mn>1</mn>
	<none/>
	<mo>,</mo>
	<none/>
	<mn>2</mn>
	<none/>
	</mmultiscripts>
	<mo>=</mo>
	<mfrac>
	<mrow>
	<mo>-</mo>
	<mi>b</mi>
	<mi>&PlusMinus;</mi>
	<mrow>
	<msqrt>
	<msup>
	<mi>b</mi>
	<mn>2</mn>
	</msup>
	<mo>-</mo>
	<mn>4</mn>
	<mi>a</mi>
	<mi>c</mi>
	</msqrt>
	</mrow>
	</mrow>
	<mrow>
	<mn>2</mn>
	<mi>a</mi>
	</mrow>
	</mfrac>
	</mrow>
	</math>
	

13. Some tools which have support for MathML

Here is an incomplete reference of tools that have (some) MathML support:

Amaya - XML editors, XML browsers - Win32, Linux, Solaris, AIX, OSF/1 Unix

IBM techexplorer - XML browsers - Win32, Linux, MacOS, AIX, Solaris, IRIX

Mozilla - XML browsers - Win32, MacOS, Linux, OpenVMS, FreeBSD, Unix

PassiveTeX - XSL engines -TeX

OxyGenXML - XML source editor, XSLT debugger, tree viewer/editor - Win32, MacOS, Linux/Unix, Eclipse plugin

XMLSpy - Includes XML editor, XML Schema editor, XSLT Debugger - Win32, MacOS, Linux/Unix

MathMLed - MathML Editor for Mozilla - An experimental MathML editor written in XUL to run in Mozilla. It tries to present a reasonable user interface while generating valid and reasonable MathML. - Mozzilla

Itex2mml - transforms webpages with embedded itex (a dialect of latex) into xhtml and MathML pages, suitable for viewing with Mozilla. - i686 linux

Tex4Moz - is a minor modification of Eitan Gurari's Tex4ht, suitable for transforming tex or latex (the standard tools for creating high quality math documents) into xhtml and MathML pages suitable for viewing with Mozilla or Amaya - Win32

Math Player - Support MathML for IE5.5 and later - Win32

This is the end of this tutorial.

You may also check the Part II which is devoted to Conceptual Representation in MathML.

Valid XHTML 1.0! Valid CSS!