<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html 
    PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
           "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"
>
<?xml-stylesheet type="text/xsl" href="mathml.xsl"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
math { font-family: serif; }
</style>
<title>CPT -- Documentation</title>      
</head>
<body>
<h1>Content Pseudo-TeX (CPT) -- Documentation</h1>
<p>
(<a href="mathtrans.xml">Translator page</a>, or <a href="in-page-doc.xml">embed within page</a>)
</p>
<h2>Design Criteria</h2>
<ul>
<li> Output (destination) code should be <em>strict</em> Content MathML -- no presentation tags.</li>
<li> Input (source) code should be "TeX-like" -- in particular:
<ul>
<li> Backslash-escaped "macros" (although there will be a few different forms of them);</li>
<li> Curly brackets "{...}" for most grouping;</li>
<li> Square brackets "[...]" (as in LaTeX) for optional arguments (here will correspond to Content MathML "qualifiers");</li>
<li> Environments similar to LaTeX: "\begin{foo}...\end{foo}."</li>
</ul></li>
<li> Basic infix algebraic expressions and relations should be supported.</li>
<li> Mapping from source to destination should be primarily <em>syntactic</em> -- so that if
user wants to use "foo" identifier, then e.g. "\foo" source should yield (syntactically correct)
"&lt;foo/&gt;" element, even if renderer doesn't recognize "&lt;foo/&gt;."
Primary advantage of this will be that translation will still work even if Content MathML element set expands.</li>
<li> Sources of semantic ambiguity in TeX should be settled in favor of Content MathML -- for
example, "^" in TeX can be used for either exponents or superscripts, but Content MathML doesn't
use superscripts <em>per se</em> at all; here, "^" will be used only for exponents, and "_" for Content MathML
"selectors."</li>
<li> Source expressions should be concise.</li>
<li> Source expressions should cover as many cases of Content MathML as possible, even if it means departing
from standard TeX-like syntax; however, it should not be expected that the source syntax would cover all
cases of Content MathML.</li>
<li> Source language with translator
should be regarded as a tool for authoring Content MathML, <em>not</em> as a replacement
for Content MathML.
(Note, however, that the ability to 
<a href="in-page-doc.xml">embed source language expressions within a page</a>
does allow an author to effectively replace Content MathML.
The <a href="index.xml">list of tools and materials</a> inlcudes a full document
structure stylesheet based on this embedding interface.)</li>
</ul>
<h2>Information about Content MathML</h2>
<p>Consult the 
<a href="http://www.w3.org/TR/2003/REC-MathML2-20031021/">W3C Specification for MathML 2.0</a>, specifically 
<a href="http://www.w3.org/TR/2003/REC-MathML2-20031021/chapter4.html">Chapter 4</a>.
</p>
<h2>Examples Demonstrating Source Syntax</h2>
<table border="1">
<tr><td></td><td><strong>Source:</strong></td><td><strong>Content MathML:</strong></td>
<td><strong>Rendered:</strong></td></tr>
<tr><td>Number:</td><td><kbd>1</kbd></td>
<td><pre><![CDATA[<cn>1</cn>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<cn>1</cn></math></td></tr>
<tr><td>Basic Identifier:</td><td><kbd>x</kbd></td>
<td><pre><![CDATA[<ci>x</ci>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<ci>x</ci></math></td></tr>
<tr><td>Selector:</td><td><kbd>x_1</kbd></td>
<td><pre><![CDATA[<apply>
 <selector/>
 <ci>x</ci>
 <cn>1</cn>
</apply>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<apply><selector/><ci>x</ci><cn>1</cn></apply></math></td></tr>
<tr><td>Multiple Selector:</td><td><kbd>A_{0 1}</kbd></td>
<td><pre><![CDATA[<apply>
 <selector/>
 <ci>A</ci>
 <cn>0</cn>
 <cn>1</cn>
</apply>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<apply><selector/><ci>A</ci><cn>0</cn><cn>1</cn></apply></math></td></tr>
<tr><td>Negation:</td><td><kbd>-1</kbd></td>
<td><pre><![CDATA[<apply>
 <minus/>
 <ci>x</ci>
</apply>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
<minus/>
<ci>x</ci>
</apply></math></td></tr>
<tr><td>Stand-alone Element:</td><td><kbd>\pi;</kbd></td>
<td><pre><![CDATA[<pi/>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<pi/></math></td></tr>
<tr><td>Special Character:</td>
<td><kbd>&amp;theta;</kbd></td>
<td><pre><![CDATA[<ci>&theta;</ci>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<ci>&theta;</ci></math></td></tr>
<tr><td>Basic Infix Operator:</td><td><kbd>x+y</kbd></td>
<td><pre><![CDATA[<apply>
 <plus/>
 <ci>x</ci>
 <ci>y</ci>
</apply>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
<plus/>
<ci>x</ci>
<ci>y</ci>
</apply></math></td></tr>
<tr>
<td>Basic Function:</td>
<td><kbd>f(x,y)</kbd></td>
<td><pre><![CDATA[<apply>
 <ci>f</ci>
 <ci>x</ci>
 <ci>y</ci>
</apply>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
<ci>f</ci>
<ci>x</ci>
<ci>y</ci>
</apply>
</math>
</td></tr>
<tr><td>Implied Multiplication:</td><td><kbd>2\pi;</kbd></td>
<td><pre><![CDATA[<apply>
 <times/>
 <cn>2</cn>
 <pi/>
</apply>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
 <times/>
 <cn>2</cn>
 <pi/>
</apply></math></td></tr>
<tr><td>Factorial:</td><td><kbd>n!</kbd></td>
<td><pre><![CDATA[<apply>
 <factorial/>
 <ci>n</ci>
</apply>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
<factorial/>
<ci>n</ci>
</apply>
</math></td></tr>
<tr><td>Basic Infix Relation:</td><td><kbd>x&lt;y</kbd></td>
<td><pre><![CDATA[<apply>
 <lt/>
 <ci>x</ci>
 <ci>y</ci>
</apply>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
<lt/>
<ci>x</ci>
<ci>y</ci>
</apply></math></td></tr>
<tr><td>Infix Element:</td><td><kbd>x\in|C</kbd></td>
<td><pre><![CDATA[<apply>
 <in/>
 <ci>x</ci>
 <ci>C</ci>
</apply>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
<in/>
<ci>x</ci>
<ci>C</ci>
</apply></math></td></tr>
<tr><td>Infix Attribute:</td><td><kbd>x\tendsto@above|c</kbd></td>
<td><pre><![CDATA[<apply>
 <tendsto type="above"/>
 <ci>x</ci>
 <ci>c</ci>
</apply>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
<tendsto type="above"/>
<ci>x</ci>
<ci>c</ci>
</apply></math></td></tr>
<tr><td>Applied Element:</td><td><kbd>\sin{x}</kbd></td>
<td><pre><![CDATA[<apply>
 <sin/>
 <ci>x</ci>
</apply>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
<sin/>
<ci>x</ci>
</apply></math></td></tr>
<tr><td>Qualifier:</td><td><kbd>\int[v:x]{\sin{x}}</kbd></td>
<td><pre><![CDATA[<apply>
 <int/>
 <bvar>
  <ci>x</ci>
 </bvar>
 <apply>
  <sin/>
  <ci>x</ci>
 </apply>
</apply>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
<int/>
<bvar>
<ci>x</ci>
</bvar>
<apply>
<sin/>
<ci>x</ci>
</apply>
</apply></math></td></tr>
<tr><td>Nested Qualifier:</td><td><kbd>\diff[v:x[n:2]]{f(x)}</kbd></td>
<td><pre><![CDATA[<apply>
 <diff/>
 <bvar>
  <ci>x</ci>
  <degree>
   <cn>2</cn>
  </degree>
 </bvar>
 <apply>
  <ci>f</ci>
  <ci>x</ci>
 </apply>
</apply>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
<diff/>
<bvar>
<ci>x</ci>
<degree>
<cn>2</cn>
</degree>
</bvar>
<apply>
<ci>f</ci>
<ci>x</ci>
</apply>
</apply></math></td></tr>
<tr><td>Element Attribute:</td><td><kbd>\tendsto@above{x c}</kbd></td>
<td><pre><![CDATA[<apply>
 <tendsto type="above"/>
 <ci>x</ci>
 <ci>c</ci>
</apply>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
<tendsto type="above"/>
<ci>x</ci>
<ci>c</ci>
</apply></math></td></tr>
<tr><td>Environment:</td><td><pre>\begin{interval}
0 1
\end{interval}</pre></td>
<td><pre><![CDATA[<interval>
 <cn>0</cn>
 <cn>1</cn>
</interval>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<interval>
<cn>0</cn>
<cn>1</cn>
</interval>
</math>
</td></tr>
<tr><td>Environment Qualifier:</td>
<td><pre>\begin[v:x]{lambda}
f(x)
\end{lambda}</pre>
</td>
<td><pre><![CDATA[<lambda>
 <bvar>
  <ci>x</ci>
 </bvar>
 <apply>
  <ci>f</ci>
  <ci>x</ci>
 </apply>
</lambda>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
 <lambda>
 <bvar>
  <ci>x</ci>
 </bvar>
 <apply>
  <ci>f</ci>
  <ci>x</ci>
 </apply>
</lambda></math></td></tr>
<tr><td>Environment Attribute:</td><td><pre>\begin{interval}
@open-closed
0 1
\end{interval}</pre></td>
<td><pre><![CDATA[<interval closure="open-closed">
 <cn>0</cn>
 <cn>1</cn>
</interval>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<interval closure="open-closed">
<cn>0</cn>
<cn>1</cn>
</interval>
</math>
</td></tr>
<tr><td>Separator:</td><td><pre>\begin{cn}
@complex-cartesian
3 || 2
\end{cn}</pre></td>
<td><pre><![CDATA[<cn type="complex-cartesian">
 3 <sep/> 2
</cn>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<cn type="complex-cartesian">
 3 <sep/> 2
</cn>
</math>
</td></tr>
</table>
<h2>Basic Syntactic Mapping Scheme</h2>
<table border="1">
<tr><td><strong>Source:</strong></td><td><strong>Content MathML:</strong></td></tr>
<tr><td>Source:</td><td>Content MathML:</td></tr>
<tr><td><kbd>foo(...)</kbd></td><td><pre><![CDATA[<apply>
 <ci>foo</ci>
 ...
</apply>]]></pre></td></tr>
<tr><td><kbd>\foo;</kbd></td><td><kbd>&lt;foo/&gt;</kbd></td></tr>
<tr><td><kbd>x\foo|y</kbd></td><td><pre><![CDATA[<apply>
 <foo/>
 x
 y
</apply>
]]></pre></td></tr>
<tr><td><kbd>x\foo@bar|y</kbd></td><td><pre><![CDATA[<apply>
 <foo type="bar"/>
 x
 y
</apply>
]]></pre></td></tr>
<tr><td><kbd>&amp;foo;</kbd></td><td><pre><![CDATA[<ci>&foo;</ci>]]></pre></td></tr>
<tr><td><kbd>\foo{...}</kbd></td><td><pre><![CDATA[<apply>
 <foo/>
 ...
</apply>
]]></pre></td></tr>
<tr><td><kbd>\foo@bar{...}</kbd></td><td><pre><![CDATA[<apply>
 <foo type="bar"/>
 ...
</apply>
]]></pre></td></tr>
<tr><td><kbd>\begin{foo}...\end{foo}</kbd></td><td><pre><![CDATA[<foo>
 ...
</foo>
]]></pre></td></tr>
<tr><td><kbd>\begin{foo}@bar...\end{foo}</kbd></td><td><pre><![CDATA[<foo type="bar">
 ...
</foo>
]]></pre></td></tr>
</table>
<p>
Applied elements ("<kbd>\foo{...}</kbd>") and environments ("<kbd>\begin{foo}...\end{foo}</kbd>") both
support <var>n</var>-ary lists of arguments, separated by spaces.  In some cases, grouping (using
either "<kbd>(...)</kbd>" or "<kbd>{...}</kbd>") may be necessary in lists to resolve issues of
ambiguous syntax, e.g. with implied multiplication.  
For example, in the matrix example below,
in the segment "<kbd>\begin{matrixrow}\cos{&amp;theta;} (-\sin{&amp;theta;})\end{matrixrow}</kbd>," the parentheses
around the "<kbd>-\sin{&amp;theta;}</kbd>" indicate that it is a separate entry in the matrix, not part of
an expression for the difference of the two entries in the "<kbd>matrixrow</kbd>."
Lists of arguments in basic function expressions
("<kbd>f(x,y)</kbd>") may be separated using either commas or spaces, but if spaces are used, the
same restrictions as above apply.
</p>
<p>
Also, any time an 
infix element ("<kbd>x\foo|y</kbd>") appears inside another element as part of an <var>n</var>-ary list
it <em>must</em> be enclosed in brackets ("<kbd>{x\foo|y}</kbd>"),
even if it is the only item in the list.
For example, in the limit example below, the brackets are required around the "<kbd>\tendsto|</kbd>" element
in the qualifier "<kbd>[c:{x\tendsto@above|0}]</kbd>."
Brackets are otherwise usually not necessary around the standard infix relations or operators in a list, though.
The brackets prevent the translator from getting confused between an infix element in the current item in the list and
an applied element at the beginning of the next item.
</p>
<h2>Standard Operators and Relations</h2>
<table border="1">
<tr><td>Binary Operators:</td>
<td><kbd>+</kbd>, <kbd>-</kbd>, <kbd>*</kbd>, <kbd>/</kbd>, <kbd>^</kbd>, with standard precedence and
grouping by <kbd>(...)</kbd></td></tr>
<tr><td>Binary Relations:</td>
<td><kbd>&lt;</kbd>, <kbd>&lt;=</kbd>, <kbd>&gt;</kbd>, <kbd>&gt;=</kbd>, <kbd>/=</kbd>, with grouping by
<kbd>{...}</kbd></td></tr>
<tr><td>Other:</td><td>factorial <kbd>x!</kbd>, some limited support for implied multiplication</td></tr>
</table>
<h2>Qualifier Tag Mapping</h2>
<ul>
<li> <kbd>[v:...]</kbd> = <kbd>&lt;bvar&gt;...&lt;/bvar&gt;</kbd></li>
<li> <kbd>[u:...]</kbd> = <kbd>&lt;uplimit&gt;...&lt;/uplimit&gt;</kbd></li>
<li> <kbd>[l:...]</kbd> = <kbd>&lt;lowlimit&gt;...&lt;/lowlimit&gt;</kbd></li>
<li> <kbd>[i:...]</kbd> = <kbd>&lt;interval&gt;...&lt;/interval&gt;</kbd></li>
<li> <kbd>[c:...]</kbd> = <kbd>&lt;condition&gt;...&lt;/condition&gt;</kbd></li>
<li> <kbd>[d:...]</kbd> = <kbd>&lt;domainofapplication&gt;...&lt;/domainofapplication&gt;</kbd></li>
<li> <kbd>[b:...]</kbd> = <kbd>&lt;logbase&gt;...&lt;/logbase&gt;</kbd></li>
<li> <kbd>[n:...]</kbd> = <kbd>&lt;degree&gt;...&lt;/degree&gt;</kbd></li>
<li> <kbd>[m:...]</kbd> = <kbd>&lt;momentabout&gt;...&lt;/momentabout&gt;</kbd></li>
<li> <kbd>[s:...]</kbd> = <kbd>&lt;list&gt;...&lt;/list&gt;</kbd></li>
</ul>
<p>
Qualifiers work with applied elements or environments, as seen in the above examples,
"<kbd>\int[v:x]{\sin{x}}</kbd>," in which the qualifier tag specifies the bound variable for the
integral, and "<kbd>\begin[v:x]{lambda}f(x)\end{lambda}</kbd>," in which the qualifier tag specifies the
bound variable for the lambda-calculus operator.
The tags support <var>n</var>-ary lists of items within the tags, separated by spaces.
The "<kbd>[s:...]</kbd>" tag, corresponding to the "<kbd>&lt;list&gt;</kbd>" qualifier, 
is mostly used with the "<kbd>&lt;partialdiff/&gt;</kbd>"
tag when no bound variables are specified, to give a list of the variables with respect to which
the derivatives are taken.  In some rare instances, qualifier tags can be nested, as for example
when specifying the order of a derivative with respect to a certain variable, as in the
above example, "<kbd>\diff[v:x[n:2]]{f(x)}</kbd>."  
In this case, the inner qualifier tag(s) must be the <em>last</em> item(s) in the list of elements
within the outer tag.
</p>
<h2>Attributes</h2>
<p>
The "<kbd>@</kbd>" construct in source allows certain tags to support attributes, although the syntax does not allow
any tag to support more than one attribute.  Only infix elements,
applied elements, and environments in the source syntax support
attributes.  When the "<kbd>@</kbd>" construct appears in an environment, it <em>must</em> be the first element in the
environment.  The table below indicates which tags support which attributes, with possible values.
</p>
<table border="1">
<tr><td><strong>Element:</strong></td>
<td><strong>Attribute:</strong></td><td><strong>Allowed values:</strong></td></tr>
<tr><td><kbd>cn</kbd></td><td><kbd>type</kbd></td>
<td>real, integer, rational, e-notation, complex-cartesian, complex-polar</td></tr>
<tr><td><kbd>ci</kbd></td><td><kbd>type</kbd></td>
<td>many -- see <a href="http://www.w3.org/TR/2003/REC-MathML2-20031021/chapter4.html">W3C documentation</a>
(generally do not affect rendering)</td></tr>
<tr><td><kbd>tendsto</kbd></td><td><kbd>type</kbd></td>
<td>two-sided, above, below</td></tr>
<tr><td><kbd>set</kbd></td>
<td><kbd>type</kbd></td><td>normal, multiset</td></tr>
<tr><td><kbd>interval</kbd></td><td><kbd>closure</kbd></td>
<td>closed, open, open-closed, closed-open</td></tr>
<tr><td><kbd>list</kbd></td><td><kbd>order</kbd></td>
<td>numerical, lexicographic</td></tr>
</table>
<p>
<strong>Note:</strong> 
The <kbd>\tendsto</kbd> element may be used in either infix or applied form, and
in either form the "<kbd>@</kbd>" construct adds the "<kbd>type</kbd>" attribute as indicated in the above table.
The other elements which support attributes must all be used in environment form.
In particular, in order to use the <kbd>type</kbd> attribute for the <kbd>&lt;cn&gt;</kbd> tag, the
tag <em>must</em> be treated as an environment in the source syntax.  
In this situation, the source element "<kbd>||</kbd>" is
an abbreviation for the "<kbd>&lt;sep/&gt;</kbd>" tag, to separate the parts of
"e-notation," "rational," "complex-cartesian," or "complex-polar" type tokens.
</p>
<h2>Not Supported</h2>
<ul>
<li> <kbd>type="constant"</kbd> for <kbd>&lt;cn&gt;</kbd> tag (use defined stand-alone elements instead); </li>
<li> <kbd>base</kbd> attribute for <kbd>&lt;cn&gt;</kbd> tag;</li>
<li> <kbd>&lt;csymbol&gt;</kbd>, <kbd>&lt;semantics&gt;</kbd>, <kbd>&lt;declare&gt;</kbd>, 
<kbd>&lt;annotation&gt;</kbd>, and <kbd>&lt;annotation-xml&gt;</kbd> elements;</li>
<li> <kbd>definitionURL</kbd> and <kbd>encoding</kbd> attributes; and</li>
<li> <kbd>class</kbd>, <kbd>id</kbd>, <kbd>style</kbd>, <kbd>href</kbd>, <kbd>xref</kbd>, 
and <kbd>other</kbd> attributes.</li>
</ul>
<p>
Since the source-to-destination mapping is essentially syntactic (except for the qualifier tags and attributes),
all other Content MathML elements should be supported, in one form or another.
However, in particular since certain attributes are not supported in the source syntax,
users should learn enough Content MathML to be able to find the 
affected elements and modify them as needed to include the desired
attributes. 
</p>
<h2>More Involved Examples</h2>
<table border="1">
<tr><td><strong>Source:</strong></td><td><strong>Content MathML:</strong></td>
<td><strong>Rendered:</strong></td></tr>
<tr><td><kbd>\int[v:x][l:0][u:\pi;]{\sin{x}}=2</kbd></td>
<td><pre><![CDATA[<apply>
 <eq/>
 <apply>
  <int/>
  <bvar>
   <ci>x</ci>
  </bvar>
  <lowlimit>
   <cn>0</cn>
  </lowlimit>
  <uplimit>
   <pi/>
  </uplimit>
  <apply>
   <sin/>
   <ci>x</ci>
  </apply>
 </apply>
 <cn>2</cn>
</apply>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
<eq/>
<apply>
<int/>
<bvar>
<ci>x</ci>
</bvar>
<lowlimit>
<cn>0</cn>
</lowlimit>
<uplimit>
<pi/>
</uplimit>
<apply>
<sin/>
<ci>x</ci>
</apply>
</apply>
<cn>2</cn>
</apply>
</math></td></tr>
<tr>
<td><pre>\limit[v:x][c:{x\tendsto@above|0}]{\sin{x}/x}=1</pre></td>
<td><pre><![CDATA[<apply>
 <eq/>
 <apply>
  <limit/>
  <bvar>
   <ci>x</ci>
  </bvar>
  <condition>
   <apply>
    <tendsto type="above"/>
    <ci>x</ci>
    <cn>0</cn>
   </apply>
  </condition>
  <apply>
   <divide/>
   <apply>
    <sin/>
    <ci>x</ci>
   </apply>
   <ci>x</ci>
  </apply>
 </apply>
 <cn>1</cn>
</apply>]]></pre></td>
<td>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
 <eq/>
 <apply>
  <limit/>
  <bvar>
   <ci>x</ci>
  </bvar>
  <condition>
   <apply>
    <tendsto type="above"/>
    <ci>x</ci>
    <cn>0</cn>
   </apply>
  </condition>
  <apply>
   <divide/>
   <apply>
    <sin/>
    <ci>x</ci>
   </apply>
   <ci>x</ci>
  </apply>
 </apply>
 <cn>1</cn>
</apply>
</math>
</td>
</tr>
<tr>
<td><pre><![CDATA[\abs{x}=\begin{piecewise}
\begin{piece}
x x>=0
\end{piece}
\begin{otherwise}
-x
\end{otherwise}
\end{piecewise}]]></pre></td>
<td><pre><![CDATA[<apply>
 <eq/>
 <apply>
  <abs/>
  <ci>x</ci>
 </apply>
 <piecewise>
  <piece>
   <ci>x</ci>
   <apply>
    <geq/>
    <ci>x</ci>
    <cn>0</cn>
   </apply>
  </piece>
  <otherwise>
   <apply>
    <minus/>
    <ci>x</ci>
   </apply>
  </otherwise>
 </piecewise>
</apply>
]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
 <eq/>
 <apply>
  <abs/>
  <ci>x</ci>
 </apply>
 <piecewise>
  <piece>
   <ci>x</ci>
   <apply>
    <geq/>
    <ci>x</ci>
    <cn>0</cn>
   </apply>
  </piece>
  <otherwise>
   <apply>
    <minus/>
    <ci>x</ci>
   </apply>
  </otherwise>
 </piecewise>
</apply>
</math></td>
</tr>
<tr>
<td><pre>x_1=(-b+\root{b^2-4a*c})/2a</pre></td>
<td><pre><![CDATA[<apply>
 <eq/>
 <apply>
  <selector/>
  <ci>x</ci>
  <cn>1</cn>
 </apply>
 <apply>
  <divide/>
  <apply>
   <plus/>
   <apply>
    <minus/>
    <ci>b</ci>
   </apply>
   <apply>
    <root/>
    <apply>
     <minus/>
     <apply>
      <power/>
      <ci>b</ci>
      <cn>2</cn>
     </apply>
     <apply>
      <times/>
      <apply>
       <times/>
       <cn>4</cn>
       <ci>a</ci>
      </apply>
      <ci>c</ci>
     </apply>
    </apply>
   </apply>
  </apply>
  <apply>
   <times/>
   <cn>2</cn>
   <ci>a</ci>
  </apply>
 </apply>
</apply>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
 <eq/>
 <apply>
  <selector/>
  <ci>x</ci>
  <cn>1</cn>
 </apply>
 <apply>
  <divide/>
  <apply>
   <plus/>
   <apply>
    <minus/>
    <ci>b</ci>
   </apply>
   <apply>
    <root/>
    <apply>
     <minus/>
     <apply>
      <power/>
      <ci>b</ci>
      <cn>2</cn>
     </apply>
     <apply>
      <times/>
      <apply>
       <times/>
       <cn>4</cn>
       <ci>a</ci>
      </apply>
      <ci>c</ci>
     </apply>
    </apply>
   </apply>
  </apply>
  <apply>
   <times/>
   <cn>2</cn>
   <ci>a</ci>
  </apply>
 </apply>
</apply>
</math></td>
</tr>
<tr>
<td><pre>\sum[v:n][l:1][u:\infinity;]{1/n^2}=\pi;^2/6</pre>
</td>
<td><pre><![CDATA[<apply>
 <eq/>
 <apply>
  <sum/>
  <bvar>
   <ci>n</ci>
  </bvar>
  <lowlimit>
   <cn>1</cn>
  </lowlimit>
  <uplimit>
   <infinity/>
  </uplimit>
  <apply>
   <divide/>
   <cn>1</cn>
   <apply>
    <power/>
    <ci>n</ci>
    <cn>2</cn>
   </apply>
  </apply>
 </apply>
 <apply>
  <divide/>
  <apply>
   <power/>
   <pi/>
   <cn>2</cn>
  </apply>
  <cn>6</cn>
 </apply>
</apply>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
 <eq/>
 <apply>
  <sum/>
  <bvar>
   <ci>n</ci>
  </bvar>
  <lowlimit>
   <cn>1</cn>
  </lowlimit>
  <uplimit>
   <infinity/>
  </uplimit>
  <apply>
   <divide/>
   <cn>1</cn>
   <apply>
    <power/>
    <ci>n</ci>
    <cn>2</cn>
   </apply>
  </apply>
 </apply>
 <apply>
  <divide/>
  <apply>
   <power/>
   <pi/>
   <cn>2</cn>
  </apply>
  <cn>6</cn>
 </apply>
</apply>
</math>
</td>
</tr>
<tr>
<td><pre><![CDATA[\begin{matrix}
\begin{matrixrow}
\cos{&theta;} (-\sin{&theta;})
\end{matrixrow}
\begin{matrixrow}
\sin{&theta;} \cos{&theta;}
\end{matrixrow}
\end{matrix}]]></pre></td>
<td><pre><![CDATA[<matrix>
 <matrixrow>
  <apply>
   <cos/>
   <ci>&theta;</ci>
  </apply>
  <apply>
   <minus/>
   <apply>
    <sin/>
    <ci>&theta;</ci>
   </apply>
  </apply>
 </matrixrow>
 <matrixrow>
  <apply>
   <sin/>
   <ci>&theta;</ci>
  </apply>
  <apply>
   <cos/>
   <ci>&theta;</ci>
  </apply>
 </matrixrow>
</matrix>
]]></pre></td>
<td>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<matrix>
<matrixrow>
<apply>
<cos/>
<ci>&theta;</ci>
</apply>
<apply>
<minus/>
<apply>
<sin/>
<ci>&theta;</ci>
</apply>
</apply>
</matrixrow>
<matrixrow>
<apply>
<sin/>
<ci>&theta;</ci>
</apply>
<apply>
<cos/>
<ci>&theta;</ci>
</apply>
</matrixrow>
</matrix>
</math></td></tr>
<tr>
<td><pre>
\int[v:x][l:-\infinity;][u:\infinity;]
     {\exp{-(x^2)}}=\root{\pi;}
</pre></td>
<td><pre><![CDATA[<apply>
 <eq/>
 <apply>
  <int/>
  <bvar>
   <ci>x</ci>
  </bvar>
  <lowlimit>
   <apply>
    <minus/>
    <infinity/>
   </apply>
  </lowlimit>
  <uplimit>
   <infinity/>
  </uplimit>
  <apply>
   <exp/>
   <apply>
    <minus/>
    <apply>
     <power/>
     <ci>x</ci>
     <cn>2</cn>
    </apply>
   </apply>
  </apply>
 </apply>
 <apply>
  <root/>
  <pi/>
 </apply>
</apply>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
<eq/>
<apply>
<int/>
<bvar>
<ci>x</ci>
</bvar>
<lowlimit>
<apply>
<minus/>
<infinity/>
</apply>
</lowlimit>
<uplimit>
<infinity/>
</uplimit>
<apply>
<exp/>
<apply>
<minus/>
<apply>
<power/>
<ci>x</ci>
<cn>2</cn>
</apply>
</apply>
</apply>
</apply>
<apply>
<root/>
<pi/>
</apply>
</apply>
</math>
</td></tr>
<tr>
<td>
<pre>\diff[v:x]{
      \int[v:t][l:a][u:x]{f(t)}
   }=f(x)</pre>
</td>
<td>
<pre><![CDATA[<apply>
 <eq/>
 <apply>
  <diff/>
  <bvar>
   <ci>x</ci>
  </bvar>
  <apply>
   <int/>
   <bvar>
    <ci>t</ci>
   </bvar>
   <lowlimit>
    <ci>a</ci>
   </lowlimit>
   <uplimit>
    <ci>x</ci>
   </uplimit>
   <apply>
    <ci>f</ci>
    <ci>t</ci>
   </apply>
  </apply>
 </apply>
 <apply>
  <ci>f</ci>
  <ci>x</ci>
 </apply>
</apply>]]></pre>
</td>
<td>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
<eq/>
<apply>
<diff/>
<bvar>
<ci>x</ci>
</bvar>
<apply>
<int/>
<bvar>
<ci>t</ci>
</bvar>
<lowlimit>
<ci>a</ci>
</lowlimit>
<uplimit>
<ci>x</ci>
</uplimit>
<apply>
<ci>f</ci>
<ci>t</ci>
</apply>
</apply>
</apply>
<apply>
<ci>f</ci>
<ci>x</ci>
</apply>
</apply>
</math></td>
</tr>
<tr><td><pre>\begin{apply}
     \partialdiff[s:x y]{f} x y
\end{apply}
     =\partialdiff[v:x][v:y]{f(x,y)}</pre></td>
<td><pre><![CDATA[<apply>
 <eq/>
 <apply>
  <apply>
   <partialdiff/>
   <list>
    <ci>x</ci>
    <ci>y</ci>
   </list>
   <ci>f</ci>
  </apply>
  <ci>x</ci>
  <ci>y</ci>
 </apply>
 <apply>
  <partialdiff/>
  <bvar>
   <ci>x</ci>
  </bvar>
  <bvar>
   <ci>y</ci>
  </bvar>
  <apply>
   <ci>f</ci>
   <ci>x</ci>
   <ci>y</ci>
  </apply>
 </apply>
</apply>]]></pre></td>
<td><math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
<eq/>
<apply>
<apply>
<partialdiff/>
<list>
<ci>x</ci>
<ci>y</ci>
</list>
<ci>f</ci>
</apply>
<ci>x</ci>
<ci>y</ci>
</apply>
<apply>
<partialdiff/>
<bvar>
<ci>x</ci>
</bvar>
<bvar>
<ci>y</ci>
</bvar>
<apply>
<ci>f</ci>
<ci>x</ci>
<ci>y</ci>
</apply>
</apply>
</apply>
</math>
</td></tr>
</table>
<p>
<strong>Note:</strong> I have modified the XSLT stylesheet "ctop.xsl" from 
<a href="http://www.w3.org/Math/XSL/">W3C</a> 
to improve the mapping from Content MathML to Presentation
MathML.  In particular, I have:
</p>
<ul> 
<li> changed the rendered formatting for the
"<kbd>&lt;divide/&gt;</kbd>" tag to always use horizontal fraction bars;</li>
<li> changed the rendered formatting of the 
"<kbd>&lt;diff/&gt;</kbd>" and "<kbd>&lt;partialdiff/&gt;</kbd>"
tags without bound variables, to better allow for higher order derivatives;</li> 
<li> changed the rendered formatting of the 
"<kbd>&lt;diff/&gt;</kbd>" and "<kbd>&lt;partialdiff/&gt;</kbd>"
tags with bound variables, to prevent the expression to which the derivative is being
applied from being forced into the numerator;</li> 
<li> fixed a clash in how the "<kbd>&lt;root/&gt;</kbd>" and "<kbd>&lt;diff/&gt;</kbd>"
tags handled the "<kbd>&lt;degree&gt;</kbd>" qualifier;</li> 
<li> fixed how the "<kbd>&lt;otherwise&gt;</kbd>"
case of the "<kbd>&lt;piecewise&gt;</kbd>" tag is rendered;</li> 
<li> provided for the <var>n</var>-ary case
for the "<kbd>&lt;union/&gt;</kbd>" and "<kbd>&lt;intersect/&gt;</kbd>" tags;</li> 
<li> provided for the handling
of the bound variable and domain in the "<kbd>&lt;sum/&gt;</kbd>" and "<kbd>&lt;product/&gt;</kbd>" tags;</li>
<li> fixed the handling of the <kbd>type</kbd> attribute of the <kbd>&lt;tendsto/&gt;</kbd> tag; and</li>
<li> made quite a few cosmetic changes.</li>
</ul>
<p>
The translator page and this
page both use the modified version of the stylesheet.
The ability to test quickly the changes in the stylesheet has demonstrated the strength of the translator.
However, Design Science MathPlayer seems to use its own stylesheet and ignores the locally loaded stylesheet.
Their stylesheet is better than the W3C stylesheet, but still has problems.  For example, the numerator exponent in a high-order mixed
partial derivative is not rendered correctly, and the stylesheet doesn't seem to recognize certain types
when applied to the <kbd>&lt;cn&gt;</kbd> tag.
</p>
</body>
</html>

