Including equations in comments

Anyone reading our blog will notice that we use a lot of equations in our posts. If you read our comments (and you should!) you will see that our commentors also frequently include equations. If you want to leave a comment with mathematical formulas, here’s how. This option is available on all wordpress blogs, so the information here will also be good for most of the other blogs in our blogroll.

We use LaTeX to format our equations. If you write $latex \sum_{n=1}^{\infty} 1/n^2 = \pi^2 / 6$, then wordpress should display \sum_{n=1}^{\infty} 1/n^2 = \pi^2/6. In general, $latex LaTeX_code_here$ will give you the equation displayed by that code. Your equation will be included as an image. As a nice bonus, hover your mouse over that image to see the code which produced it. This is a good way to learn LaTeX tricks — just find an equation you like and hold your mouse over it to see how it was done.

Assuming you already know LaTeX, I’ve already told you most of what you need to know. A few more notes: wordpress assumes that you want inline math mode. The hbox and mbox commands work, so you can use them to get ordinary text mode if you want. For example, write $latex \{ p : p \ \mbox{is prime} \}$ to get \{ p : p \ \mbox{is prime} \}. If you want a displayed equation, use the displaystyle command. So $latex \displaystyle{\sum_{n=1}^{\infty} 1/n = \infty}$ will give
\displaystyle{\sum_{n=1}^{\infty} 1/n = \infty}.
Wordpress supports amsfonts, amsmath and amssymb, so you probably have all the symbols and fonts you want. One thing that is missing is good support for commutative diagrams. I’ve been hacking them together with the matrix command; maybe someone will suggest a better way in the comments?

If you don’t know LaTeX, you should learn it. It is the system used to communicate electronically among mathematicians. I think the best way to get started is by reading other people’s LaTeX. If you just want to format individual equations, go to your favorite wordpress math blogs and hover your mouse over the equations; if you want to write papers, go to the arXiv and download the source for some of your favorite authors’ works. (Bring up the paper, click on “Other formats” and “Download source”.) Other good quick references are the ASL symbol list and David Wilkins LaTeX Primer. For a (fairly) comprehensive reference, my dog-eared companion is Math into LaTeX. (Note: I own the third edition. I assume that the fourth edition, which I have linked to, is even better, but I haven’t actually looked to see what changed.)

11 thoughts on “Including equations in comments

  1. I typed


    without the dashes, and with the three words replaced by the punctuation they replace. Every standard HTML character has a numeric equivalent — see this table — which can be accessed through ampersand-pound-N-semicolon.

    I think this should also work in comments; let’s see. $ Yup, looks good!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s