I found LatexRender and after a few hours I seem to have it working: e.g., the normal density is
[tex]p(\theta; \mu, \sigma^2) = \displaystyle\frac{1}{\sqrt{2\pi \sigma^2}} \exp \left[ \displaystyle\frac{-(\theta-\mu)^2}{2\sigma^2} \right][/tex]
which was generated with the following LaTeX code
p(\\theta; \\mu, \\sigma^2) =
\\displaystyle\\frac{1}{\\sqrt{2\\pi \\sigma^2}}
\\exp \\left[ \\displaystyle\\frac{-(\\theta-\\mu)^2}{2\\sigma^2} \\right]
enclosed with the tags [tex]...[/tex] (n.b., square brackets)
The BSD version of this installer worked ok for me, at least in the sense of putting the LatexRender PHP files in the right place.
Installation notes. LatexRender is a WordPress plugin. Specifically, is a suite of PHP that gets executed on a per view basis. Blog posts that include that the [tex]...[/tex] tags get the enclosed content parsed and run through LaTeX (absent the LatexRender parser picking up any fatal syntax errors). LaTeX produces a dvi file, which is converted to PostScript (via dvips, which is part of any decent TeX distribution, and the PostScript is run through ImageMagick (which calls Ghostscript) to generate a GIF that appears in-line on the web page. So you need a working TeX and friends installed on your web server, as well as ImageMagick. I use i-Installer for managing these essential pieces of software of this on my work machines, but hadn’t actually put them on my web server. So that took a little while.
ImageMagick didn’t want to play nice, for reasons I don’t quite understand. It works fine straight out of the box on every other OS/X or linux box I’ve owened over the years. I must have got some dependencies screwed up as I hastily installed everything on my web server. So anyway, I wound up installing ImageMagick “by hand”, as follows. I downloaded a pre-compiled binary for Mac OS/X from here, un-tarred it, and moved the libs to /usr/local/lib and the binary executables to/usr/local/bin respectively. Still, LatexRender’s call to ImageMagick’s convert appeared to be failing, and indeed, ImageMagick’s convert refused to run from the command line. Some fishing around in Google revealed that some missing environment variables might fix this problem: I verified this, and then I added the following lines to the top of the class.latexrender.php file (obviously part of in the LatexRender distro):
putenv("MAGICK_CONFIGURE_PATH=/usr/local/lib/ImageMagick-6.3.2/config");
putenv("MAGICK_CODER_MODULE_PATH=/usr/local/lib/ImageMagick-6.3.2/modules-Q16/coders");
In addition, at about line 290 of class.latexrender.php I made the following subsitution:
// imagemagick convert ps to image and trim picture
$command = $this->_convert_path." -density ".$this->_formula_density.
" -crop 0x0 ".$this->_tmp_filename.".ps ".
$this->_tmp_filename.".".$this->_image_format;
following this advice.
It seems to work pretty well. The underlying technologies are ancient, in Internet years (tex to dvi to Postscript to ppm to gif); the important value-added here is using PHP to automate the workflow from tagged blog content to in-line GIF. The juxtaposition of all the Helvetica on my blog with the Knuth Computer Modern (rendered as gifs) is a little jarring, and we might be able to tweek that, but in the meantime, this is a vast improvement over x_i^2 etc etc. The other alternative out there is texvc, part of MediaWiki, which seems a nicer solution in principle, but I’d already gone down the WordPress road in setting up the blog, so LatexRender it is (with a little tweeking).
Gratuitious ending of post, proof of the law of iterated expectations:
[tex] \begin{array}{rcl} E_{\mathcal{X}}[E(Y|x)] & = & \int_{-\infty}^{\infty} E(Y|x) \, f_x(x) dx \\ & = & \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} y \, g(y | x) \, f_x(x) \, dy dx \\ & = & \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} y \, \displaystyle \frac{f(x,y)}{f_x(x)} \, f_x(x) \, dy dx \\ & = & \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} y \, f(x,y) \, dy dx \\ & = & \int_{-\infty}^{\infty} y \, f(y) dy \\ & = & E(Y) \end{array} [/tex]