Actualización
This commit is contained in:
4891
main/inc/lib/javascript/asciimath/ASCIIMathML.js
Normal file
4891
main/inc/lib/javascript/asciimath/ASCIIMathML.js
Normal file
File diff suppressed because it is too large
Load Diff
363
main/inc/lib/javascript/asciimath/asciimath.html
Normal file
363
main/inc/lib/javascript/asciimath/asciimath.html
Normal file
@@ -0,0 +1,363 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>ASCIIMathML: Math on the web for everyone</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script type="text/javascript" src="ASCIIMathML.js"></script>
|
||||
<style type="text/css">
|
||||
#menu, #title, #subtitle, #author, .display {text-align: center}
|
||||
body {font-family: Arial; background-color:beige}
|
||||
p,table {font-family: Times}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="menu">
|
||||
| <a href="asciimath.html">Home Page</a> |
|
||||
<a href="asciimathsyntax.html">Syntax</a> |
|
||||
<a href="asciimathdemo.html">Try it</a> |
|
||||
<a href="asciimathcalculator.html">Calculator</a> |
|
||||
<a href="http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html">Download</a> |
|
||||
<a href="http://mathcs.chapman.edu/~jipsen/math/index.php/ASCIIMathML/ASCIIMathGraphs.html">Graphs</a> |
|
||||
<a href="http://mathcs.chapman.edu/~jipsen/math/index.php/ASCIIMathML/ASCIIMathFAQ.html">ASCIIMath FAQ</a> |
|
||||
<a href="http://mathcs.chapman.edu/~jipsen/math/index.php/ASCIIMathML/ASCIIMathMLSandbox.html">Sandbox</a> |
|
||||
<a href="http://mathcs.chapman.edu/~jipsen/math/index.php/ASCIIMathML/ASCIIMathCommentsAndSuggestions.html">Comments</a> |
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<h2 id="title">
|
||||
ASCIIMathML.js (ver 2.0): Translating ASCII math notation to MathML
|
||||
and graphics</h2>
|
||||
|
||||
<h4 align="center">
|
||||
Would you or your students like to <i>easily</i> produce
|
||||
<i>good-looking</i> math formulas on webpages<br/>
|
||||
using a <i>simple</i> calculator-style syntax and your
|
||||
own ASCII or HTML 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 one line to your
|
||||
HTML file to load ASCIIMathML.js
|
||||
</font></b><p>
|
||||
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>
|
||||
</p>
|
||||
|
||||
<font color="red"><b>New:</b></font> Now with <b>automatic math recognition</b>
|
||||
mode, better LaTeX support and graphics integration<br/>
|
||||
A <a href="http://mathcs.chapman.edu/~jipsen/math/index.php/ASCIIMathML/ASCIIMathMLMoodleFilter.html">Moodle filter</a> and a <a href="http://mathcs.chapman.edu/~jipsen/math/index.php/ASCIIMathML/ASCIIMathMLPmWikiCookbook.html">PmWiki cookbook</a> are also available<br/>
|
||||
<a href="http://www.pierce.ctc.edu/dlippman/asciimathtex/AMT.html">ASCIIMath Image Fallback Scripts</a> by David Lippman (including a Moodle filter)<br/>
|
||||
and 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.jcphysics.com/ASCIIMath/">ASCIIMathPHP</a> by <a
|
||||
href="mailto:kc56@cornell.edu">Steven Chan</a>.
|
||||
</center>
|
||||
|
||||
<p>
|
||||
|
||||
This is the main page (HTML version) for the ASCIIMathML.js script which allows
|
||||
incorporating mathematical formulas on webpages with a minimum of
|
||||
fuss (just add one line to a webpage to load the script).
|
||||
If you like what you see, choose <b>Save As...</b> in your browser
|
||||
and this page should work equally well locally on your machine.
|
||||
</p>
|
||||
|
||||
<p class="display">
|
||||
<b>
|
||||
This page requires Internet Explorer 6 + <a href=
|
||||
"http://www.dessci.com/en/products/mathplayer/welcome.asp">MathPlayer</a>
|
||||
or Netscape7.1/Mozilla/Firefox.
|
||||
</b>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
ASCIIMathML.js is freely available under the <a
|
||||
href="http://www.gnu.org/licenses/lgpl.html">GNU Lesser General Public
|
||||
License</a>. You can get your own copy from the <a href=
|
||||
"http://www.chapman.edu/~jipsen/mathml/asciimathdownload/">ASCIIMathML.js
|
||||
download page</a>. The script works with both HTML and XHTML webpages.
|
||||
(The homepage for an XML
|
||||
version is at <a href="asciimath.xml">asciimath.xml</a> but is no
|
||||
longer maintained).
|
||||
|
||||
</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>. M-->my students are also using it in Moodle
|
||||
for writing and reading homework in their calculus class and
|
||||
discrete mathematics class.
|
||||
<font color="red">
|
||||
If you just want to display MathML on HTML pages using
|
||||
Netscape/Mozilla/Firefox or IE+MathPlayer, have a look at <a
|
||||
href="http://www1.chapman.edu/~jipsen/mathml/mathhtml">mathhtmltest</a>
|
||||
(the page includes a 50 line JavaScript program that does the trick).
|
||||
</font>
|
||||
</p>
|
||||
|
||||
<hr/>
|
||||
|
||||
<p>
|
||||
<b>Let's test the ASCIIMathML.js translator on a simple example.</b>
|
||||
</p>
|
||||
|
||||
<p>amath
|
||||
<b>Example:</b> Solving the quadratic equation.
|
||||
Suppose a x^2+b x+c=0 and a!=0. We first
|
||||
divide by \a to get x^2+b/a x+c/a=0.
|
||||
|
||||
Then we complete the square and obtain x^2+b/a x+(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 subtract b/(2a) from both sides and simplify to get
|
||||
the two solutions: x_(1,2)=(-b+-sqrt(b^2 - 4a c))/(2a)
|
||||
</p>
|
||||
endamath
|
||||
|
||||
<p>
|
||||
<b>Here is the text that was typed in (<font color="red">using the new
|
||||
auto-math-recognize mode</font> started by "a``math"):</b>
|
||||
|
||||
</p>
|
||||
|
||||
<pre>amath
|
||||
<b>Example:</b> Solving the quadratic equation.
|
||||
Suppose a x^2+b x+c=0 and a!=0. We first divide by \a to get x^2+b/a x+c/a=0.
|
||||
|
||||
Then we complete the square and obtain x^2+b/a x+(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-4a c))/(2a)
|
||||
</pre>
|
||||
|
||||
<hr/>
|
||||
|
||||
<center>
|
||||
<b>
|
||||
If you don't believe this, copy the text and paste it on the
|
||||
<a href="asciimathdemo.html">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>\`sqrt sqrt root3x\`</td>
|
||||
<td>`sqrt sqrt root3x`</td>
|
||||
<td>spaces are optional, only serve to split strings that should not match</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\`<< a,b >> and {:(x,y),(u,v):}\`</td>
|
||||
<td>`<< a,b >> and {:(x,y),(u,v):}`</td>
|
||||
<td>angle brackets and invisible brackets</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>\`(a,b]={x in RR | a < x <= b}\`</td>
|
||||
|
||||
<td>`(a,b]={x in RR | a < x <= 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.html">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>, September 2007
|
||||
|
||||
<a href="http://validator.w3.org/check/referer"><img border="0"
|
||||
src="http://www.w3.org/Icons/valid-html401"
|
||||
alt="Valid HTML 4.01!" 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>
|
||||
</body>
|
||||
</html>
|
||||
118
main/inc/lib/javascript/asciimath/asciimathcalculator.html
Normal file
118
main/inc/lib/javascript/asciimath/asciimathcalculator.html
Normal file
@@ -0,0 +1,118 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>ASCIIMath Calculator Demo</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script type="text/javascript" src="ASCIIMathML.js"></script>
|
||||
<!--script type="text/javascript">mathfontsize=".9em"</script-->
|
||||
<style type="text/css">
|
||||
#menu, #title, #subtitle, #author {text-align: center}
|
||||
body {font-family: Arial; background-color:beige}
|
||||
p,table {font-family: Times}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="menu">
|
||||
| <a href="asciimath.html">Home Page</a> |
|
||||
<a href="asciimathsyntax.html">Syntax</a> |
|
||||
<a href="asciimathdemo.html">Try it</a> |
|
||||
<a href="asciimathcalculator.html">Calculator</a> |
|
||||
<a href="http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html">Download</a> |
|
||||
<a href="http://mathcs.chapman.edu/~jipsen/math/index.php/ASCIIMathML/ASCIIMathGraphs.html">Graphs</a> |
|
||||
<a href="http://mathcs.chapman.edu/~jipsen/math/index.php/ASCIIMathML/ASCIIMathFAQ.html">ASCIIMath FAQ</a> |
|
||||
<a href="http://mathcs.chapman.edu/~jipsen/math/index.php/ASCIIMathML/ASCIIMathMLSandbox.html">Sandbox</a> |
|
||||
<a href="http://mathcs.chapman.edu/~jipsen/math/index.php/ASCIIMathML/ASCIIMathCommentsAndSuggestions.html">Comments</a> |
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<h2 id="title">
|
||||
ASCIIMath Scientific Calculator (ver 1.2)
|
||||
</h2>
|
||||
|
||||
<h4 align="center">
|
||||
A free webpage calculator with live MathML display
|
||||
</h4>
|
||||
|
||||
<h4 align="center">
|
||||
This page requires Internet Explorer 6+<a
|
||||
href="http://www.dessci.com/en/products/mathplayer">MathPlayer</a>
|
||||
or Mozilla/Firefox/Netscape 7+.
|
||||
</h4>
|
||||
|
||||
<div class="ASCIIMathCalculator"></div>
|
||||
|
||||
<p>
|
||||
More calculator areas:<br>
|
||||
<textarea id="in1" rows="2" cols="40" onkeyup="calculate('in1','out1')">
|
||||
2sin^-1(1)</textarea> <span id="out1"></span>
|
||||
<p/>
|
||||
|
||||
<p>
|
||||
<textarea id="in2" rows="2" cols="30"
|
||||
onkeyup="calculate('in2','out2');calculate('in3','out3')">
|
||||
a=5; b=4; c=-1; (-b+sqrt(b^2-4a*c))/(2a)
|
||||
</textarea> <span id="out2"></span>
|
||||
<br/>
|
||||
<textarea id="in3" rows="1" cols="30"
|
||||
onkeyup="calculate('in2','out2');calculate('in3','out3')">
|
||||
(-b-sqrt(b^2-4a*c))/(2a)</textarea> <span id="out3"></span>
|
||||
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Note that this is dynamic HTML running locally on your machine.</b>
|
||||
<br/>
|
||||
Right-click on the output to copy or view the MathML code (or have it
|
||||
<b>spoken</b> in IE+MathPlayer).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Some technical remarks:</b> This calculator works only in radians.
|
||||
(Multiply angles by pi/180 to convert from degrees to radians.)
|
||||
<br/>
|
||||
|
||||
The syntax is loosely based on JavaScript and a subset of ASCIIMathML.
|
||||
<br/>
|
||||
The multiplication symbol * can be omitted after a digit (0-9)
|
||||
or a closing parenthesis.
|
||||
<br/>
|
||||
Available constants and functions:
|
||||
<br/>
|
||||
+, -, *, /, ^, pi, e, sqrt(), ln(), abs(), sign(),
|
||||
floor(), ceil(), n!, C(n,k), ran(a,b,n)
|
||||
<br/>
|
||||
sin(), cos(), tan(), sin^-1(), cos^-1(), tan^-1(),
|
||||
sinh(), cosh(), tanh(), sinh^-1(), cosh^-1(), tanh^-1()
|
||||
<br/>
|
||||
sec(), csc(), cot(), sec^-1(), csc^-1(), cot^-1(),
|
||||
sech(), csch(), coth(), sech^-1(), csch^-1(), coth^-1()
|
||||
|
||||
<br/>
|
||||
Values can be assigned to (legal JavaScript) variable names.
|
||||
Use ";" to separate expressions.
|
||||
<br/>
|
||||
Any number of calculator textareas can be placed anywhere on <b>your own</b>
|
||||
webpages.
|
||||
</p>
|
||||
ASCIIMathML and this calculator are freely available under the
|
||||
<a href="http://www.gnu.org/licenses/lgpl.html">GNU Lesser General
|
||||
Public License</a>. Please include a link to <a
|
||||
href="http://asciimathml.sourceforge.net">asciimathml.sourceforge.net</a>
|
||||
on any webpage that makes use of them, and send a link of your webpage
|
||||
to <a href="mailto:jipsen@chapman.edu">jipsen@chapman.edu</a>.
|
||||
|
||||
<hr/>
|
||||
|
||||
<div id="author">
|
||||
<a href="http://www.chapman.edu/~jipsen/">Peter Jipsen</a>,
|
||||
<a href="http://www.chapman.edu/">Chapman University</a>, May 2007
|
||||
|
||||
<a href="http://validator.w3.org/check/referer"><img border="0"
|
||||
src="http://www.w3.org/Icons/valid-html401"
|
||||
alt="Valid HTML 4.01!" height="31" width="88"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
227
main/inc/lib/javascript/asciimath/asciimathchanges.txt
Normal file
227
main/inc/lib/javascript/asciimath/asciimathchanges.txt
Normal file
@@ -0,0 +1,227 @@
|
||||
Changes file for ASCIIMathML.js
|
||||
===============================
|
||||
|
||||
Sep 27, 2007 Version 2.0
|
||||
(at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML20.js)
|
||||
|
||||
- included LaTeXMathML.js and ASCIIsvg.js in the ASCIIMathML script
|
||||
|
||||
- changed license to GNU LGPL 2.1
|
||||
|
||||
- Added auto-math-recognize mode (amath ... endamath)
|
||||
|
||||
- Added some LaTeX environments and simple formatting
|
||||
|
||||
- Created Moodle filter and PmWiki cookbook
|
||||
|
||||
- Added MathML text labels to SVG graphs
|
||||
|
||||
- Fixed SVG cursor tracking in Firefox
|
||||
|
||||
- Added stroke/fillopacity to graphs
|
||||
|
||||
- Simplified syntax for graph inclusion
|
||||
|
||||
- SVG mouseevents are now added in the scope of the graph code
|
||||
|
||||
- MathML fontsize can now be magnified relative to surrounding text
|
||||
|
||||
-------------------------------
|
||||
|
||||
Aug 7, 2005 Version 1.4.7
|
||||
(at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML147.js)
|
||||
|
||||
- changed IE MathML prefix from mml: to m: (default of MathPlayer, so now
|
||||
<html> works without the xmlns attribute)
|
||||
|
||||
- for IE the script now writes out the <object ...> and <?import ...> tags
|
||||
simplifying the header file significantly
|
||||
|
||||
- script now uses a generic onload (by www.brothercake.com) so
|
||||
no need for onload="translate()" in <body> (but earlier pages still work)
|
||||
|
||||
- ASCIIMathML.js can now be used on any HTML page by just adding one line to
|
||||
load the script. So validating your HTML pages is now possible, and use
|
||||
of HTML editors is simple.
|
||||
|
||||
- added unparametrized macros: put <script>newcommand("short","long")</script>
|
||||
on your webpage and each occurrence of "short" is replaced by "long"
|
||||
|
||||
- added /_ (\angle) and :. (\therefore) as symbols
|
||||
|
||||
- made an ASCIIMath plugin for Xinha HTML editor (see editor link on homepage)
|
||||
with instant preview, template popup and builtin calculator
|
||||
|
||||
-------------------------------
|
||||
|
||||
Apr 23, 2005 Version 1.4.6
|
||||
(at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML146.js)
|
||||
|
||||
- added "showasciiformulaonhover" variable; if true then pointing at a MathML
|
||||
expression shows the ascii form that produces the expression
|
||||
|
||||
- added "decimalsign" variable; default is "."
|
||||
|
||||
- removed "separatetokens" option (to speed up token recognition)
|
||||
|
||||
- changed |-, |=, |_, _| to |--, |==, |__, __| to avoid parsing problems
|
||||
e.g. |-x|, |x|=a, ||A||_1 now parse as expected
|
||||
|
||||
- changed parser so that "-" is unary if previous token is INFIX
|
||||
e.g. now x^-y works like x^(-y) (but x-y is same as x - y)
|
||||
|
||||
- added "spanclassAM" option; invoked by translate(true), all math should
|
||||
then be delimited by <span class="AM">...</span>; translate() works as before
|
||||
|
||||
-------------------------------
|
||||
|
||||
Jan 30, 2005 Version 1.4.5
|
||||
(at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML145.js)
|
||||
|
||||
- added TEXT token type for \text{...}, \mbox{...} and "..."
|
||||
|
||||
- changed sin, cos, tan, ..., lcm to UNARY type (func); now 1/sinx works
|
||||
|
||||
- changed parser so that ^, _ have priority over /
|
||||
now x_1/3^2 works like (x_1)/(3^2)
|
||||
|
||||
-------------------------------
|
||||
|
||||
Jan 14, 2005 Version 1.4.4
|
||||
(at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML144.js)
|
||||
|
||||
- added "mathfontfamily" variable (default "serif")
|
||||
|
||||
- mathcolor and mathfontfamily can be "" to inherit values of surrounding text
|
||||
|
||||
- added "AMdelimiter" variables to set math delimiters (default "`" and "$")
|
||||
|
||||
- added LEFTRIGHT token type for "|"; now `|x|` displays like `{:|x|:}`;
|
||||
a single | still parses as \mid e.g. in {x | x > 0}
|
||||
|
||||
-------------------------------
|
||||
|
||||
Dec 28, 2004 Version 1.4.3
|
||||
(at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML143.js)
|
||||
|
||||
- added mapsto |->
|
||||
|
||||
- fixed a parsing error that was generated by incomplete fractions (1/)
|
||||
|
||||
- fixed parsing of negative numbers (<mn>-1</mn> is now translated to
|
||||
<mrow><mo>-</mo><mn>1</mn></mrow>)
|
||||
|
||||
- added notifyIfNoMathML flag. If false, no note is inserted at top of page.
|
||||
|
||||
- included ASCIIMathCalculator.js: a small script that implements a
|
||||
webpage calculator with live MathML preview
|
||||
|
||||
-------------------------------
|
||||
|
||||
Nov 12, 2004 Version 1.4.2
|
||||
(at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML142.js)
|
||||
|
||||
- added constants for: setminus, vdots, ddots, glb, lub
|
||||
|
||||
-------------------------------
|
||||
|
||||
Aug 16, 2004 Version 1.4.1
|
||||
(at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML141.js)
|
||||
|
||||
- fixed a typo to make the check for MathML capability work correctly
|
||||
|
||||
- added stackrel command (mover in MathML), e.g. stackrel{def}{=}
|
||||
|
||||
- added := as binary relation to get spacing right in Mozilla/Firefox/Netscape
|
||||
|
||||
-------------------------------
|
||||
|
||||
July 13, 2004 Version 1.4
|
||||
(at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML4.js)
|
||||
|
||||
- cleaned up the js code, thanks to some very helpful suggestions by Alex V.
|
||||
|
||||
- most global variables prefixed with "AM" to avoid conflict with ASCIIsvg.js
|
||||
|
||||
- added macro definition ability to define dx, dy, dz, ...
|
||||
e.g. now dx is replaced by {d x}, so `d/dx` can be used rather than `d/(dx)`.
|
||||
Users can add their own (parameterless) macros.
|
||||
|
||||
- added check for MathML capability. If absent, inserts note at top of page.
|
||||
|
||||
- unmatched right bracket no longer ends expression. E.g. in `cosx]_0^1`
|
||||
the "]" is treated simply as a constant symbol (better to use `{:cosx]_0^1`).
|
||||
|
||||
- numeric unicode entity names can be used for unnamed symbols, e.g. `≰`
|
||||
|
||||
-------------------------------
|
||||
|
||||
Mar 26, 2004 Version 1.3
|
||||
(at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML3.js)
|
||||
|
||||
- fixed parser so that unary/binary symbols without arguments are treated
|
||||
as constants (previously generated js error)
|
||||
|
||||
- noticed that ASCIIMathML.js does not require XML, actually works in HTML
|
||||
on multiple browsers (required no change to the script)
|
||||
|
||||
- added `"any"` as alternative to `text{any}`
|
||||
|
||||
- added min, max as standard function names (subscripts go underneath)
|
||||
|
||||
- added o. (\odot) as symbol
|
||||
|
||||
- added separatetokens flag: lowercase tokens must be separated by nonletters
|
||||
(if true, `sinx` is a sequence of 4 variables, instead use `sin x`)
|
||||
switched off by default, can be switched on (see top of ASCIIMathML.js)
|
||||
|
||||
- added (experimental) doubleblankmathdelimiter so a+b is same as `a+b`
|
||||
switched off by default, can be switched on (see top of ASCIIMathML.js)
|
||||
|
||||
-------------------------------
|
||||
|
||||
Feb 8, 2004 Version 1.2
|
||||
(at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML2.js)
|
||||
|
||||
- added accents: hat bar ul vec dot ddot
|
||||
|
||||
- added sans-serif font: sf
|
||||
|
||||
- both `...` and $...$ are now allowed as math delimiters
|
||||
|
||||
- \$ and \` can now be used to insert $ or ` in plain text
|
||||
|
||||
- `a text{ sometext }b` now shows the space around "sometext"
|
||||
|
||||
- blocks of ASCIIMathML + text can be enclosed in comments <!-- -->
|
||||
in which case blank lines are converted to paragraph breaks;
|
||||
inside comments the < character can be used (does not cause XML error)
|
||||
(use this "comment mode" with caution; future versions of IE or
|
||||
Mozilla may not display it the same way)
|
||||
|
||||
-------------------------------
|
||||
|
||||
Jan 9, 2004 Version 1.1
|
||||
(at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML1.js)
|
||||
|
||||
- added \vdash, \models (actually ⊨!), \vartheta, \bigwedge, \bigvee,
|
||||
\bigcup, \bigcap, \propto, \oint to symbol table, with ASCII equivalents
|
||||
|
||||
- renamed "subset, supset" to their entity names "sube, supe",
|
||||
added "sub, sup" and their LaTeX equivalents \subset, \supset
|
||||
|
||||
- updated webpages
|
||||
|
||||
-------------------------------
|
||||
|
||||
Jan 6, 2004 Version 1.0
|
||||
(now at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML0.js)
|
||||
|
||||
- calligraphic, black board bold and fraktur fonts are finally working
|
||||
also in Mozilla/Netscape 7
|
||||
|
||||
- added a download page
|
||||
|
||||
- added GNU GPL notices
|
||||
|
||||
===============================
|
||||
117
main/inc/lib/javascript/asciimath/asciimathdemo.html
Normal file
117
main/inc/lib/javascript/asciimath/asciimathdemo.html
Normal file
@@ -0,0 +1,117 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>ASCIIMathML.js demo</title>
|
||||
<script type="text/javascript" src="ASCIIMathML.js"></script>
|
||||
<script type="text/javascript">
|
||||
translateOnLoad=false;
|
||||
function display() {
|
||||
var str = document.getElementById("inputText").value;
|
||||
var outnode = document.getElementById("outputNode");
|
||||
var n = outnode.childNodes.length;
|
||||
for (var i=0; i<n; i++)
|
||||
outnode.removeChild(outnode.firstChild);
|
||||
outnode.appendChild(document.createTextNode(str));
|
||||
AMprocessNode(outnode);
|
||||
}
|
||||
</script>
|
||||
<style type="text/css">
|
||||
#menu, #title, #subtitle, #author {text-align: center}
|
||||
body {font-family: Arial; background-color:beige;}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="display()">
|
||||
|
||||
<div id="menu">
|
||||
| <a href="asciimath.html">Home Page</a> |
|
||||
<a href="asciimathsyntax.html">Syntax</a> |
|
||||
<a href="asciimathdemo.html">Try it</a> |
|
||||
<a href="asciimathcalculator.html">Calculator</a> |
|
||||
<a href="http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html">Download</a> |
|
||||
<a href="http://mathcs.chapman.edu/~jipsen/math/index.php/ASCIIMathML/ASCIIMathGraphs.html">Graphs</a> |
|
||||
<a href="http://mathcs.chapman.edu/~jipsen/math/index.php/ASCIIMathML/ASCIIMathFAQ.html">ASCIIMath FAQ</a> |
|
||||
<a href="http://mathcs.chapman.edu/~jipsen/math/index.php/ASCIIMathML/ASCIIMathMLSandbox.html">Sandbox</a> |
|
||||
<a href="http://mathcs.chapman.edu/~jipsen/math/index.php/ASCIIMathML/ASCIIMathCommentsAndSuggestions.html">Comments</a> |
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<h2 id="title">
|
||||
ASCIIMathML.js: Try it yourself (HTML version)
|
||||
</h2>
|
||||
|
||||
<center>
|
||||
<b>
|
||||
This page requires Internet Explorer 6+<a
|
||||
href="http://www.dessci.com/en/products/mathplayer">MathPlayer</a>
|
||||
or Mozilla/Firefox/Netscape 7+.
|
||||
</b>
|
||||
<p>
|
||||
Edit the formulas below (the display updates dynamically).
|
||||
If you know (La)TeX formula syntax, you can try some of that as well
|
||||
(LaTeX formulas work best when enclosed in $-signs).
|
||||
The "amath" token switches on the new auto-math-recognize mode.</p>
|
||||
|
||||
<form>
|
||||
<textarea id="inputText" rows="10" cols="80" onkeyup="display()">
|
||||
amath
|
||||
|
||||
Let's try some interesting formulas: E=m c^2
|
||||
and e^(i pi)=-1
|
||||
and AA x in CC (sin^2x+cos^2x=1)
|
||||
and one more: sum_(i=1)^n i^3=((n(n+1))/2)^2
|
||||
|
||||
(add your own -- note that text-tokens are only recognized if separated by spaces)
|
||||
|
||||
</textarea>
|
||||
</form>
|
||||
|
||||
<p>
|
||||
<div id="outputNode"></div>
|
||||
</p>
|
||||
|
||||
<hr/>
|
||||
<p>
|
||||
<b>Note that this is dynamic XHTML running locally on your machine!</b>
|
||||
<br>
|
||||
Right-click on an output formula to copy or view the MathML code.
|
||||
</p>
|
||||
</center>
|
||||
(Copy and paste the following lines to see what symbols they produce)<br/>
|
||||
<b>You can use the following ASCIIMathML constructs:</b>
|
||||
<tt> `(x+1)/(x-1) x^(i+j) x_(ij) sqrt(x) root(n)(x) stackrel(+)(->) text(any) "any"`</tt><br/>
|
||||
<b>Operation symbols</b>
|
||||
<tt> `+ - * ** // \\ xx -: @ o+ ox sum prod ^^ ^^^ vv vvv nn nnn uu uuu`</tt><br/>
|
||||
<b>Relation symbols</b>
|
||||
<tt> `= != < <= > >= -< >- in !in sub sup sube supe -= ~= ~~ prop`</tt><br/>
|
||||
<b>Logical symbols</b><tt> `\and \or \not => if iff AA EE _|_ TT |-- |==`</tt><br/>
|
||||
<b>Miscellaneous symbols</b>
|
||||
<tt> `int oint del grad +- O/ oo aleph ... cdots \ quad qquad diamond square |__ __| |~ ~| CC NN QQ RR ZZ`</tt><br/>
|
||||
<b>Standard functions</b>
|
||||
<tt> `sin cos tan csc sec cot sinh cosh tanh log ln det dim lim mod gcd lcm`</tt><br/>
|
||||
<b>Grouping brackets</b><tt> `( ) [ ] { } (: :) {: :}` </tt>
|
||||
<b>Arrows</b><tt> `uarr darr rarr -> larr harr rArr lArr hArr` </tt><br/>
|
||||
<b>Accents</b><tt> `hatx barx ulx vecx dotx ddotx` </tt>
|
||||
<b>Font commands</b><tt> `bbA bbbA ccA ttA frA sfA` </tt>
|
||||
<b>Matrices</b><tt> `[[a,b],[c,d]] ((1,0),(0,1))` </tt><br/>
|
||||
<b>Greek letters</b><tt> `alpha beta chi delta Delta epsi eta gamma Gamma
|
||||
iota kappa lambda Lambda mu nu omega Omega phi Phi pi Pi psi rho sigma Sigma
|
||||
tau theta Theta upsilon xi Xi zeta`</tt>
|
||||
|
||||
<p>
|
||||
This demo page shows that ASCIIMathML.js can be used easily to
|
||||
dynamically preview mathematical formulas (client-side). E.g. here is a
|
||||
(beta) webpage that can be used to <b><a
|
||||
href="http://math.chapman.edu/email/">write and read
|
||||
mathematical emails and discussion group articles</a></b>. Since most
|
||||
email communication is still done with ASCII text (or at least not yet
|
||||
with XHTML), this is a reasonable (and inexpensive) solution for
|
||||
communicating with students in online math courses.
|
||||
</p>
|
||||
|
||||
<hr/>
|
||||
<div id="author">
|
||||
<a href="http://www.chapman.edu/~jipsen/">Peter Jipsen</a>,
|
||||
<a href="http://www.chapman.edu/">Chapman University</a>, September 2007
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
76
main/inc/lib/javascript/asciimath/asciimathextend.html
Normal file
76
main/inc/lib/javascript/asciimath/asciimathextend.html
Normal file
@@ -0,0 +1,76 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Extending ASCIIMathML</title>
|
||||
<script type="text/javascript" src="ASCIIMathML.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
define("!<=","\u2270")
|
||||
define("!>=","\u2271")
|
||||
newcommand("\\nle","\u2270")
|
||||
newcommand("\\nge","\u2271")
|
||||
</script>
|
||||
</head>
|
||||
<body bgcolor="beige">
|
||||
|
||||
<h2>ASCIIMathML.js: Extending the symbol table</h2>
|
||||
|
||||
<p>
|
||||
The standard symbol table of ASCIIMathML.js does not contain many symbols.
|
||||
It can be extended by adding additional symbols on any webpage that
|
||||
requires them. This is done by adding a few lines of JavaScript code.
|
||||
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For example, suppose we want to add symbols for "not less or equal" and
|
||||
"not greater or equal".
|
||||
</p>
|
||||
|
||||
<p>
|
||||
We first have to find the four-digit hexadecimal Unicode value for
|
||||
these symbols by looking them up at, say, <a
|
||||
href="http://www.w3.org/TR/MathML2/chapter6.html#chars.entity.tables">http://www.w3.org/TR/MathML2/chapter6.html#chars.entity.tables</a>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Next we have to decide what input strings we want to associate with these
|
||||
symbols, say "!<=" and "!>=".
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Finally we add the following lines to the head or body of our HTML file:
|
||||
<pre style="border-style:groove"><script type="text/javascript">
|
||||
define("!<=","\u2270")
|
||||
define("!>=","\u2271")
|
||||
</script>
|
||||
</pre>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Here we test the modified symbol table:
|
||||
<tt>\`a !<= b !>= c\`</tt> produces `a !<= b !>= c`
|
||||
</p>
|
||||
|
||||
<p>To add a symbol to the LaTeX commands, use the following alternate syntax:
|
||||
<pre style="border-style:groove"><script type="text/javascript">
|
||||
newcommand("\\nle","\u2270")
|
||||
newcommand("\\nge","\u2271")
|
||||
</script>
|
||||
</pre>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Now
|
||||
<tt>\$a \nle b \nge c\$</tt> produces $a \nle b \nge c$.
|
||||
</p>
|
||||
|
||||
<hr/>
|
||||
<p>
|
||||
If you know the numeric entity reference of the symbol you want to use
|
||||
on an ASCIIMathML webpage, you can also refer to the symbol directly
|
||||
by using that reference. E.g \`&#x2270;\` produces `≰`.
|
||||
If a symbol is only used occasionally, this is certainly the simplest
|
||||
way to include it.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
38
main/inc/lib/javascript/asciimath/asciimathsample.html
Normal file
38
main/inc/lib/javascript/asciimath/asciimathsample.html
Normal file
@@ -0,0 +1,38 @@
|
||||
<html xmlns:mml="http://www.w3.org/1998/Math/MathML">
|
||||
<head>
|
||||
<script type="text/javascript" src="ASCIIMathML.js"></script>
|
||||
<title>ASCIIMathML sample page</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h2>ASCIIMathML.js sample page</h2>
|
||||
|
||||
<p>
|
||||
Use auto-math-recognize mode (amath here x^2 and text is
|
||||
mixed endamath) or surround ASCIIMath formulas
|
||||
with left-quotes:
|
||||
`sum_(i=1)^n i=(n(n+1))/2` or LaTeX formulas with \$-signs
|
||||
$\int_0^{\pi/2} \sin x\,dx=1$.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
And here is a simple graph:
|
||||
|
||||
agraph plot(sin(x)) endagraph
|
||||
|
||||
followed by a more elaborate graph (try double-clicking it, also
|
||||
while holding down shift or alt)
|
||||
|
||||
agraph
|
||||
width=300; height=200; xmin=-5; xmax=5; xscl=1;
|
||||
plot((x-2)*(x-1)*x*(x+1)*(x+2)/2,-2.5,2.5);
|
||||
endagraph
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Note: this page uses a relative link to ASCIIMathML.js,
|
||||
so the script should be in the same folder as this sample file.
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
506
main/inc/lib/javascript/asciimath/asciimathsyntax.html
Normal file
506
main/inc/lib/javascript/asciimath/asciimathsyntax.html
Normal file
@@ -0,0 +1,506 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>ASCIIMathML: Syntax and constants</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script type="text/javascript" src="ASCIIMathML.js"></script>
|
||||
<style type="text/css">
|
||||
#menu, #title, #subtitle, #author {text-align: center}
|
||||
body {font-family: Arial; background-color:beige}
|
||||
p,table {font-family: Times}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="menu">
|
||||
| <a href="asciimath.html">Home Page</a> |
|
||||
<a href="asciimathsyntax.html">Syntax</a> |
|
||||
<a href="asciimathdemo.html">Try it</a> |
|
||||
<a href="asciimathcalculator.html">Calculator</a> |
|
||||
<a href="http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html">Download</a> |
|
||||
<a href="http://mathcs.chapman.edu/~jipsen/math/index.php/ASCIIMathML/ASCIIMathGraphs.html">Graphs</a> |
|
||||
<a href="http://mathcs.chapman.edu/~jipsen/math/index.php/ASCIIMathML/ASCIIMathFAQ.html">ASCIIMath FAQ</a> |
|
||||
<a href="http://mathcs.chapman.edu/~jipsen/math/index.php/ASCIIMathML/ASCIIMathMLSandbox.html">Sandbox</a> |
|
||||
<a href="http://mathcs.chapman.edu/~jipsen/math/index.php/ASCIIMathML/ASCIIMathCommentsAndSuggestions.html">Comments</a> |
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<h2 id="title">
|
||||
ASCIIMathML.js (ver 2.0): Syntax and List of Constants
|
||||
</h2>
|
||||
|
||||
<h4 id="subtitle">
|
||||
The main aims of the ASCIIMathML syntax are: -- 1. close to standard
|
||||
mathematical notation -- 2. easy to read -- 3. easy to type
|
||||
</h4>
|
||||
|
||||
<p>
|
||||
You can use your favorite editor to write HTML pages that use this
|
||||
JavaScript program. If the page is viewed by a browser that does not
|
||||
support MathML or JavaScript, the ASCII formulas are still quite
|
||||
readable. Most users will not have to read the technicalities on
|
||||
this page. If you type
|
||||
</p>
|
||||
|
||||
<pre>amath x^2 or a_(m n) or a_{m n} or (x+1)/y or sqrtx endamath</pre>
|
||||
|
||||
<p>
|
||||
you pretty much get what you expect: amath x^2 or a_(m n) or a_{m n} or
|
||||
(x+1)/y or sqrtx endamath. The a``math ... enda``math tokens are used to
|
||||
start/stop the <b>new auto-math-recognize mode</b>. Of course one can still use
|
||||
the \`...\` back-quotes to delimit math formulas explicitly
|
||||
(\$...\$ should only be used for LaTeX formulas).
|
||||
The choice of grouping parenthesis is up to you
|
||||
(they don't have to match either). If the displayed expression can be
|
||||
parsed uniquely without them, they are omitted. Printing the table of
|
||||
constant symbols (below) may be helpful (but is not necessary if you
|
||||
know the LaTeX equivalents).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
It is hoped that this simple input format for MathML will further
|
||||
encourage its use on the web. The remainder of this page gives a fairly
|
||||
detailed specification of the ASCII syntax. <b>The expressions described here
|
||||
correspond to a wellspecified subset of Presentation MathML and behave
|
||||
in a predictable way.</b>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The syntax is very permissive and does not generate syntax
|
||||
errors. This allows mathematically incorrect expressions to be
|
||||
displayed, which is important for teaching purposes. It also causes
|
||||
less frustration when previewing formulas.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The parser uses no operator precedence and only respects the grouping
|
||||
brackets, subscripts, superscript, fractions and (square) roots. This
|
||||
is done for reasons of efficiency and generality. The resulting MathML
|
||||
code can quite easily be processed further to ensure additional syntactic
|
||||
requirements of any particular application.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>The grammar:</b> Here is a definition of the grammar used to parse
|
||||
ASCIIMathML expressions. In the Backus-Naur form given below, the
|
||||
letter on the left of the ::= represents a category of symbols that
|
||||
could be one of the possible sequences of symbols listed on the right.
|
||||
The vertical bar | separates the alternatives.
|
||||
</p>
|
||||
|
||||
<pre>c ::= [A-z] | numbers | greek letters | other constant symbols (see below)
|
||||
u ::= 'sqrt' | 'text' | 'bb' | other unary symbols for font commands
|
||||
b ::= 'frac' | 'root' | 'stackrel' binary symbols
|
||||
l ::= ( | [ | { | (: | {: left brackets
|
||||
r ::= ) | ] | } | :) | :} right brackets
|
||||
S ::= c | lEr | uS | bSS | "any" simple expression
|
||||
E ::= SE | S/S |S_S | S^S | S_S^S expression (fraction, sub-, super-, subsuperscript)
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<b>The translation rules:</b> Each terminal symbol is translated into
|
||||
a corresponding MathML node. The constants are mostly converted to
|
||||
their respective Unicode symbols. The other expressions are converted
|
||||
as follows:<br/>
|
||||
<table>
|
||||
<tr><td>l`S`r</td><td>`to`</td><td><mrow>l`S`r</mrow>
|
||||
(note that any pair of brackets can be used to delimit subexpressions,
|
||||
they don't have to match)</td></tr>
|
||||
<tr><td>sqrt `S`</td><td>`to`</td><td><msqrt>`S'`</msqrt></td></tr>
|
||||
|
||||
<tr><td>text `S`</td><td>`to`</td><td><mtext>`S'`</mtext></td></tr>
|
||||
<tr><td>"any"</td><td>`to`</td><td><mtext>any</mtext></td></tr>
|
||||
<tr><td>
|
||||
frac `S_1` `S_2`</td><td>`to`</td><td><mfrac>`S_1'` `S_2'`</mfrac>
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
|
||||
root `S_1` `S_2`</td><td>`to`</td><td><mroot>`S_2'` `S_1'`</mroot>
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
stackrel `S_1` `S_2`</td><td>`to`</td><td><mover>`S_2'` `S_1'`</mover>
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
`S_1`/`S_2`</td><td>`to`</td><td><mfrac>`S_1'` `S_2'`</mfrac>
|
||||
</td></tr>
|
||||
|
||||
<tr><td>
|
||||
`S_1`_`S_2`</td><td>`to`</td><td><msub>`S_1` `S_2'`</msub>
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
`S_1`^`S_2`</td><td>`to`</td><td><msup>`S_1` `S_2'`</msup>
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
`S_1`_`S_2`^`S_3`</td><td>`to`</td>
|
||||
<td><msubsup>`S_1` `S_2'` `S_3'`</msubsup> or
|
||||
|
||||
<munderover>`S_1` `S_2'` `S_3'`</munderover> (in some cases)
|
||||
</td></tr>
|
||||
</table>
|
||||
In the rules above, the expression `S'` is the same as `S`, except that if
|
||||
`S` has an outer level of brackets, then `S'` is the expression inside
|
||||
these brackets.
|
||||
|
||||
<p>
|
||||
<b>Matrices:</b> A simple syntax for matrices is also recognized:
|
||||
<br/>
|
||||
<tt>l(`S_(11)`,...,`S_(1n)`),(...),(`S_(m1)`,...,`S_(mn)`)r</tt>
|
||||
    or    
|
||||
|
||||
<tt>l[`S_(11)`,...,`S_(1n)`],[...],[`S_(m1)`,...,`S_(mn)`]r</tt>.
|
||||
<br/>
|
||||
|
||||
Here <tt>l</tt> and <tt>r</tt> stand for any of the left and right
|
||||
brackets (just like in the grammar they do not have to match). Both of
|
||||
these expressions are translated to
|
||||
<br/>
|
||||
|
||||
<mrow>l<mtable><mtr><mtd>`S_(11)`</mtd>...
|
||||
|
||||
<mtd>`S_(1n)`</mtd></mtr>...
|
||||
<mtr><mtd>`S_(m1)`</mtd>...
|
||||
<mtd>`S_(mn)`</mtd></mtr></mtable>r</mrow>.
|
||||
<br/>
|
||||
|
||||
For example
|
||||
<tt>{(S_(11),...,S_(1n)),(vdots,ddots,vdots),(S_(m1),...,S_(mn))]</tt>
|
||||
displays as `{(S_(11),...,S_(1n)),(vdots,ddots,vdots),(S_(m1),...,S_(mn))]`.
|
||||
|
||||
<br/>
|
||||
|
||||
Note that each row must have the same number of expressions, and there
|
||||
should be at least two rows.
|
||||
|
||||
<p>
|
||||
<b>Tokenization:</b> The input formula is broken into tokens using a
|
||||
"longest matching initial substring search". Suppose the input formula
|
||||
has been processed from left to right up to a fixed position. The
|
||||
longest string from the list of constants (given below) that matches
|
||||
the initial part of the remainder of the formula is the next token. If
|
||||
there is no matching string, then the first character of the remainder
|
||||
is the next token. The symbol table at the top of the ASCIIMathML.js
|
||||
script specifies whether a symbol is a math operator (surrounded by a
|
||||
<mo> tag) or a math identifier (surrounded by a <mi> tag). For
|
||||
single character tokens, letters are treated as math identifiers, and
|
||||
non-alphanumeric characters are treated as math operators. For digits,
|
||||
see "Numbers" below.
|
||||
|
||||
<p>
|
||||
Spaces are significant when they separate characters and thus prevent
|
||||
a certain string of characters from matching one of the
|
||||
constants. Multiple spaces and end-of-line characters are equivalent
|
||||
to a single space.
|
||||
</p>
|
||||
|
||||
<h4>
|
||||
Now for a complete list of constants (<a
|
||||
href="http://math.chapman.edu/cgi-bin/mathxml.pl?Complete_list_of_LaTeX_constants">standard
|
||||
LaTeX names</a> also work):
|
||||
|
||||
</h4>
|
||||
|
||||
<p>
|
||||
Numbers: A string of digits, optionally preceded by a minus sign, and
|
||||
optionally followed by a decimal point (a period) and another string
|
||||
of digits, is parsed as a single token and converted to a MathML
|
||||
number, i.e., enclosed with the <mn> tag. If it is not desirable to
|
||||
have a preceding minus sign be part of the number, a space should be inserted.
|
||||
Thus <tt>x-1</tt> is converted to <mi>x</mi><mn>-1</mn>, whereas
|
||||
<tt>x - 1</tt> is converted to <mi>x</mi><mo>-</mo><mn>1</mn>.
|
||||
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Greek letters:
|
||||
alpha `alpha`
|
||||
beta `beta`
|
||||
chi `chi`
|
||||
delta `delta`
|
||||
Delta `Delta`
|
||||
epsilon `epsilon`
|
||||
varepsilon `varepsilon`
|
||||
eta `eta`
|
||||
gamma `gamma`
|
||||
Gamma `Gamma`
|
||||
iota `iota`
|
||||
kappa `kappa`
|
||||
lambda `lambda`
|
||||
Lambda `Lambda`
|
||||
mu `mu`
|
||||
nu `nu`
|
||||
omega `omega`
|
||||
Omega `Omega`
|
||||
phi `phi`
|
||||
varphi `varphi`
|
||||
Phi `Phi`
|
||||
pi `pi`
|
||||
Pi `Pi`
|
||||
psi `psi`
|
||||
Psi `Psi`
|
||||
rho `rho`
|
||||
sigma `sigma`
|
||||
Sigma `Sigma`
|
||||
tau `tau`
|
||||
theta `theta`
|
||||
vartheta `vartheta`
|
||||
Theta `Theta`
|
||||
upsilon `upsilon`
|
||||
xi `xi`
|
||||
Xi `Xi`
|
||||
zeta `zeta`
|
||||
</p>
|
||||
|
||||
<table border="5" cellpadding="10">
|
||||
<tr valign="top"><td>
|
||||
Operation symbols
|
||||
<table border="5" cellpadding="10">
|
||||
<tr><th>Type</th><th>See</th></tr>
|
||||
<tr><td>+</td><td>`+`</td></tr>
|
||||
<tr><td>-</td><td>`-`</td></tr>
|
||||
|
||||
<tr><td>*</td><td>`*`</td></tr>
|
||||
<tr><td>**</td><td>`**`</td></tr>
|
||||
<tr><td>//</td><td>`//`</td></tr>
|
||||
<tr><td>\\</td><td>`\\ `</td></tr>
|
||||
<tr><td>xx</td><td>`xx`</td></tr>
|
||||
<tr><td>-:</td><td>`-:`</td></tr>
|
||||
|
||||
<tr><td>@</td><td>`@`</td></tr>
|
||||
<tr><td>o+</td><td>`o+`</td></tr>
|
||||
<tr><td>ox</td><td>`ox`</td></tr>
|
||||
<tr><td>o.</td><td>`o.`</td></tr>
|
||||
<tr><td>sum</td><td>`sum`</td></tr>
|
||||
<tr><td>prod</td><td>`prod`</td></tr>
|
||||
|
||||
<tr><td>^^</td><td>`^^`</td></tr>
|
||||
<tr><td>^^^</td><td>`^^^`</td></tr>
|
||||
<tr><td>vv</td><td>`vv`</td></tr>
|
||||
<tr><td>vvv</td><td>`vvv`</td></tr>
|
||||
<tr><td>nn</td><td>`nn`</td></tr>
|
||||
<tr><td>nnn</td><td>`nnn`</td></tr>
|
||||
|
||||
<tr><td>uu</td><td>`uu`</td></tr>
|
||||
<tr><td>uuu</td><td>`uuu`</td></tr>
|
||||
</table>
|
||||
</td><td>
|
||||
Relation symbols
|
||||
<table border="5" cellpadding="10">
|
||||
<tr><th>Type</th><th>See</th></tr>
|
||||
<tr><td>=</td><td>`=`</td></tr>
|
||||
<tr><td>!=</td><td>`!=`</td></tr>
|
||||
|
||||
<tr><td>< </td><td>`<`</td></tr>
|
||||
<tr><td>></td><td>`>`</td></tr>
|
||||
<tr><td><=</td><td>`<=`</td></tr>
|
||||
<tr><td>>=</td><td>`>=`</td></tr>
|
||||
<tr><td>-<</td><td>`-<`</td></tr>
|
||||
|
||||
<tr><td>>-</td><td>`>-`</td></tr>
|
||||
<tr><td>in</td><td>`in`</td></tr>
|
||||
<tr><td>!in</td><td>`notin`</td></tr>
|
||||
<tr><td>sub</td><td>`sub`</td></tr>
|
||||
<tr><td>sup</td><td>`sup`</td></tr>
|
||||
<tr><td>sube</td><td>`sube`</td></tr>
|
||||
|
||||
<tr><td>supe</td><td>`supe`</td></tr>
|
||||
<tr><td>-=</td><td>`-=`</td></tr>
|
||||
<tr><td>~=</td><td>`~=`</td></tr>
|
||||
<tr><td>~~</td><td>`~~`</td></tr>
|
||||
<tr><td>prop</td><td>`prop`</td></tr>
|
||||
</table>
|
||||
</td><td>
|
||||
|
||||
Logical symbols
|
||||
<table border="5" cellpadding="10">
|
||||
<tr><th>Type</th><th>See</th></tr>
|
||||
<tr><td>and</td><td>`and`</td></tr>
|
||||
<tr><td>or</td><td>`or`</td></tr>
|
||||
<tr><td>not</td><td>`not`</td></tr>
|
||||
<tr><td>=></td><td>`=>`</td></tr>
|
||||
|
||||
<tr><td>if</td><td>`if`</td></tr>
|
||||
<tr><td>iff</td><td>`iff`</td></tr>
|
||||
<tr><td>AA</td><td>`AA`</td></tr>
|
||||
<tr><td>EE</td><td>`EE`</td></tr>
|
||||
<tr><td>_|_</td><td>`_|_`</td></tr>
|
||||
<tr><td>TT</td><td>`TT`</td></tr>
|
||||
|
||||
<tr><td>|--</td><td>`|--`</td></tr>
|
||||
<tr><td>|==</td><td>`|==`</td></tr>
|
||||
</table>
|
||||
<p>
|
||||
Grouping brackets
|
||||
<table border="5" cellpadding="10">
|
||||
<tr><th>Type</th><th>See</th></tr>
|
||||
<tr><td>(</td><td>`(`</td></tr>
|
||||
<tr><td>)</td><td>`)`</td></tr>
|
||||
|
||||
<tr><td>[</td><td>`[`</td></tr>
|
||||
<tr><td>]</td><td>`]`</td></tr>
|
||||
<tr><td>{</td><td>`{`</td></tr>
|
||||
<tr><td>}</td><td>`}`</td></tr>
|
||||
<tr><td>(:</td><td>`(:`</td></tr>
|
||||
<tr><td>:)</td><td>`:)`</td></tr>
|
||||
|
||||
<tr><td>{:</td><td>`{:`</td></tr>
|
||||
<tr><td>:}</td><td>`{::}`</td></tr>
|
||||
</table>
|
||||
|
||||
</td><td>
|
||||
Miscellaneous symbols
|
||||
<table border="5" cellpadding="10">
|
||||
<tr><th>Type</th><th>See</th></tr>
|
||||
<tr><td>int</td><td>`int`</td></tr>
|
||||
|
||||
<tr><td>oint</td><td>`oint`</td></tr>
|
||||
<tr><td>del</td><td>`del`</td></tr>
|
||||
<tr><td>grad</td><td>`grad`</td></tr>
|
||||
<tr><td>+-</td><td>`+-`</td></tr>
|
||||
<tr><td>O/</td><td>`O/`</td></tr>
|
||||
<tr><td>oo</td><td>`oo`</td></tr>
|
||||
|
||||
<tr><td>aleph</td><td>`aleph`</td></tr>
|
||||
<tr><td>/_</td><td>`/_`</td></tr>
|
||||
<tr><td>:.</td><td>`:.`</td></tr>
|
||||
<tr><td>|...|</td><td>|`...`|</td></tr>
|
||||
<tr><td>|cdots|</td><td>|`cdots`|</td></tr>
|
||||
<tr><td>vdots</td><td>`vdots`</td></tr>
|
||||
|
||||
<tr><td>ddots</td><td>`ddots`</td></tr>
|
||||
<tr><td>|\ |</td><td>|`\ `|</td></tr>
|
||||
<tr><td>|quad|</td><td>|`quad`|</td></tr>
|
||||
<tr><td>diamond</td><td>`diamond`</td></tr>
|
||||
<tr><td>square</td><td>`square`</td></tr>
|
||||
<tr><td>|__</td><td>`|__`</td></tr>
|
||||
|
||||
<tr><td>__|</td><td>`__|`</td></tr>
|
||||
<tr><td>|~</td><td>`|~`</td></tr>
|
||||
<tr><td>~|</td><td>`~|`</td></tr>
|
||||
<tr><td>CC</td><td>`CC`</td></tr>
|
||||
<tr><td>NN</td><td>`NN`</td></tr>
|
||||
<tr><td>QQ</td><td>`QQ`</td></tr>
|
||||
|
||||
<tr><td>RR</td><td>`RR`</td></tr>
|
||||
<tr><td>ZZ</td><td>`ZZ`</td></tr>
|
||||
</table>
|
||||
</td><td>
|
||||
Standard functions
|
||||
<table border="5" cellpadding="10">
|
||||
<tr><th>Type</th><th>See</th></tr>
|
||||
<tr><td>sin</td><td>`sin`</td></tr>
|
||||
<tr><td>cos</td><td>`cos`</td></tr>
|
||||
|
||||
<tr><td>tan</td><td>`tan`</td></tr>
|
||||
<tr><td>csc</td><td>`csc`</td></tr>
|
||||
<tr><td>sec</td><td>`sec`</td></tr>
|
||||
<tr><td>cot</td><td>`cot`</td></tr>
|
||||
<tr><td>sinh</td><td>`sinh`</td></tr>
|
||||
<tr><td>cosh</td><td>`cosh`</td></tr>
|
||||
|
||||
<tr><td>tanh</td><td>`tanh`</td></tr>
|
||||
<tr><td>log</td><td>`log`</td></tr>
|
||||
<tr><td>ln</td><td>`ln`</td></tr>
|
||||
<tr><td>det</td><td>`det`</td></tr>
|
||||
<tr><td>dim</td><td>`dim`</td></tr>
|
||||
<tr><td>lim</td><td>`lim`</td></tr>
|
||||
|
||||
<tr><td>mod</td><td>`mod`</td></tr>
|
||||
<tr><td>gcd</td><td>`gcd`</td></tr>
|
||||
<tr><td>lcm</td><td>`lcm`</td></tr>
|
||||
<tr><td>min</td><td>`min`</td></tr>
|
||||
<tr><td>max</td><td>`max`</td></tr>
|
||||
</table>
|
||||
<p>
|
||||
|
||||
Accents
|
||||
<table border="5" cellpadding="10">
|
||||
<tr><th>Type</th><th>See</th></tr>
|
||||
<tr><td>hat x</td><td>`hat x`</td></tr>
|
||||
<tr><td>bar x</td><td>`bar x`</td></tr>
|
||||
<tr><td>ul x</td><td>`ul x`</td></tr>
|
||||
<tr><td>vec x</td><td>`vec x`</td></tr>
|
||||
|
||||
<tr><td>dot x</td><td>`dot x`</td></tr>
|
||||
<tr><td>ddot x</td><td>`ddot x`</td></tr>
|
||||
</table>
|
||||
|
||||
</td><td>
|
||||
Arrows
|
||||
<table border="5" cellpadding="10">
|
||||
<tr><th>Type</th><th>See</th></tr>
|
||||
<tr><td>uarr</td><td>`uarr`</td></tr>
|
||||
|
||||
<tr><td>darr</td><td>`darr`</td></tr>
|
||||
<tr><td>rarr</td><td>`rarr`</td></tr>
|
||||
<tr><td>-></td><td>`->`</td></tr>
|
||||
<tr><td>|-></td><td>`|->`</td></tr>
|
||||
<tr><td>larr</td><td>`larr`</td></tr>
|
||||
<tr><td>harr</td><td>`harr`</td></tr>
|
||||
|
||||
<tr><td>rArr</td><td>`rArr`</td></tr>
|
||||
<tr><td>lArr</td><td>`lArr`</td></tr>
|
||||
<tr><td>hArr</td><td>`hArr`</td></tr>
|
||||
</table>
|
||||
<p>
|
||||
Font commands
|
||||
<table border="5" cellpadding="10">
|
||||
<tr><th>Type</th><th>See</th></tr>
|
||||
<tr><td>bb A</td><td>`bb A`</td></tr>
|
||||
|
||||
<tr><td>bbb A</td><td>`bbb A`</td></tr>
|
||||
<tr><td>cc A</td><td>`cc A`</td></tr>
|
||||
<tr><td>tt A</td><td>`tt A`</td></tr>
|
||||
<tr><td>fr A</td><td>`fr A`</td></tr>
|
||||
<tr><td>sf A</td><td>`sf A`</td></tr>
|
||||
</table>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
Of course you may want or need other symbols from the thousands of <a
|
||||
href="http://www.ctan.org/tex-archive/info/symbols/comprehensive/symbols-letter.pdf">LaTeX
|
||||
symbols</a> or <a
|
||||
href="http://www.alanwood.net/unicode/#links">unicode
|
||||
symbols</a>. Fortunately ASCIIMathML.js is very <a
|
||||
href="asciimathextend.html">easy
|
||||
to extend</a>, so you can tailor it to your specific needs. (This
|
||||
could be compared to the LaTeX macro files that many users have
|
||||
developed over the years.)
|
||||
</p>
|
||||
|
||||
<!--p>
|
||||
Large files with many formulas can take quite some time to display,
|
||||
especially on older hardware. To address this problem, there is a
|
||||
version ASCIIMathMLite.js that has a shorter symbol table (without the
|
||||
LaTeX symbol names) and slightly simplified parser. Send me an email
|
||||
at <a href="mailto:jipsen@chapman.edu">jipsen@chapman.edu</a> if you
|
||||
would like a copy.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Another version that also recognizes some <a
|
||||
href="http://www.latex-project.org/">LaTeX</a> layout commands and
|
||||
(the fairly standard) <a
|
||||
href="http://en.wikipedia.org/wiki/Wikipedia:How_to_edit_a_page">Wiki
|
||||
formatting codes</a> for ASCII text is in the works. This further
|
||||
simplifies producing mathematical content for the web. However such a
|
||||
development is less easily justified since there are good free HTML
|
||||
editors and the HTML syntax is a well-established standard that is
|
||||
simple enough to be coded by hand.
|
||||
</p-->
|
||||
|
||||
<hr/>
|
||||
|
||||
<div id="author">
|
||||
<a href="http://www.chapman.edu/~jipsen/">Peter Jipsen</a>,
|
||||
<a href="http://www.chapman.edu/">Chapman University</a>, September 2007
|
||||
|
||||
<a href="http://validator.w3.org/check/referer"><img border="0"
|
||||
src="http://www.w3.org/Icons/valid-html401"
|
||||
alt="Valid HTML 4.01!" height="31" width="88"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
8
main/inc/lib/javascript/asciimath/d.svg
Normal file
8
main/inc/lib/javascript/asciimath/d.svg
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
||||
<svg id="root" xml:space="preserve" width="100%" height="100%"
|
||||
preserveAspectRatio="xMidYMid meet"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http:///www.w3.org/1999/xlink">
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 346 B |
8
main/inc/lib/javascript/asciimath/index.html
Normal file
8
main/inc/lib/javascript/asciimath/index.html
Normal file
@@ -0,0 +1,8 @@
|
||||
<!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" xml:lang="en" lang="en">
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<br />
|
||||
</body>
|
||||
</html>
|
||||
37
main/inc/lib/javascript/asciimath/readme.txt
Normal file
37
main/inc/lib/javascript/asciimath/readme.txt
Normal file
@@ -0,0 +1,37 @@
|
||||
ASCIIMathML.js
|
||||
|
||||
Brief Instructions (2007-9-28)
|
||||
|
||||
This script can be used in any html page and also in systems like Moodle.
|
||||
The license is LGPL (see top of ASCIIMathML.js for more info).
|
||||
|
||||
In a html page, just add the following line near the top of your file:
|
||||
<script type="text/javascript" src="ASCIIMathML.js"></script>
|
||||
|
||||
To install in Moodle, just move this asciimath-x.y.z folder into moodle/filter,
|
||||
rename the folder "asciimath" and go to the admin panel Modules->Filters
|
||||
to switch it on.
|
||||
|
||||
Then try some ASCIIMath on your webpages: `x/y`
|
||||
|
||||
or LaTeX $\sqrt{x}$ and $$\int_0^1 x^2 dx$$ (only a \emph{subset} works,
|
||||
including a few environments like \begin{theorem}... and \begin{proof})
|
||||
|
||||
Try some graphics like agraph plot(sin(x)) endagraph or
|
||||
\begin{graph}plot(sin(x))\end{graph}
|
||||
|
||||
Try the auto-math-recognize mode: amath here we can mix x^2 and text endamath
|
||||
|
||||
All this is supposed to work in Firefox on many platforms (recommended;
|
||||
you may be asked to install math fonts) and in Internet Explorer (only
|
||||
on WinXP and you have to install MathPlayer and Adobe SVGview).
|
||||
|
||||
For more examples, see http://www.chapman.edu/~jipsen/asciimath.html and
|
||||
http://mathcs.chapman.edu/~jipsen/math
|
||||
|
||||
If you use this script on the web, please send an email to jipsen@chapman.edu
|
||||
and put a link to http://www.chapman.edu/~jipsen/asciimath.html on your page.
|
||||
|
||||
Best wishes with ASCIIMathML.js
|
||||
|
||||
Peter Jipsen
|
||||
Reference in New Issue
Block a user