<?xml version="1.0" encoding="ISO-8859-1"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:axle="http://www.cs.odu.edu/~zeil/axle" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ns0="http://www.cs.odu.edu/~zeil/axle" mode="ignore" id="basicUnix" ns0:xlinkuri="open/latextest.dbk" ns0:xpath="//*[@id='basicUnix']" ns0:page="latextest" foo="0 " ns0:last="/cocoon/~cs252/open/latextest/cpp.html"><head><title>Mathematics &amp; C++ Sourcecode Islands</title><link type="text/css" href="_axle/docbookstyle.css" rel="stylesheet"/><link type="text/css" href="_axle/cppformat.css" rel="stylesheet"/><link type="text/css" href="_axle/overrides.css" rel="stylesheet"/><script src="_axle/docbook.js"/><link href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/latextest/section-1.1.html" title="Next" rel="next"/><link href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/latextest/cpp.html" title="Last" rel="last"/><script>function gotoNext() {top.location.href="/cocoon/~cs252/open/latextest/section-1.1.html";}
function gotoPrev() {}
function gotoUp() {}
</script><xhtml:link xmlns:xhtml="http://www.w3.org/1999/xhtml" rel="stylesheet" href="_axle/navigation.css" type="text/css"/><xhtml:script xmlns:xhtml="http://www.w3.org/1999/xhtml" src="_axle/navigation.js"/></head><body><table width="100%" class="navigationBar"><tr class="navigationBar"><td width="5%" class="navigationBar"><a class="navigationBarArrow" title="Next" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/latextest/section-1.1.html"><img class="navigationBar" src="_axle/next.gif" alt="Next"/></a></td><td width="5%" class="navigationBar"><a class="navigationBarArrow" title="Last" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/latextest/cpp.html"><img class="navigationBar" src="_axle/last.gif" alt="Last"/></a></td><td class="navigationBar"/><td width="5%" class="navigationBar"><a class="navigationBar" title="CS252 Home" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/directory/announcements.html"><img class="navigationBar" src="_axle/home.gif" alt="CS252 Home"/></a></td><td width="5%" class="navigationBar"><a class="navigationBar" title="discuss this page" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/forum/getXPath/open/latextest/latextest.html"><img class="navigationBar" src="_axle/forum.gif" alt="discuss this page"/></a></td></tr></table><br/><div class="info_article"><div class="title_article">Mathematics &amp; C++ Sourcecode Islands</div><div class="author_article"><span class="firstname">Steven</span> <span class="othername" role="mi">J</span> <span class="surname">Zeil</span></div><div class="affiliation">
        <span class="orgname">Old Dominion University</span>
        <span class="orgdiv">Dept. of Computer Science</span>
      </div><table width="100%"><tr><td align="left"><span class="copyright">©<span class="year">2005-2007</span> <span class="holder">Steven J. Zeil, Old Dominion University</span></span></td><td/><td align="right"><span class="date">June 21, 2007</span></td></tr></table></div><div class="TOC">Contents:<div class="TOC-section0"><a href="#latex">1 LaTeX Markup</a></div><div class="TOC-section1"><a href="section-1.1.html#section-1.1">1.1 Character Support</a></div><div class="TOC-section0"><a href="cpp.html#cpp">2 C++ Markup</a></div></div>
  

<div class="sect1" id="latex" axle:nopage="1"><div class="info_sect1"><div class="title_sect2">1. LaTeX Markup</div></div><div class="TOC">Contents:<div class="TOC-section1"><a href="section-1.1.html#section-1.1">1.1 Character Support</a></div></div>
  

<p class="para">This page tests the ability of AXLE to translate a substantial subset of LaTeX mathematical notations into MathML and then to render the MathML for web browsing.

<table border="1">
<tr>
  <th width="40%">Discussion</th>
  <th width="30%">XML/HTML</th>
  <th width="30%">Rendered</th>
</tr>

<tr><td>
Put formulas into special elements (won't work with pages
passed through HTML Tidy)
</td><td><span class="code">
&lt;latex&gt;1.0 + x^{2}&lt;/latex&gt; 
</span></td><td>
<m:math xmlns="http://www.w3.org/1998/Math/MathML" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:tree="http://chaperon.sourceforge.net/schema/syntaxtree/2.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"><m:mstyle displaystyle="true"><m:mrow><m:mn>1.0</m:mn><m:mo>+</m:mo><m:msup><m:mi>x</m:mi><m:mrow><m:mn>2</m:mn></m:mrow></m:msup></m:mrow></m:mstyle></m:math> 
</td></tr>


<tr><td>
Put formulas into axle:latex attributes
</td><td><span class="code">
&lt;span axle:latex="\{x | x^2 &amp;lt; 100\} \subset \{x | \; |x| &amp;lt; 100\}"/&gt;
</span></td><td>
<span class="span" axle:latex="\{x | x^2 &lt; 100\} \subset \{x | \; |x| &lt; 100\}"><m:math xmlns="http://www.w3.org/1998/Math/MathML" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:tree="http://chaperon.sourceforge.net/schema/syntaxtree/2.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"><m:mstyle displaystyle="true"><m:mrow><m:mfenced separators="" close="}" open="{"><m:mrow><m:mi>x</m:mi><m:mo>|</m:mo><m:msup><m:mi>x</m:mi><m:mn>2</m:mn></m:msup><m:mo>&lt;</m:mo><m:mn>100</m:mn></m:mrow></m:mfenced>
      <m:mo xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8834;</m:mo>
    <m:mfenced separators="" close="}" open="{"><m:mrow><m:mi>x</m:mi><m:mo>|</m:mo><m:mo rspace="thickmathspace">&#8290;</m:mo><m:mo>|</m:mo><m:mi>x</m:mi><m:mo>|</m:mo><m:mo>&lt;</m:mo><m:mn>100</m:mn></m:mrow></m:mfenced></m:mrow></m:mstyle></m:math></span>
</td></tr>

<tr><td>
Or use an axle:latex="1" attribute to signal that an ordinary element's content should be treated as math.
</td><td><span class="code">
&lt;span axle:latex="1"&gt;a^2 + x_i + a^3_j + x_j^4&lt;/span&gt;
</span></td><td>
<span class="span" axle:latex="1"><m:math xmlns="http://www.w3.org/1998/Math/MathML" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:tree="http://chaperon.sourceforge.net/schema/syntaxtree/2.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"><m:mstyle displaystyle="true"><m:mrow><m:msup><m:mi>a</m:mi><m:mn>2</m:mn></m:msup><m:mo>+</m:mo><m:msub><m:mi>x</m:mi><m:mi>i</m:mi></m:msub><m:mo>+</m:mo><m:msubsup><m:mi>a</m:mi><m:mi>j</m:mi><m:mn>3</m:mn></m:msubsup><m:mo>+</m:mo><m:msubsup><m:mi>x</m:mi><m:mi>j</m:mi><m:mn>4</m:mn></m:msubsup></m:mrow></m:mstyle></m:math></span>
</td></tr>

<tr><td>
Bracketing characters expand vertically as required. Note that, unlike true LaTeX, () [] {} <span class="b">must</span> be balanced. For unbalanced expressions, use the LaTeX \left and \right macros.
</td><td><div class="screen">
&lt;div axle:latex="1"&gt;a + 
  (a * \{x | x^2 \geq 0\} - x[i]) + 
  \left(\mbox{deliberately-unbalanced}\right.\ldots
&lt;/div&gt;
&lt;div axle:latex="1"&gt;
  \lim_{n \rightarrow \infty} 
   (\sum_{i=0}^{n} \frac{i}{2^i}) = 2
&lt;/div&gt;
</div></td><td>
<span class="div" axle:latex="1"><m:math xmlns="http://www.w3.org/1998/Math/MathML" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:tree="http://chaperon.sourceforge.net/schema/syntaxtree/2.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"><m:mstyle displaystyle="true"><m:mrow><m:mi>a</m:mi><m:mo>+</m:mo><m:mfenced><m:mrow><m:mi>a</m:mi><m:mo>*</m:mo><m:mfenced separators="" close="}" open="{"><m:mrow><m:mi>x</m:mi><m:mo>|</m:mo><m:msup><m:mi>x</m:mi><m:mn>2</m:mn></m:msup>
      <m:mo xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8805;</m:mo>
    <m:mn>0</m:mn></m:mrow></m:mfenced><m:mo>-</m:mo><m:mi>x</m:mi><m:mfenced separators="" close="]" open="["><m:mrow><m:mi>i</m:mi></m:mrow></m:mfenced></m:mrow></m:mfenced><m:mo>+</m:mo><m:mfenced close="" open="(" separators=""><m:mrow><m:mtext>deliberately-unbalanced</m:mtext></m:mrow></m:mfenced>
      <m:mo xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8230;</m:mo>
    </m:mrow></m:mstyle></m:math></span>
<span class="div" axle:latex="1"><m:math xmlns="http://www.w3.org/1998/Math/MathML" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:tree="http://chaperon.sourceforge.net/schema/syntaxtree/2.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"><m:mstyle displaystyle="true"><m:mrow><m:munder>
      <m:mo xmlns:xsl="http://www.w3.org/1999/XSL/Transform">lim</m:mo>
    <m:mrow><m:mi>n</m:mi>
      <m:mo xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8594;</m:mo>
    
      <m:mo xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8734;</m:mo>
    </m:mrow></m:munder><m:mfenced><m:mrow><m:munderover>
      <m:mo xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8721;</m:mo>
    <m:mrow><m:mi>i</m:mi><m:mo>=</m:mo><m:mn>0</m:mn></m:mrow><m:mrow><m:mi>n</m:mi></m:mrow></m:munderover>
      <m:mfrac xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <m:mrow><m:mi>i</m:mi></m:mrow>
        <m:mrow><m:msup><m:mn>2</m:mn><m:mi>i</m:mi></m:msup></m:mrow>
      </m:mfrac>
    </m:mrow></m:mfenced><m:mo>=</m:mo><m:mn>2</m:mn></m:mrow></m:mstyle></m:math></span></td></tr>

<tr><td>
An equation array. (Still to do: numbered equations)

</td><td><div class="screen">
&lt;div axle:latex="1"&gt;&lt;![CDATA[\begin{eqnarray}
x &amp; = &amp; y_{1} + \ldots + y_{n} \\
  &amp; \leq &amp; z
\end{eqnarray}]]&gt;&lt;/div&gt;
</div></td><td>
<span class="div" axle:latex="1"><m:math xmlns="http://www.w3.org/1998/Math/MathML" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:tree="http://chaperon.sourceforge.net/schema/syntaxtree/2.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"><m:mstyle displaystyle="true"><m:mtable><m:mtr><m:mtd columnalign="right"><m:mrow><m:mi>x</m:mi></m:mrow></m:mtd><m:mtd columnalign="center"><m:mrow><m:mo>=</m:mo></m:mrow></m:mtd><m:mtd columnalign="left"><m:mrow><m:msub><m:mi>y</m:mi><m:mrow><m:mn>1</m:mn></m:mrow></m:msub><m:mo>+</m:mo>
      <m:mo xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8230;</m:mo>
    <m:mo>+</m:mo><m:msub><m:mi>y</m:mi><m:mrow><m:mi>n</m:mi></m:mrow></m:msub></m:mrow></m:mtd></m:mtr><m:mtr><m:mtd columnalign="right"><m:mrow/></m:mtd><m:mtd columnalign="center"><m:mrow>
      <m:mo xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8804;</m:mo>
    </m:mrow></m:mtd><m:mtd columnalign="left"><m:mrow><m:mi>z</m:mi></m:mrow></m:mtd></m:mtr></m:mtable></m:mstyle></m:math></span>
</td></tr>


<tr><td>
Arrays
</td><td><div class="screen">
&lt;div axle:latex="1"&gt;&lt;![CDATA[\begin{array}{clcr}
a+b+c &amp; uv &amp; x-y &amp; 27 \\
a+b &amp; u+v &amp; z &amp; 134 \\
a &amp; 3u+vw &amp; xyz &amp; 2,978
\end{array}]]&gt;&lt;/div&gt;

&lt;div axle:latex="1"&gt;&lt;![CDATA[
\left( \begin{array}{c}
 \left| \begin{array}{cc}
  x_{11} &amp; x_{12} \\
  x_{21} &amp; x_{22}
  \end{array} \right| \\
 y \\
 z 
\end{array} \right)]]&gt;&lt;/div&gt;

&lt;div axle:latex="1"&gt;&lt;![CDATA[
x = \left{ \begin{array}{ll}
  y &amp; \mbox{if} y &gt; 0 \\
  z + y &amp; \mbox{otherwise}
\end{array} \right.
]]&gt;&lt;/div&gt;
</div></td><td>
<span class="div" axle:latex="1"><m:math xmlns="http://www.w3.org/1998/Math/MathML" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:tree="http://chaperon.sourceforge.net/schema/syntaxtree/2.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"><m:mstyle displaystyle="true"><m:mrow><m:mtable><m:mtr><m:mtd columnalign="center"><m:mrow><m:mi>a</m:mi><m:mo>+</m:mo><m:mi>b</m:mi><m:mo>+</m:mo><m:mi>c</m:mi></m:mrow></m:mtd><m:mtd columnalign="left"><m:mrow><m:mi>u</m:mi><m:mi>v</m:mi></m:mrow></m:mtd><m:mtd columnalign="center"><m:mrow><m:mi>x</m:mi><m:mo>-</m:mo><m:mi>y</m:mi></m:mrow></m:mtd><m:mtd columnalign="right"><m:mrow><m:mn>27</m:mn></m:mrow></m:mtd></m:mtr><m:mtr><m:mtd columnalign="center"><m:mrow><m:mi>a</m:mi><m:mo>+</m:mo><m:mi>b</m:mi></m:mrow></m:mtd><m:mtd columnalign="left"><m:mrow><m:mi>u</m:mi><m:mo>+</m:mo><m:mi>v</m:mi></m:mrow></m:mtd><m:mtd columnalign="center"><m:mrow><m:mi>z</m:mi></m:mrow></m:mtd><m:mtd columnalign="right"><m:mrow><m:mn>134</m:mn></m:mrow></m:mtd></m:mtr><m:mtr><m:mtd columnalign="center"><m:mrow><m:mi>a</m:mi></m:mrow></m:mtd><m:mtd columnalign="left"><m:mrow><m:mn>3</m:mn><m:mi>u</m:mi><m:mo>+</m:mo><m:mi>v</m:mi><m:mi>w</m:mi></m:mrow></m:mtd><m:mtd columnalign="center"><m:mrow><m:mi>x</m:mi><m:mi>y</m:mi><m:mi>z</m:mi></m:mrow></m:mtd><m:mtd columnalign="right"><m:mrow><m:mn>2</m:mn><m:mo>,</m:mo><m:mn>978</m:mn></m:mrow></m:mtd></m:mtr></m:mtable></m:mrow></m:mstyle></m:math></span>

<span class="div" axle:latex="1"><m:math xmlns="http://www.w3.org/1998/Math/MathML" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:tree="http://chaperon.sourceforge.net/schema/syntaxtree/2.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"><m:mstyle displaystyle="true"><m:mrow><m:mfenced close=")" open="(" separators=""><m:mrow><m:mtable><m:mtr><m:mtd columnalign="center"><m:mrow><m:mfenced close="|" open="|" separators=""><m:mrow><m:mtable><m:mtr><m:mtd columnalign="center"><m:mrow><m:msub><m:mi>x</m:mi><m:mrow><m:mn>11</m:mn></m:mrow></m:msub></m:mrow></m:mtd><m:mtd columnalign="center"><m:mrow><m:msub><m:mi>x</m:mi><m:mrow><m:mn>12</m:mn></m:mrow></m:msub></m:mrow></m:mtd></m:mtr><m:mtr><m:mtd columnalign="center"><m:mrow><m:msub><m:mi>x</m:mi><m:mrow><m:mn>21</m:mn></m:mrow></m:msub></m:mrow></m:mtd><m:mtd columnalign="center"><m:mrow><m:msub><m:mi>x</m:mi><m:mrow><m:mn>22</m:mn></m:mrow></m:msub></m:mrow></m:mtd></m:mtr></m:mtable></m:mrow></m:mfenced></m:mrow></m:mtd></m:mtr><m:mtr><m:mtd columnalign="center"><m:mrow><m:mi>y</m:mi></m:mrow></m:mtd></m:mtr><m:mtr><m:mtd columnalign="center"><m:mrow><m:mi>z</m:mi></m:mrow></m:mtd></m:mtr></m:mtable></m:mrow></m:mfenced></m:mrow></m:mstyle></m:math></span>

<span class="div" axle:latex="1"><m:math xmlns="http://www.w3.org/1998/Math/MathML" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:tree="http://chaperon.sourceforge.net/schema/syntaxtree/2.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"><m:mstyle displaystyle="true"><m:mrow><m:mi>x</m:mi><m:mo>=</m:mo><m:mfenced close="" open="{" separators=""><m:mrow><m:mtable><m:mtr><m:mtd columnalign="left"><m:mrow><m:mi>y</m:mi></m:mrow></m:mtd><m:mtd columnalign="left"><m:mrow><m:mtext>if</m:mtext><m:mo rspace="thickmathspace">&#8290;</m:mo><m:mi>y</m:mi><m:mo>&gt;</m:mo><m:mn>0</m:mn></m:mrow></m:mtd></m:mtr><m:mtr><m:mtd columnalign="left"><m:mrow><m:mi>z</m:mi><m:mo>+</m:mo><m:mi>y</m:mi></m:mrow></m:mtd><m:mtd columnalign="left"><m:mrow><m:mtext>otherwise</m:mtext></m:mrow></m:mtd></m:mtr></m:mtable></m:mrow></m:mfenced></m:mrow></m:mstyle></m:math></span>
</td></tr>
</table>
</p>
<p class="para">
To see the MathML generated from these, look <a url="../latextest._refdoc" href="../latextest._refdoc">here</a> and, if your browser does not show it in XML format, view the source. Look for the <span class="code">&lt;math&gt;</span> tags.
</p>

<script type="text/javascript">
checkForAnchorOnOtherPage('section-1.1','section-1.1');
</script>
</div>

<script type="text/javascript">
checkForAnchorOnOtherPage('cpp','cpp');
</script>
<br/><table width="100%" class="navigationBar"><tr class="navigationBar"><td width="5%" class="navigationBar"><a class="navigationBarArrow" title="Next" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/latextest/section-1.1.html"><img class="navigationBar" src="_axle/next.gif" alt="Next"/></a></td><td width="5%" class="navigationBar"><a class="navigationBarArrow" title="Last" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/latextest/cpp.html"><img class="navigationBar" src="_axle/last.gif" alt="Last"/></a></td><td class="navigationBar"/><td width="5%" class="navigationBar"><a class="navigationBar" title="CS252 Home" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/directory/announcements.html"><img class="navigationBar" src="_axle/home.gif" alt="CS252 Home"/></a></td><td width="5%" class="navigationBar"><a class="navigationBar" title="discuss this page" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/forum/getXPath/open/latextest/latextest.html"><img class="navigationBar" src="_axle/forum.gif" alt="discuss this page"/></a></td></tr></table></body></html>