How to Use LaTeX in WordPress

LaTeX is a great tool for formatting mathematics on your blog.  WordPress allows you to use any commands that are in the amsmath, amsfonts, and amssym packages.  That leaves out some of the basic LaTeX commands, but you can substitute some basic HTML to get your math looking just right.

I will start with a few basic examples of the possibilities.

As far as I can tell, the only way to enter LaTeX mode on a WordPress post is:

latexentry (1)

Make sure that you leave no space after the first $, one space after the x, and a space before the last $, or it may not parse correctly. As far as I can tell, this code only gets interpreted once, when the post is first posted. A PNG image is created, and that is what is placed on the page. When you are browsing the page, you can hold your cursor above the formula, and the LaTeX code is shown. This appears to be a standard way of putting math symbols on the web. If you go to Wikipedia, and click on the formulas, you can see the LaTeX code, and the PNG images.

If you want to use any of the code that follows, you must surround it by the code above (1).

Greek Letters
\alpha \beta \gamma \delta \epsilon \zeta \eta \theta \iota \kappa \lambda \mu \nu \xi \pi \rho \sigma \tau \upsilon \phi \chi \psi \omega

\alpha \beta \gamma \delta \epsilon \zeta \eta \theta \iota \kappa \lambda \mu \nu \xi \pi \rho \sigma \tau \upsilon \phi \chi \psi \omega

Beware. There is no /omicron, it is just an o. Nor is there an uppercase \Alpha, \Beta,\Epsilon, \Zeta, and apparently others. This gets to be a bit of a mystery, because all you get on your screen is Formula Does Not Parse

\Delta \Theta \Lambda

\Delta \Theta, \Lambda

The great power of LaTeX, however, is in producing nice looking formulas, and WordPress does that without a hitch.

e^{i \pi} = -1 e^{i \pi} = -1
\displaystyle e = \lim_{x \rightarrow \infty} \left( 1 + \frac{1}{n} \right)^{n} \displaystyle e = \lim_{x \rightarrow \infty} \left( 1 + \frac{1}{n} \right)^{n}
\displaystyle \frac{\text{d}}{\text{d}x} \int_a^x f(s)\text{d}s = f(x) \displaystyle \frac{\text{d}}{\text{d}x} \int_a^x f(s)\text{d}s = f(x)
\binom{n}{k} = \frac{n!}{k! (n-k)!} \binom{n}{k} = \frac{n!}{k! (n-k)!}
a(t) = e^{\displaystyle \int_0^t \delta (s) \text{d}s} a(t) = e^{\displaystyle \int_0^t \delta (s) \text{d}s}
D=\frac{\displaystyle \sum_{t=1}^{n}tK^{t}(1+i)^{-t} } {\displaystyle \sum_{t=1}{n}K^{t}(1+i)^{-t} } D=\frac{\displaystyle \sum_{t=1}^{n}tK^{t}(1+i)^{-t} } {\displaystyle \sum_{t=1}{n}K^{t}(1+i)^{-t} }
1/4 \quad \frac{1}{4} \quad \tfrac{1}{4} \quad \dfrac{1}{4} latex 1/4 \quad \frac{1}{4} \quad \tfrac{1}{4} \quad \dfrac{1}{4}
a \stackrel {+}{-} 1 a \stackrel {+}{-} 1
\mathcal{A} \quad \mathfrak{A} \quad \mathbb{A} \quad\mathrm{A} \quad\mathit{A} \quad\mathscr{A} \mathcal{A} \quad \mathfrak{A} \quad \mathbb{A} \quad\mathrm{A} \quad\mathit{A} \quad\mathscr{A}
\displaystyle{x, y, z} \quad \textstyle{x, y, z}\quad\scriptstyle{x, y, z}\quad\scriptscriptstyle{x, y, z} \displaystyle{x, y, z} \quad \textstyle{x, y, z}\quad\scriptstyle{x, y, z}\quad\scriptscriptstyle{x, y, z}
\overbrace{\displaystyle \sqrt[n]{ \displaystyle \frac {\displaystyle \frac {\displaystyle \sqrt{ a^2 + b^2 + c^2 } }{\displaystyle \lim_x \rightarrow \delta f(k)} }{\displaystyle \frac { \displaystyle \int_0^{\infty} f(x)\text{d}{x}}{\displaystyle \sum_1^{\infty} \binom {n}{k}}} }}^p No code for this…just testing the limits of this implementation of LaTeX.

Normal implementations of LaTeX have array and matrix environments. Lacking those, we can make do with HTML tables to do certain math things.  More soon on that topic.

First, another hack for producing the annuity symbol:
a_{\overline{n}\lvert }
a_{\overline{n}\lvert }

Leave a Reply