Once you have jsMath installed and tested, edit the fileGetting Started with jsMath
jsMath/easy/load.jsto suit your needs (see configuring jsMath for more details). In particular, change the setting forrootto be the URL for thejsMathfolder, wherever you have placed it on your web server or hard disk. The comments in the file should help you decide which values need to be changed. You may make copies of that file, each with different settings, if you need to be able to use jsMath in more than one configuration.Next, create an html file containing mathematics. Your settings in
easy/load.jswill determine how you have to indicate the mathematics within your file. For example, with the default settings, you could use \(...\) around in-line math and \[...\] around displayed equations. There is a sample file injsMath/test/sample.htmlthat should help you with your first document containing mathematics.
Adding jsMath to an HTML document
To use jsMath in a web page, you should add the line<SCRIPT SRC="path-to-jsMath/easy/load.js"></SCRIPT>to theHEADsection of your document. Here, path-to-jsMath should point to the location where you have placed the jsMath package. You can make jsMath be available site-wide by putting it in a place that is easy for many web pages to access (sayhttp://your-host/jsMath/easy/load.js), or you could make jsMath be local to your particular web page by putting it in the same directory as your.htmlfile (in which casejsMath/easy/load.jswould be sufficient to locate jsMath).That's it; jsMath will use the settings in your
easy/load.jsfile to process the mathematics on your page. For example, you should be able to load thejsMath/test/sample.htmlfile and have it display (some of) the mathematics it contains. (Parts of it will not be typeset, because the default settings ineasy/load.jshave some features of jsMath turned off.)
Some Caveats
You should not load jsMath from a server in a different domain from the one that serves the page that is using jsMath. If you do, jsMath may not be able to load some of its optional components (like the fallback code or the control panel code). This is a restriction placed on jsMath by the JavaScript security model, and is not something that jsMath will be able to overcome. You can, however, load jsMath from another server in the same domain as your main page. For example, if the main page is coming from
www.math.union.eduand jsMath is taken fromunion.edu, then jsMath will still be able to access its optional components. To do this, it sets thatdocument.domainfor the main page to be the largest common domain between the two addresses.Since jsMath requires JavaScript to be turned on in order to display your mathematics, it is a good idea to include something like
<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>at the top of your HTML file. This will give your readers a message informing them that they should turn on JavaScript if they have it off. Note that this must be included in the body of your document, and can't be inserted by jsMath (since if JavaScript is turned off, there is no way for jsMath to modify the page).
dpvc@union.edu