LaTeX equations in WordPress

There is a very nice plugin for WordPress done by Automattic that allows one to include LaTeX mathematics in a post. However, their version handled everything as inline math, so that operators like integrals and sums were too small, as if they were trying to be fit within the space of a line, and not as they should be in a displayed equation.Â Fortunately, they made it open source, soÂ I justÂ made a few very minor changes to fix that, and plan to extend the plugin in the future to allow for both inline and display equations to be created.

You can download the current version of what I have so far here. It requires the fauxml plugin, so remember to download and install that, first.

If anybody is interested in this, let me know via a comment and I’ll try to get to this sooner rather than later. I think the ability to write math in a post and comments would allow for some very interesting science and math blogs. For example, it would be great to see people throwing equations around in the comment stream of a post about some contentious interpretation of quantum mechanics.

At any rate, here is an example of the kind of beautiful output that can be created with the LaTeX plugin:

$latex E[(X|Y)^2]-\mathrm{var}[X|Y] = \left( \frac{1}{f_Y(y)} \int_\infty^\infty dx \, x f_{X,Y}(x,y) \right) ^2$.

Pretty cool huh?

8 responses to “LaTeX equations in WordPress”

1. Here is an example of math inside a comment:

$latex Z = \sum_k w_k (x_k – \hat{x}_k)^2$.

And thus the fun begins.

2. What would the math formula look like to calculate the APR on credit cards. I could use that for my site readers, and never knew how to figure it out and I would like to display it on my site in a neat formula like that!

I don’t know what you mean by a formula to compute APR. You mean from the monthly percentage rate? If I can figure it out, I’d be happy to help.

4. Michael:

I’ve added a link in the post that will point to the current version. I haven’t added the ability to choose between display and in-line math yet, though. Let me know if you have any problems with it.

5. David says:

Hi Jonathan,

I’m having some trouble configuring the plugin on athena. I don’t think dvipng is installed. How did you configure this?

Thanks,
David

• Sorry for never responding to this, David. I don’t know how I missed it. I’m sure you don’t care anymore, but I’m using scripts.mit.edu.