<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="pmathml.xsl"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ASCIIMathML: Math on the web for everyone</title>
<script type="text/javascript" src="ASCIIMathML.js"></script>
<link rel="stylesheet" href="asciimath.css" type="text/css"/>
</head>
<body>

<div id="menu">
| Home Page |
<a href="asciimathsyntax.xml">Syntax</a> |
<a href="asciimathdemo.xml">Try it</a> |
<a href="asciimathcalculator.html">Calculator</a> |
<a href="asciimatheditor.xml">Editor</a> |
<a href="asciimathdownload.xml">Download</a> |
<a href="http://math.chapman.edu/cgi-bin/mathxml.pl?ASCIIMath_FAQ">ASCIIMath FAQ</a> |
<a href="http://math.chapman.edu/cgi-bin/mathxml.pl?ASCIIMath_Sandbox">Sandbox</a> |
<a href="http://math.chapman.edu/cgi-bin/mathxml.pl?ASCIIMath_Comments_and_Suggestions">Comments</a> |
<a href="http://www.chapman.edu/~jipsen/asciisvg.html">ASCIIsvg</a> |
</div>

<hr/>

<h2 id="title">
ASCIIMathML.js (ver 1.4.7): Translating ASCII math notation to 
Presentation MathML
</h2>

<h4 align="center">
Would you or your students like to <i>easily</i> produce
<i>good-looking</i> math formulas on webpages using a <i>simple</i>
calculator-style syntax and your own ASCII or XHTML editor?
<br/>
Here is a free multi-platform solution (and if you prefer it, 
LaTeX-style formulas also work).
</h4>

<center>
<b><font color="red">Now even easier to use:</font> 
<font color="green"> just add two lines to your 
XHTML file to load pmathml.xsl and ASCIIMathML.js
</font></b><br/>&nbsp;<br/>
ASCIIMathML.js is mentioned on the <a
href="http://www.w3.org/Math/">MathML</a> page of the <a
href="http://www.w3.org/">World Wide Web Consortium</a>, also on <a
href="http://mathforge.net/index.jsp">mathforge.net</a> and <a
href="http://mathforum.org/library/resource_types/typesetting/">The
Math Forum</a><br/>
<font color="red"><b>New:</b></font>A <a href="http://www.maths.nottingham.ac.uk/personal/drw/lm.html">LaTeXMathML</a> version of ASCIIMathML by <a href="http://www.maths.nottingham.ac.uk/personal/drw/">Dr Douglas R. Woodall</a> 
(<a href="http://www.maths.nott.ac.uk/personal/drw/lmtest.html">examples</a>)
<br />
<a href="http://math.chapman.edu/~jipsen/asciencepad/asciencepad.html">ASciencePad</a> is a WYSIWYG editor that integrates
<a href="http://www.tiddlywiki.com/">TiddlyWiki</a>, ASCIIMathML and ASCIIsvg graphs.<br />
It's free and works locally (no installation or server required).<br />
Useful information about <a 
href="http://www.maths.ed.ac.uk/~james/ASCIIMathMLinfo.html">ASCIIMathML</a> 
by <a href="http://www.maths.ed.ac.uk/~james/">James Gray</a>, including 
a nice <a href="http://www.maths.ed.ac.uk/~james/ASCIIMathTutorial.html">tutorial</a>.<br />
ASCIIMathML also works with <a href="http://www.meyerweb.com/eric/tools/s5/">S5</a> (CSS 
Presentation slide show; <a href="http://math.chapman.edu/~jipsen/talks/MathFest2005/JipsenMathFestSlides2005.html">S5 ASCIIMath example</a>)<br/> 
and in valid
<a href="http://math.chapman.edu/~jipsen/mathml/asciimathandmathmlsvg.xhtml">
XHTML pages with standard MathML and SVG</a> in several browsers.
<br/>
ASCIIMathML is being used with Movable Type, WordPress, phpBB, and many wikis.
<br/>
Also available: A PHP port of ASCIIMathML.js to <a 
href="http://www.oldschool.com.sg/index.php/module/Shared/action/Static/tmpl/ASCIIMathPHP">ASCIIMathPHP</a> by <a 
href="mailto:kc56@cornell.edu">Steven Chan</a>.
</center>

<p>
This is the main page for the ASCIIMathML.js script which allows
incorporating mathematical formulas on webpages with a minimum of
fuss. If you like what you see, you can try to save this page and it
should all work equally well locally on your machine.
</p>

<p>
<b>
This page requires Internet Explorer 6 + <a href=
"http://www.dessci.com/en/products/mathplayer/welcome.asp">MathPlayer</a>
or Mozilla/Firefox/Netscape 7.1. <font color="red">Note: ASCIIMathML.js also
works for plain HTML files on IE+MathPLayer and 
Mozilla/Firefox/Netscape 7.1. Take a look at the <a
href="asciimath.html">HTML version Main
Page</a> (it does not use David Carlisle's pmathml.xsl stylesheet).</font>
</b>
</p>

<p>
ASCIIMathML.js is freely available under the <a
href="http://www.gnu.org/copyleft/gpl.html">GNU General Public
License</a>. You can get your own copy from the <a 
href="http://www1.chapman.edu/~jipsen/mathml/asciimathdownload.php">ASCIIMathML.js
download page</a>.
</p>

<p>
If you use it on a webpage, please send me an email at <a
href="mailto:jipsen@chapman.edu">jipsen@chapman.edu</a> with the URL
so that I can add a link to it on the <a 
href="http://math.chapman.edu/cgi-bin/mathxml.pl?Webpages_that_use_ASCIIMathML.js">users page</a>. (Also send me an
email if you have problems or would like to provide some feedback.)
I'm currently using ASCIIMathML on a Wikiserver for lecture notes and
<!--a href="http://math.chapman.edu/cgi-bin/mathxml.pl?Calculus_Text_Puzzles">Text
Puzzles</a--> my undergraduate students are using it for writing and reading
homework in their discrete mathematics class.
</p>

<hr/>

<p>
<b>Let's test the ASCIIMathML.js translator on a simple example.</b>
</p>

<p>
<b>Example:</b> Solving the quadratic equation. 
Suppose `ax^2+bx+c=0` and `a!=0`. We first 
divide by `a` to get `x^2+b/ax+c/a=0`. 

Then we complete the square and obtain `x^2+b/ax+(b/(2a))^2-(b/(2a))^2+c/a=0`. 
The first three terms factor to give `(x+b/(2a))^2=(b^2)/(4a^2)-c/a`.
Now we take square roots on both sides and get
`x+b/(2a)=+-sqrt((b^2)/(4a^2)-c/a)`.

Finally we move the `b/(2a)` to the right and simplify to get 
the two solutions: `x_(1,2)=(-b+-sqrt(b^2 - 4ac))/(2a)`
</p>

<p>
<b>Here is the text that was typed in:</b>
</p>

<pre>
<b>Example:</b> Solving the quadratic equation.
Suppose `ax^2+bx+c=0` and `a!=0`. We first divide by `a` to get `x^2+b/ax+c/a=0`. 

Then we complete the square and obtain `x^2+b/ax+(b/(2a))^2-(b/(2a))^2+c/a=0`. 
The first three terms factor to give `(x+b/(2a))^2=(b^2)/(4a^2)-c/a`.
Now we take square roots on both sides and get `x+b/(2a)=+-sqrt((b^2)/(4a^2)-c/a)`.

Finally we move the `b/(2a)` to the right and simplify to get 
the two solutions: `x_(1,2)=(-b+-sqrt(b^2-4ac))/(2a)`
</pre>

<hr/>

<center>
<b>
If you don't believe this, copy the text and paste it on the 
<a href="asciimathdemo.xml">ASCIIMathML.js: Try it yourself</a> demo page.
</b>
</center>

<hr/>

<h4>
Here are a few more examples:
</h4>

<table id="examples" border="5" cellpadding="10">
<tr>
<th>Type this</th>
<th>See that</th>
<th>Comment</th>
</tr>
<tr>
<td>\`x^2+y_1+z_12^34\`</td>
<td>`x^2+y_1+z_12^34`</td>
<td>subscripts as in TeX, but numbers are treated as a unit</td>
</tr>
<tr>
<td>\`sin^-1(x)\`</td>
<td>`sin^-1(x)`</td>
<td>function names are treated as constants</td>
</tr>
<tr>
<td>\`d/dxf(x)=lim_(h->0)(f(x+h)-f(x))/h\`</td>
<td>`d/dxf(x)=lim_(h->0)(f(x+h)-f(x))/h`</td>
<td>complex subscripts are bracketed, displayed under lim</td>
</tr>
<tr>
<td>\$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}\$</td>
<td>$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</td>
<td>standard LaTeX notation is an alternative</td>
</tr>
<tr>
<td>\`f(x)=sum_(n=0)^oo(f^((n))(a))/(n!)(x-a)^n\`</td>
<td>`f(x)=sum_(n=0)^oo(f^((n))(a))/(n!)(x-a)^n`</td>
<td>f^((n))(a) must be bracketed, else the numerator is only `a`</td>
</tr>
<tr>
<td>\$f(x)=\sum_{n=0}^\infty\frac{f^{(n)}(a)}{n!}(x-a)^n\$</td>
<td>$f(x)=\sum_{n=0}^\infty\frac{f^{(n)}(a)}{n!}(x-a)^n$</td>
<td>standard LaTeX produces the same result</td>
</tr>
<tr>
<td>\`int_0^1f(x)dx\`</td>
<td>`int_0^1f(x)dx`</td>
<td>subscripts must come before superscripts</td>
</tr>
<tr>
<td>\`[[a,b],[c,d]]((n),(k))\`</td>
<td>`[[a,b],[c,d]]((n),(k))`</td>
<td>matrices and column vectors are simple to type</td>
</tr>
<tr>
<td>\`x/x={(1,if x!=0),(text{undefined},if x=0):}\`</td>
<td>`x/x={(1,if x!=0),(text{undefined},if x=0):}`</td>
<td>piecewise defined function are based on matrix notation</td>
</tr>
<tr>
<td>\`a//b\`</td>
<td>`a//b`</td>
<td>use // for inline fractions</td>
</tr>
<tr>
<td>\`(a/b)/(c/d)\`</td>
<td>`(a/b)/(c/d)`</td>
<td>with brackets, multiple fraction work as expected</td>
</tr>
<tr>
<td>\`a/b/c/d\`</td>
<td>`a/b/c/d`</td>
<td>without brackets the parser chooses this particular expression</td>
</tr>
<tr>
<td>\`((a*b))/c\`</td>
<td>`((a*b))/c`</td>
<td>only one level of brackets is removed; * gives standard product</td>
</tr>
<tr>
<td>\`sqrtsqrtroot3x\`</td>
<td>`sqrtsqrtroot3x`</td>
<td>spaces are optional, only serve to split strings that should not match</td>
</tr>
<tr>
<td>\`(:a,b:) and x lt y lt 1\`</td>
<td>`(:a,b:) and x lt ylt1`</td>
<td>the &lt; character is problematic in XML, use 'lt' or put formula in a comment</td>
</tr>
<tr>
<td>\`(a,b]={x in RR : a lt x le b}\`</td>
<td>`(a,b]={x in RR : a lt x le b}`</td>
<td>grouping brackets don't have to match</td>
</tr>
<tr>
<td>\`abc-123.45^-1.1\`</td>
<td>`abc-123.45^-1.1`</td>
<td>non-tokens are split into single characters,<br/>
but decimal numbers are parsed with possible sign</td>
</tr>
<tr>
<td>\`hat(ab) bar(xy) ulA vec v dotx ddot y\`</td>
<td>`hat(ab) bar(xy) ulA vec v dotx ddot y`</td>
<td>accents can be used on any expression (work well in IE)</td>
</tr>
<tr>
<td>\`bb{AB3}.bbb(AB].cc(AB).fr{AB}.tt[AB].sf(AB)\`</td>
<td>`bb{AB3}.bbb(AB].cc(AB).fr{AB}.tt[AB].sf(AB)`</td>
<td>font commands; can use any brackets around argument</td>
</tr>
<tr>
<td>\`stackrel"def"= or \stackrel{\Delta}{=}" "("or ":=)\`</td>
<td>`stackrel"def"= or \stackrel{\Delta}{=}" "("or ":=)`</td>
<td>symbols can be stacked</td>
</tr>
<tr>
<td>\`{::}_(\ 92)^238U\`</td>
<td>`{::}_(\ 92)^238U`</td>
<td>prescripts simulated by subsuperscripts</td>
</tr>
</table>

<p>
If you are familiar with MathML, you can appreciate that this ASCII
input form is less verbose and more readable. If you are familiar with
TeX, this is still somewhat less cluttered. The aim is to have input
notation that is close to graphing calculator notation, so that
students are able to use it on webpages and in emails without having
to learn another specialized syntax.
</p>

<p>
For an explicit description of the input syntax see <a
href="asciimathsyntax.xml">ASCIIMathML.js Syntax and List of
Constants</a>.
</p>

<p>
<b>Acknowledgements:</b> Many thanks to the numerous people who have
contributed to the fantastic MathML standard. Without such a
well designed standard, a project like this would be impossible.<br/>

Thanks to the many volunteers who implemented MathML in the
Gecko layout engine for Netscape7/Mozilla/Firefox.<br/> 

Thanks to the people at Design Science for producing the excellent
MathPlayer plugin and making it freely available.<br/>

Finally, thanks to the designers and implementors of JavaScript.  All
these tools work together fairly seemlessly to allow us to put
mathematical formulas on webpages in a convenient and inexpensive way.<br/>

And thanks to Andrew White for making a logo for ASCIIMathML (see below).
</p>
<hr/>

<div id="author">
<a href="http://www.chapman.edu/~jipsen/">Peter Jipsen</a>, 
<a href="http://www.chapman.edu/">Chapman University</a>, August 2005

<a href="http://validator.w3.org/check?uri=http%3A%2F%2Fwww1.chapman.edu%2F~jipsen%2Fmathml%2Fasciimath.xml"><img
src="http://www.w3.org/Icons/valid-xhtml10"
alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a>
</div>

<p/>
<div class="display">
<a style="color:white" href="../asciimath.html">
<img src="asciimathml.jpeg" alt="ASCIIMathML"/></a>
</div>

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-2263958-1";
urchinTracker();
</script>
</body>
</html>
