This is a tool to make it easy to embed LaTeX code in your webpages, even if the server-side software -- like your wiki or blog program -- doesn't support it.
To get started, put this HTML at the bottom of your webpage:
<script type="text/javascript" src="http://mathcache.s3.amazonaws.com/replacemath.js"></script> <script type="text/javascript"> replaceMath( document.body ); </script>
Once you've done that, to create inline math, use standard LaTeX math delimiters -- for example, $ \LaTeX $ or \( \LaTeX \). Likewise, to insert display math, use $$ \LaTeX $$ or \[ \LaTeX \].
That's all! TeX rendering is done by mathTeX by John Forkosh, and cached using Google App Engine and Amazon S3. Here is some sample rendered math:
$$ \pi = 4 \sum_{k=1}^{\infty} \frac{(-1)^{k+1}}{2k-1}$$
$$ \int_0^1 \sqrt x \,dx = \int_0^1 x^{\frac{1}{2}} \,dx = \int_0^1 d \left({\textstyle \frac 2 3} x^{\frac{3}{2}}\right) = {\textstyle \frac 2 3} $$
If you can't insert script tags in your page, check out the bookmarklets in the next section, which you can use to compose blog posts and whatnot with the TeX image tags already in them.
Should you need to to prevent certain $ signs from triggering LaTeX rendering, replace $ with the equivalent HTML <span>$</span> or $, or put the code inside a <pre> or <code> block if appropriate.
Drag the links below into your bookmarks toolbar in the latest versions of Firefox or Safari and you'll be able to convert TeX to image tags and back in the rich-text editors in GMail and some blog software. Sorry -- no Internet Explorer support.
Images to TeXThe rendering cache supports basic TeX macros and command definitions. Upload your .sty file below and you'll get a special JavaScript block you can use in your page:
To provide macro support, the server scans each TeX snippet for any of the commands you defined. Large macros, or .sty files that do more than simply define new commands with \def and \newcommand, may not work.
The default code produces images for pages with light backgrounds. Here's code for pages with dark backgrounds:
<script src="http://mathcache.s3.amazonaws.com/replacemath.js" type="text/javascript"></script>
<script type="text/javascript">
window.mathPreamble =
'\\usepackage{color}\\pagecolor{black}\\color{white} ';
replaceMath(document.body);
</script>
In general, you can set window.mathPreamble to any LaTeX that you'd like to be processed before your math.
Randall Farmer, . Public domain, 2007-2009. Please e-mail me any questions or just let me know you're using the script!