166 lines
6.5 KiB
HTML
Executable File
166 lines
6.5 KiB
HTML
Executable File
<HTML>
|
|
<HEAD>
|
|
<TITLE>jsMath (Test): jsMath Sample Page</TITLE>
|
|
<!-- Copyright (c) 2007 by Davide P. Cervone. All rights reserved. -->
|
|
<!--
|
|
| -----------------------------------------------------------
|
|
| The following line loads and initializes jsMath.
|
|
| You may need to edit the load.js file to set the
|
|
| root URL for your site before this file will
|
|
| display properly
|
|
| -----------------------------------------------------------
|
|
-->
|
|
<SCRIPT SRC="../easy/load.js"></SCRIPT>
|
|
</HEAD>
|
|
<BODY>
|
|
|
|
<!--
|
|
| -----------------------------------------------------------
|
|
| Include this NOSCRIPT block to inform users that JavaScript
|
|
| is required if they don't have it enabled.
|
|
| -----------------------------------------------------------
|
|
-->
|
|
<NOSCRIPT>
|
|
<DIV STYLE="color:#CC0000; text-align:center">
|
|
<B>Warning: <A HREF="http://www.math.union.edu/locate/jsMath">jsMath</A>
|
|
requires JavaScript to process the mathematics on this page.<BR>
|
|
If your browser supports JavaScript, be sure it is enabled.<B>
|
|
</DIV>
|
|
<HR>
|
|
</NOSCRIPT>
|
|
|
|
<BLOCKQUOTE>
|
|
|
|
<H1>jsMath Sample Page</H1>
|
|
|
|
This is a sample file showing you how to use jsMath to display mathematics
|
|
in your web pages. Be sure you have followed the <A
|
|
HREF="http://www.math.union.edu/locate/jsMath/authors/installation.html">installation
|
|
instructions</A> before loading this file. Also, you may need to edit the
|
|
<CODE>jsMath/easy/load.js</CODE> file to set the root URL for where jsMath
|
|
can be found on your web site. The rest of this document gives examples of
|
|
how to enter mathematics in your pages. Depending on the settings in
|
|
<CODE>jsMath/easy/load.js</CODE>, not all of the mathematics below will be
|
|
processed by jsMath. Experiment with the settings in that file to see how
|
|
they work.
|
|
<p>
|
|
|
|
<HR>
|
|
<p>
|
|
|
|
<H2>Some mathematics using <CODE>tex2math</CODE></H2>
|
|
|
|
The easiest way to enter mathematics is to use jsMath's <A
|
|
HREF="http://www.math.union.edu/locate/jsMath/authors/tex2math.html">tex2math</A>
|
|
plugin to identify the mathematics in your document by looking for <SPAN
|
|
class="math">\rm\TeX</SPAN>-like math delimiters. Here are some math
|
|
equations using those markers. Some inline math: $\sqrt{1-x^2}$ or \(ax^2+bx+c\),
|
|
and some displayed math:
|
|
$$\int {1\over x}\,dx = \ln(x)+C$$
|
|
and
|
|
\[\sum_{i=1}^n i = {n(n+1)\over 2}.\]
|
|
Note that the first of these will not be processed unless you have enabled
|
|
<CODE>processSingleDollars</CODE> in <CODE>jsMath/easy/load.js</CODE>,
|
|
which is disabled by default. That is because a single dollar sign can
|
|
appear in normal text (as in "That will cost from <SPAN>$</SPAN>3.50 to
|
|
<SPAN>$</SPAN>5.00 to repair"), and you don't want jsMath to try to typeset
|
|
the "3.50 to " as mathematics.
|
|
<p>
|
|
|
|
If you enable <CODE>processSingleDollars</CODE>, you might also want to
|
|
enable <CODE>fixEscapedDollars</CODE>, so that it is possible to enter
|
|
dollar signs by preceding them with a backslash. Here's one that you can
|
|
use to see the results of these settings: \$ (an escaped dollar) and $x+1$
|
|
(not escaped).
|
|
<p>
|
|
|
|
It is also possible to use your own custom delimiters for marking the
|
|
mathematics within your pages. If you uncomment the <CODE>customDelimiters</CODE>
|
|
array in <CODE>jsMath/easy/load.js</CODE>, then the following math will be
|
|
typeset by jsMath: some inline math [math]\sin(2\pi x)[/math] and some
|
|
display math [display]x={-b\pm \sqrt{b^2-4ac}\over 2a}.[/display]
|
|
You may change the delimiters to nearly anything you want, but they can not
|
|
look like HTML tags, since some browsers will eliminate unknown tags, and
|
|
jsMath doesn't get to look for the custom delimiters until <I>after</I> the
|
|
browser has interpreted the page.
|
|
<p>
|
|
|
|
<DIV CLASS="tex2math_ignore">
|
|
You can prevent the <CODE>tex2math</CODE> plugin from processing a portion
|
|
of a page by enclosing it in a tag that is of
|
|
<CODE>CLASS="tex2math_ignore"</CODE>. Often, that tag will be a
|
|
<CODE>DIV</CODE> or <CODE>SPAN</CODE>, but it can be anything. This
|
|
paragraph is wrapped in a DIV tag with
|
|
<CODE>CLASS="tex2math_ignore"</CODE>, and so no math delimiters will be
|
|
processed: $f\colon X\to Y$, \(x^2 \gt 5\), $$1\over 1+x^2$$ and
|
|
\[\matrix{a& b\cr c& d}.\]
|
|
Note that this includes the processing of escaped dollars (\$) and
|
|
custom delimiters ([math]a \mapsto a^2[/math]) as well.
|
|
This makes it possible to produce examples of how to enter mathematics on
|
|
your site, for instance.
|
|
</DIV>
|
|
<P>
|
|
JsMath will automatically ignore the text within
|
|
<CODE>PRE</CODE> tags, so you can easily enter examples that way as well:
|
|
<PRE>
|
|
$f\colon X\to Y$, \(x^2 \gt 5\),
|
|
$$1\over 1+x^2$$ and \[\matrix{a& b\cr c& d}.\]
|
|
</PRE>
|
|
<P>
|
|
|
|
Note that since the < and > symbols are used to denote HTML tags,
|
|
these can be hard to incorporate into your <SPAN CLASS="math">\rm\TeX</SPAN>
|
|
code. Often, putting spaces around the < or > will make it work, but
|
|
it is probably better to use <CODE>\lt</CODE> and <CODE>\gt</CODE> instead.
|
|
Also note that the <CODE>tex2math</CODE> plugin does not allow any HTML
|
|
tags to be within the math delimiters, with the exception of
|
|
<CODE><BR></CODE>, which is ignored.
|
|
<p>
|
|
|
|
See the <A
|
|
HREF="http://www.math.union.edu/locate/jsMath/authors/tex2math.html">tex2math
|
|
documentation</A> for more information.
|
|
<p>
|
|
|
|
<HR>
|
|
<p>
|
|
|
|
<H2>Mathematics without <CODE>tex2math</CODE></H2>
|
|
<p>
|
|
|
|
If you are not using <CODE>tex2math</CODE>, then you will need to enclose
|
|
your mathematics within <CODE>SPAN</CODE> or <CODE>DIV</CODE> tags that
|
|
are of <CODE>CLASS="math"</CODE>. Use a <CODE>SPAN</CODE> for in-line math
|
|
and a <CODE>DIV</CODE> for displayed math. For instance, <SPAN
|
|
CLASS="math">P = (x_1,\ldots,x_n)</SPAN> and
|
|
<DIV CLASS="math">
|
|
A = \left\lgroup\matrix{a_{11}& \cdots& a_{1m}\cr
|
|
\vdots& \ddots& \vdots\cr
|
|
a_{n1}& \cdots& a_{nm}\cr}\right\rgroup.
|
|
</DIV>
|
|
<p>
|
|
<HR>
|
|
<P>
|
|
<H2>More information</H2>
|
|
<p>
|
|
|
|
See the <A HREF="http://www.math.union.edu/locate/jsMath/examples">jsMath
|
|
example files</A> for more examples of using jsMath. There are several <A
|
|
HREF="http://www.math.union.edu/locate/jsMath/examples/extensions.html">extensions</A>
|
|
to <SPAN CLASS="math">\rm\TeX</SPAN> that allow jsMath to interact better
|
|
with HTML. These provide features such as colored text, tagging mathematics
|
|
with CSS styles, and so on.
|
|
<p>
|
|
|
|
More information is available from the <A
|
|
HREF="http://www.math.union.edu/locate/jsMath/authors">jsMath author's
|
|
documentation</A> site. JsMath also has a <A
|
|
HREF="http://sourceforge.net/projects/jsmath/">home page at
|
|
SourceForge</A>, and that includes <A
|
|
HREF="http://sourceforge.net/forum/?group_id=172663">public forums</A>
|
|
for jsMath where you can ask the jsMath user community for help.
|
|
</BLOCKQUOTE>
|
|
|
|
</BODY>
|
|
</HTML>
|