<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="http://math.chapman.edu/~jipsen/mathml/pmathml.xsl"?>
<!DOCTYPE html SYSTEM "http://math.chapman.edu/~jipsen/mathml/mathml.dtd" [
  <!ENTITY mathml "http://www.w3.org/1998/Math/MathML">
]>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Chapman Math: ASCIIMath FAQ</title>
<script type="text/javascript" src="http://www1.chapman.edu/~jipsen/mathml/ASCIIMathML.js"></script>
<script type="text/javascript" src="http://math.chapman.edu/~jipsen/TP/TextPuzzles3.js"></script>
<script type="text/javascript" src="http://www1.chapman.edu/~jipsen/svg/ASCIIsvg.js"></script>
<style type="text/css">
a {cursor: pointer; cursor: hand;}
</style>
<link rel="stylesheet" href="/wiki.css"></link>
</head><body bgcolor="white" onload="translate();initPuzzlePieces();if (window.drawPicture!=null) drawPicture()">
<h1><a href="mathxml.pl?search=ASCIIMath+FAQ">ASCIIMath FAQ</a></h1><a href="mathxml.pl?HomePage">HomePage</a> | <a href="mathxml.pl?RecentChanges">RecentChanges</a> | <a href="mathxml.pl?action=editprefs">Preferences</a><br></br>
<hr></hr><b>Why another syntax for math formulas?</b>
<p></p>
Most of the syntax for ASCIIMath is well-known, and students use similar constructions in email. ASCIIMath is simply standardizing this syntax and translating it into nicely readable MathML.
<p></p>
<b>How do I add ASCIIMathML to a wiki, blog or CMS?</b>
<p></p>
Usually this is quite simple since one only has to ensure that the ASCIIMathML.js script is part of each page of the wiki, blog or CMS. If the system is written in PHP, this means a line like 
<p></p>
<pre>echo '&lt;script src=http://your.domain.edu/your/path/to/ASCIIMathML.js&gt;&lt;/script&gt;'."\n";</pre>
<p></p>
should be added in some php file that generates the header of each webpage (e.g. in Moodle 1.5.3+ this could be added to the file .../moodle/lib/javascript.php). If your application is using the HTMLArea editor, it is also possible to extend that with AsciiMath and AsciiSvg plugins so that the editor can show MathML and SVG graphs as you type (see <a href="http://math.chapman.edu/~jipsen/asciencepad/asciencepad.html">http://math.chapman.edu/~jipsen/asciencepad/asciencepad.html</a> for a TiddlyWiki version). Getting these plugins to work is a bit more elaborate than just adding a line in some file: 
<p></p>
For Moodle 1.5.3 you can download <a href="http://math.chapman.edu/~jipsen/moodle15mods.tar.gz">http://math.chapman.edu/~jipsen/moodle15mods.tar.gz</a>, gunzip and tar xf the file, and add/replace the files in your respective Moodle directories with the new versions. Some instructions for using the modified editor to type math can be found at <a href="http://math.chapman.edu/docs/asciimath.html">http://math.chapman.edu/docs/asciimath.html</a>
<p></p>
<b>Why do some brackets (and commas) disappear?</b>
<p></p>
The infix binary operations /, _ (subscript) and ^ (superscript) are "self-delimiting" in the second argument (both arguments for /) when they are displayed in MathML. This means the outer pair of brackets is not required anymore, hence not displayed. Similarly, for a matrix ((a,b),(c,d)), the inner brackets (and commas) are not needed when the matrix is displayed.
<p></p>
<b>Why does ASCIIMath allow non-matching brackets?</b>
<p></p>
Some mathematical constructions require this flexibility, e.g. half open intervals (a,b]. Also to allow the discussion of incorrect mathematical expressions, it is necessary that the syntax is not strict.
<p></p>
<b>Why are all formulas in red?</b>
<p></p>
This helps authors find missing left-quotes. It can be switched to black (or another color) by inserting (an appropriate version of) the following line in the document <pre>&lt;script&gt;mathcolor="Black"&lt;/script&gt;</pre>
<p></p>
<b>Why not simply use LaTeX? (see <a href="http://www.latex-project.org/">http://www.latex-project.org/</a>)</b>
<p></p>
For students who are not familiar with LaTeX, this is not as easy as the ASCIIMath syntax. Of course basic LaTeX formulas can also be used with ASCIIMath.
<p></p>
<b>Why change the LaTeX \$-signs to left-quotes?</b>
<p></p>
One of the main aims of ASCIIMath is that even the input form should be as readable as possible. The \$-signs are visually more distracting when reading the input. It also indicates to other authors or programs that the formula is not necessarily standard LaTeX. As of version 1.2, \$-signs can be used as well, but it is recommmended that they be used for formulas written in (La)TeX. To write a \$-sign in plain text, use \\$ (likewise for left-quotes). Both escape sequences work since version 1.2.
<p></p>
<p></p>
<b>Can formulas be displayed (as with \$\$...\$\$ in LaTeX)?</b>
<p></p>
Yes, use <pre>&lt;center&gt;...&lt;/center&gt; or, more appropriately, use cascading style sheets.</pre> 
All formatting of the document should be done with (X)HTML and/or CSS.
<p></p>
<b>Why do some brackets and stretchy operators become larger than the formula they contain?</b>
<p></p>
For example `quad|A| = |{:(a,b),(c,d):}| = ad-bc quad\ ` (typed as \\`|A| = |{:(a,b),(c,d):}| = ad-bc\\`) has long vertical bars around the `A`. The reason is that brackets and vertical bars stretch to the height of the <b>surrounding</b> box (not the box they enclose). In the case of the vertical bar, the ASCIIMath syntax does not recognize when it is used as a bracket, which means the parser cannot automatically insert the appropriate enclosing &lt;mrow&gt;. So we have to do it manually by adding invisible brackets {: and :}.
<p></p>
`{:|A|:}={:|{:(a,b),(c,d):}|:}=ad-bc quad\ ` (typed as \\`{:|A|:}={:|{:(a,b),(c,d):}|:}=ad-bc\\`)
<p></p>
So, in general, absolute value (or determinant brackets) should be typed as {:| and |:}. While this is not particularly readable, it does produce the correct MathML code.
<p></p>
<p></p>
<b>Is there something like \newcommand in ASCIIMathML?</b>
<p></p>
Yes, but without parameters and quite verbose. Suppose you want DD to expand to d/(dr). Add the following line anywhere in the body (or head) of your file:
<script>AMsymbols = AMsymbols.concat([{input:"DD", tag:"mi", output:"d/(dr)", tex:null, ttype:DEFINITION}])</script><pre>&lt;script&gt;AMsymbols = AMsymbols.concat([{input:"DD", tag:"mi", output:"d/(dr)", tex:null, ttype:DEFINITION}])&lt;/script&gt;</pre>
Now try \`DD(4/3pir^3)=4pir^2\` to get `DD(4/3pir^3)=4pir^2`.
<p></p>
This has now been simplified: <script>newcommand("Dx","d/(dx)")</script><pre>&lt;script&gt;newcommand("Dx","d/(dx)")&lt;/script&gt;</pre> has the same effect: `Dx(x^2)=2x`
<p></p>
<b>Can asciencepad page display other data such as java applets?</b>
<p></p>
Yes, switch to the HTML view in the editor and enter any HTML that you like.
<p></p>
<b></b>
<hr></hr>
<form method="post" action="mathxml.pl" enctype="application/x-www-form-urlencoded">
<a href="mathxml.pl?HomePage">HomePage</a> | <a href="mathxml.pl?RecentChanges">RecentChanges</a> | <a href="mathxml.pl?action=editprefs">Preferences</a><br></br>
This page is read-only | <a href="mathxml.pl?action=history;id=ASCIIMath_FAQ">View other revisions</a><br></br>Last edited May 24, 2006 10:41 pm <a href="mathxml.pl?action=browse;diff=1;id=ASCIIMath_FAQ">(diff)</a><br></br>Search: <input type="text" name="search"  size="20" /><input type="hidden" name="dosearch" value="1"  /></form><script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-2263958-2";
urchinTracker();
</script>

</body>
</html>