Ever needed to write equations on your blog post? But writing the equations and formulae in text editor is a cumbersome act. You cannot create fractions, or use important mathematical signs like integral, summation, limits, differentiator etc. If you use images instead, you cannot change the equations without editing your images.

LaTeX is the perfect solution for writing equations in WordPress posts. It is the most used markup for equations. Rather, most of the mathematics books **are written in LaTeX**. Let’s see how you can write equations perfectly in your posts.

LaTeX is a high quality typesetting system. It is mainly used in creating technical and scientific documentation. It possesses an ability to show complex mathematical equations in their fiducial format.

We can use the same markup for writing equations in our posts. We do not need to install any software for that. It comes as a feature in the Jetpack plugin. When you use the LaTeX shortcode in your posts, an image is created and shown to the readers. Moreover, this image is delivered from WordPress servers itself.

Let’s see how to use this plugin..

## Writing LaTeX equations in WordPress posts

For writing equations, you will need to install the JetPack by WordPress.com plugin. Then in the plugin settings, enable **Beautiful Math** module. More information can be found at Jetpack.me.When you are done, go to the post editor.

While writing a post, use the shortcode as follows.

$latex Your equation code here.. $

Some example equations :

1. Discrete time Fourier transform.

$latex X(e^{j\omega}) = \displaystyle \sum_{n=-\infty}^\infty x[n].e^{-j\omega} $

This code will produce an image as shown below.

2.Integration.

$latex A = \int \frac{1}{t^2}.dt = -\frac{1}{t} $

Image generated for this code is as below.

3. Continued fraction.

$latex \cfrac{1}{\sqrt{2}+ \cfrac{1}{\sqrt{2}+ \cfrac{1}{\sqrt{2}+\dotsb }}} $

WordPress.com uses `amsmath`

, `amsfonts`

and `amssymb`

packages to show your equations properly. If you do not use proper syntax, you may see “**Formula does not parse**” error.

You can find more information about `amsmath`

package syntaxes at http://kogler.wordpress.com/2008/03/21/latex-use-of-math-symbols-formulas-and-equations/ and ftp://ftp.ams.org/pub/tex/doc/amsmath/amsldoc.pdf.

## Text size, colour and background

For size adjustment, attach `&s=X`

to your equations. The size by default is “0” (zero). It can have values from *-4 to 4*. Similarly for foreground colour (text colour), use` &fg=XXXXXX`

. And for background colour, use `&bg=XXXXXX`

. `XXXXXX`

is nothing but the hexadecimal RGB colour code.

All these parameters should be written right after the equation code **without any space**.

An example code :

$latex A = \int \frac{1}{t^2}.dt = -\frac{1}{t}&bg=000000&fg=ffffff&s=4$

Image generated :

Do you already use LaTeX on your WordPress blog? Share your experiences, doubts and problems without any hesitation.

## 2 Comments on “LaTeX Code in WordPress : Write Equations in Posts with Beautiful Math”

Hi Animish. Thanks for the post. you have just helped me changing the latex equation text size. My next question is (which I couldn’t seem to be able to Google an answer for), is whether if it is possible to align equation over multiple lines?

For example, say I have this line: $latex x = z + y = 2 + 3 = 5$ .

I would like to split this into multiple line and align at the equal sign (`=`). So it displays something like this:

“`

x = z + y

= 2 + 3

= 5

“`

(assuming this comment displays correctly the equal signs above should align into a vertical straight line!)

Is there a way I can do this via the Jetpack Beautifu Math plugin? Thanks!

Hi!

Try writing each equation line in a separate latex equation like below. It works for me.

$latex x = z + y$

$latex = 2 + 3$

$latex = 5$