Thanks to everyone who wrote the script. I've been using it for my
website.
I actually modified the posted version to suit my own tastes, so I
wanted to share these suggestions, and if you like some of them, they
could be incorporated into the main code (my modifications are very
hacky, because I don't really know javascript at all).
My modifications are here:
http://www.acm.caltech.edu/~srbecker/textheworld7.user.js
http://www.acm.caltech.edu/~srbecker/textheworld7.user.block.js
The main suggestions:
(1) for inline expressions, the latex image was always vertically
centered rather funny. I was able to easily fix this by adding this
line:
imgElement.style.verticalAlign = "middle";
to
function createTeXifiedImageElement(expr)
(2) my webpages are generally static, so I don't need any fancy
refreshes. But I also don't want to wait 3 seconds for the images to
render - I want that immediately! So it would be nice to give this as
a second option. My current hack around this was to replace
setInterval(TeXTheWorld, 3000);
with
setTimeout(TeXTheWorld, 0);
(3) the second file, the "block" file, is like the first, but it looks
for [[; and ;]] instead of [; and ];, and it displays the equations as
"block" style as opposed to "inline" style, i.e.
imgElement.style.display = "block";
The intention is that it functions like \begin{equation}...
\end{equation} in latex.
I made this in a second duplicate script (and renamed the functions),
but of course this is wasteful and I only did it because it was quick
and I don't know javascript well.
An example of how I used everything is here:
http://www.acm.caltech.edu/~srbecker/inverse.shtml
Some of these you may not agree with but just wanted to put them out
as suggestions. Thanks for the great code.
-Stephen