To render equations in a WordPress blog, you have several options. The most aesthetically pleasing is MathJax. An earlier post tells you how to install MathJax for your WordPress site. This second post shows a few pointers by way of an example (you’ll probably want to view the page source, then search for “For example”). Here are a few more usage examples.

### How to Do Math in a Blog Post

If you’ve installed MathJax in your site, then in a blog post you can trigger the loading of MathJax by putting the shortcode `[mathjax]`

at the top of your post. It will not show up in your readers’ browsers.

**That’s it! You can write your post now.**

What I usually do, if the document has a lot of equations, is to compose the post in the quasi-WYSIWYG LaTeX editor, LyX. You can, of course, use whatever writing tool you like. When you’re happy with how your article looks, then copy the text to the clipboard. (With LyX, open up the source pane (View→Source Pane) and select the text.) Paste to your WordPress post editor.

You now have to make one change to the pasted text: remove the line breaks inside AMS environments

\begin{...} ... \end{...}

For example,

\begin{equation} \begin{array}[b]{ccl} D & = & -\left(R+h\right)\cos z\pm\sqrt{\left(R+h\right)^{2}\cos^{2}z+\left[\left(R+H\right)^{2}-\left(R+h\right)^{2}\right]}\\ \\ & = & \left(R+h\right)\left(\sqrt{\cos^{2}z+\dfrac{\left(R+H\right)^{2}-\left(R+h\right)^{2}}{\left(R+h\right)^{2}}}-\cos z\right) \end{array}\label{eq:D soln quadratic ugly} \end{equation}

becomes

\begin{equation}\begin{array}[b]{ccl}D & = & -\left(R+h\right)\cos z\pm\sqrt{\left(R+h\right)^{2}\cos^{2}z+\left[\left(R+H\right)^{2}-\left(R+h\right)^{2}\right]}\\\\& = & \left(R+h\right)\left(\sqrt{\cos^{2}z+\dfrac{\left(R+H\right)^{2}-\left(R+h\right)^{2}}{\left(R+h\right)^{2}}}-\cos z\right)\end{array}\label{eq:D soln quadratic ugly-how}\end{equation}

Here’s how to refer to the above equation. Write, for example,

eq. \eqref{eq:D soln quadratic ugly}

which renders as eq. \eqref{eq:D soln quadratic ugly-how}.

## Leave a Reply