Using jsMath at UBC Mathematics

What is this page about?
jsMath is a javascript program that easily lets you include $\TeX$ into your html pages. The official web site can be found at http://www.math.union.edu/locate/jsMath. This page provides simple instructions on how to use jsmath in your UBC mathematics department web pages. Thanks to Davide P. Cervone, the author of jsMath, for improving these instructions!


Two simple steps
Step 1. Get a copy of the file load.js. If you want to use the same settings as I do, you can copy my file. Navigate to the directory on math unix system where your html file will live. Then right click here and save the file as load.js in this directory. Change the permissions to make the file readable by typing

>chmod 644 load.js

at the unix prompt.

Step 2. Include the following code near the beginning of your html file, just after the <BODY> tag.

<SCRIPT SRC="./load.js"></SCRIPT>
<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>


Now you are ready to go. After this piece of included code, everything surrounded by a dollar sign \$...\$ will be typset as inline $\TeX$ and everything surrounded by double dollar signs \$\$...\$\$ will be typeset as a displayed formula.


An Example
Here is a complete html page using jsMath. You can see the resulting page here. <HTML> <HEAD> <TITLE>Jsmath Test page</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF"> <SCRIPT SRC="./load.js"></SCRIPT> <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>
This is the body of the page that can include $\TeX$ like the formula
$\int_{-\infty}^\infty e^{-x^2} dx$ or the displayed formula
$$
\int_{-\infty}^\infty e^{-x^2} dx = {{1}\over{\sqrt{\pi}}}
$$
</BODY> </HTML>


The fine print
Fonts. JsMath pages load faster and look better if the user viewing the page has downloaded TeX fonts onto their local machine. This is not difficult (instructions are here) but probably more than a casual user will want to do. If the TeX fonts have not been downloaded, jsMath will either use either image fonts, automatically obtained from the server when the page loads, or a mixture of image fonts for symbols and other local fonts for letters. The behaviour is controlled from the "Options" menu on the jsMath control panel, which pops up when the jsMath button on the bottom right side of the page is clicked.

Speed. Longer jsMath pages (like this one) can be slow to load and process.

Macros. You are only getting a subset of $\TeX$ with jsMath. Macros like automatic equation numbering don't work. JsMath is great for putting a bit of $\TeX$ into a web page. However if you are producing a long $\TeX$ document you will still want to produce a pdf file and post that.