LaTeX Code in WordPress : Write Equations in Posts with Beautiful Math

Posted by on Feb 3, 2014 in WordPress ·

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 equation in WordPress

A demo of equation written in LaTeX

What is LaTeX?

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 plugin. Then in the plugin settings, enable Beautiful Math module. More information can be found at 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.

Discrete time Fourier Transform


$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 }}} $

Continued fraction uses amsmathamsfonts 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 and

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 :

Text size, colour and background

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

Last updated on : July 13, 2014.

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

  1. 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!

    1. 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$

  2. = $\sqrt{25 + \sqrt{108 + \sqrt{154 + 15}}}$
    = $\sqrt{25 + \sqrt{108 + \sqrt{169}}}$

    I wrote like this in two lines. But it displaying in one line. Please tell me a solution to display as steps. Thank you.

  3. $latex x = z + y$
    $latex = 2 + 3$
    If I write like this in two lines it is displaying in one line. Please tell me how to fix it.

    1. Hi Anand,

      I don’t have an idea about why this might be happening in your case. But I can suggest one thing here. Try to add a space between the formula and the $ sign. And, also try to add an extra line between two LaTeX codes.

  4. Hi sir, please how to allow visitors write their own maths equation when they are trying to solve a maths problem? thank u in advance

Leave a Reply