I downloaded and unpacked jsMath 3.6b, and created my own very small test.html file inside the jsMath folder. It contains just this HTML code:
<p>Some math: <span class='math'>x^2</span></p>
<script>jsMath.Process( document );</script>
The problem is that even this baby example only works on some browsers, but not others. I suspect I'm doing something wrong, because every browser I tried displays the much more complicated test cases from http://www.math.union.edu/~dpvc/jsMath/examples/Henrici.html correctly.
Here are the specifics.
I open the file in Firefox (3.0.6) on a Mac (OS X 10.5.6) and it behaves as expected; it initially shows up as x^2, and immediately later becomes typeset, with the "Processing Math: Done" window in the lower left.
So I tried on some other systems. Here are the results:
On Firefox 3.0.10 on Ubuntu 8.10, I get the same behavior as I did on Safari on the Mac (well, okay, with an additional "no TeX fonts" warning that's not relevant).
On Firefox 3.0.8 on Windows XP, I get the correct behavior (described above under Firefox 3.0.6 on Mac).
Error: Object doesn't support this property or method.
Why this wide variation in behaviors in such a simple test case? What did I do wrong?
My main purpose is to get it working on Safari, because I'm actually working on using jsMath in an application that embeds Webkit, and thus behaves much like Safari.
Thank you for any help available!
PS: I was doing a much more complicated example which sometimes worked and sometimes didn't, and I boiled it down to a failure in this simple case, at which point I was completely flummoxed and turned to this forum for help. Help! :)
Try putting a <HEAD> section in the document. This is actually required for properly formed HTML4.0, and it is needed by jsMath to do some of its initialization (e.g., it puts stylesheet information into the document HEAD). If the HEAD is missing, jsMath will fail in some browsers (Safari for one). Other browsers seem to insert a blank HEAD if it is missing.
See if that works.
That fixed it! Thank you very much for the quick help!
I feel quite stupid that it was something so simple, yet at the same time am quite glad it was something so simple.
For the benefit of others in the future, is it possible for jsMath to check for existence of a document HEAD, and if it's not there, yell at you with alert() or something? Just a thought.
But thank you again for the help!
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.