WordPress.com supports the use of standard LaTeX in posts and comments, which is displayed using embedded PNG images with the LaTeX source code appearing in the alt text. So, including inline maths in your comments is easy! All you have to do is to surround your code by the tags $latex … $. For example, typing
$latex \int_{\infty}^\infty e^{x^2}\,dx=\sqrt\pi$ 
gives . Note that the initial space after the opening $latex is necessary. If this is omitted then the code will not be processed as LaTeX and will just appear as typed. There are some problems that can occur, but are easily avoided. As WordPress.com has some support for html in comments, any < or > signs could be misinterpreted as html tags, messing up the comment. This is avoided by either ensuring that spaces are left around these symbols or by using < and > in place of < and > respectively. Also, you can have newlines in your LaTeX code, which is treated as whitespace as with regular LaTeX. However, do not put a newline directly after the opening $latex, as this prevents the LaTeX code from being processed. Any LaTeX containing errors is displayed as .
Unfortunately, WordPress.com does not support previewing or editing comments. So, if you want to test your LaTeX code before posting as a comment, feel free to first post it as a comment here. Also, I will correct any incorrectly entered LaTeX in comments as I come across them. Happy commenting!
The displaymath environment
In standard LaTeX it is possible to use the displaymath environment, which causes the formula to appear centered on its own line, with whitespace above and below, and with slightly different formatting making use of the additional space. WordPress.com does not directly support displaymath but, fortunately, it is possible to emulate it with inline LaTeX. This requires doing two things. First, use the html p (paragraph) tag to insert whitespace above and below the expression with the align attribute set to “center”. Then, the expression can be made to appear with the correct displaymath formatting by starting it with the \displaystyle LaTeX keyword. For example, typing
<p align="center">$latex \displaystyle\int_{\infty}^\infty e^{x^2}\,dx=\sqrt\pi$</p> 
gives
Typing this afresh every time you want to display a formula is likely to lead to mistakes, so you can simply copy the expression above directly from this page and paste it into your comment, replacing my LaTeX code with yours while retaining the \displaystyle command.
Multiline expressions and alignment
It is often desirable to break long formulas and expressions down into multiple lines. In standard LaTeX this can be done with the align environment, which uses \\ to end a line and aligns the expressions on the & character. However, the align environment is not supported in WordPress. Instead, the array environment can be used, as this works with standard LaTeX inside inline maths formulas. There are some things that should be done to get this to display properly though. To reduce the rather excessive amount of space that appears in place of the & alignment characters, the command \setlength\arraycolsep{2pt} should be used immediately before entering the array environment. Secondly, to make sure that enough space appears between lines, put \smallskip immediately before the \\ command for a newline. Also, to get correct displaymath formatting, the \displaystyle command should be reentered after every & alignment character and at the start of each line. You can copy and paste the following text into your comment, replacing [mylatex] with your LaTeX code.
<p align="center">$latex \setlength\arraycolsep{2pt}\begin{array}{rl} \displaystyle[mylatex]&\displaystyle[mylatex]\smallskip\\ \displaystyle[mylatex]&\displaystyle[mylatex] \end{array}$</p> 
For example, the following multiline expression
was produced by typing the following text.
<p align="center">$latex \setlength\arraycolsep{2pt}\begin{array}{rl} \displaystyle\int_{\infty}^\infty e^{x^2}\,dx&\displaystyle=\sqrt\pi,\smallskip\\ \displaystyle\int_{\infty}^\infty e^{ax^2}\,dx&\displaystyle=\int_{\infty}^\infty e^{y^2}\frac{dy}{\sqrt a}\smallskip\\ &\displaystyle=\sqrt{\frac\pi a} \end{array}$</p> 
Equation numbering
LaTeX documents support the use of equation numbering. This displays a rightaligned number inside parentheses after displayed equations, as follows.

(1) 
In LaTeX this is done automatically whenever the equation environment is used to display formulas. Unfortunately, as WordPress does not support the equation environment, it does not directly support equation numbering either. One simple way to force an equation to be numbered is to insert the number directly into the LaTeX expression by putting something like \qquad\qquad{\rm(2)} before the terminating $, giving
This works, but it is not an ideal solution. As the equation number has been inserted into the LaTeX expression with a space separating it from the main formula, it means that it is displayed as part of the included PNG image. The gap between the formula and the number is fixed, so that the number either floats somewhere between the right of the expression and the right of the screen or, if too much space is used, it will protrude beyond the righthand margin and the equation will not be properly centered. A more satisfactory result can be achieved by using an html table to display and rightalign the equation number, and separately display and center the LaTeX formula. This approach also works for giving a single number to a multiline formula such as

(3) 
Typing in the code to do this from scratch would almost certainly lead to errors, so you can copy and paste the following text into your comment. Just replace [mylatex] by your LaTeX expression and *eqno* by the equation number. For a numbered single line formula, use
<table border="0" cellspacing="0" cellpadding="0" width="100%"> <tbody><tr><td align="center" width="93%"><p> $latex \displaystyle[mylatex]$ </p></td><td align="left" width="7%"><p>(*eqno*)</p> </td></tr></tbody></table> 
For a numbered and aligned multiline expression use
<table border="0" cellspacing="0" cellpadding="0" width="100%"> <tbody><tr><td align="center" width="93%"><p> $latex \setlength\arraycolsep{2pt}\begin{array}{rl} \displaystyle[mylatex]&\displaystyle[mylatex]\smallskip\\ \displaystyle[mylatex]&\displaystyle[mylatex] \end{array}$ </p></td><td align="left" width="7%"><p>(*eqno*)</p> </td></tr></tbody></table> 
I wonder if rightaligned equation numbering works in comments?
(1)
It does! I’ll update this page shortly to describe how this can be done.
Comment by George Lowther — 16 April 11 @ 2:42 AM 
very handy, thanks!
Comment by Jefferson Huang — 27 December 11 @ 7:01 AM 
The ‘&’ should work without the use of \displaystyle
Comment by hddadmin — 17 January 14 @ 11:25 PM 
test .
Comment by Anonymous — 30 March 15 @ 3:22 PM 
Test: .
Comment by heartofwaterblog — 6 October 16 @ 4:04 AM 
Comment by Anonymous — 14 March 20 @ 7:43 AM 