jump to navigation

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.)

Comments»

1. Charles Siegel - May 17, 2009

The only method for commutative diagrams I know other than matrices for wordpress is to create images and embed them (that’s what John Armstrong does). As for latex primers, I can’t recommend lshort enough.

http://tobi.oetiker.ch/lshort/lshort.pdf

2. Wordpress and Latex « One problem a day - June 24, 2009

[...] and Latex Posted in Administrative by Matt on June 24, 2009 Here is a good description of how to use latex in comments. Also, thank you to an author whose name I [...]

3. Watchmath - July 17, 2009

If you are on the self hosted wordpress it is possible to use the xypic package to draw commutative diagram.
Here is an example on my blog: http://watchmath.com/vlog/?p=586

4. 36min - March 3, 2010

How to write \$\latex LaTeX_code_here$ without the \’s as you did? Thanks.

5. David Speyer - March 4, 2010

I typed

ampersand-pound-36-semicolon

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!

6. Tom Leinster - March 19, 2010

Thanks, guys, for the tips. As some of you may have noticed, the n-Category Cafe has had technical problems, causing us to move temporarily to a WordPress site: http://ncategory.wordpress.com/ So we’re all trying to figure out how to do math on WordPress, and this page is helpful.

7. how to use this « hopf algebras and combinatorics - January 29, 2012

[...] If you don’t know, you should learn it. It is the one and only typesetting language that professional mathematicians use. You can see my favorite quick introduction to LaTeX by clicking here. You can see other useful tips on using LaTeX on wordpress blogs here. [...]

8. Frure - May 21, 2013

test $\latex \Delta$

9. Frure - May 21, 2013

\Delta

10. how to use this blog | Enumerative Combinatorics - August 28, 2013

[…] If you don’t know LaTeX, you should learn it. It is the one and only typesetting language that professional mathematicians use. You can see my favorite quick introduction to LaTeX by clicking here. You can see other useful tips on using LaTeX on wordpress blogs here. […]


Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 646 other followers

%d bloggers like this: