# Latex for Wordpress

I've just installed 'Jetpack' which comes with $latex \LaTeX$. This post is to provide a quick reference. $latex \LaTeX$ parses the text in the WordPress post, and lays out the display as a graphic for the viewer. Though someone reading this will see images, there are no images referred to in the edited post. $latex \LaTeX$ is a generalised document layout language, but as far as I am concerned, the main use of $latex \LaTeX$ in WordPress is mathematical.

Note that as the images are generated on the fly, the page will be slower to load than if the page were pre-rendered. Therefore, I think it may still be best for the web to generate the image, save it and then display the result via an <img> tag (keeping the $latex \LaTeX$ hidden in a comment so that the image can be regenerated if need be). As already mentioned, I have not pre-generated the images for this post, it is all done in code.

It's a pity that MathML isn't well supported at the moment. According to the wordpress codex, one uses this format to include $latex \LaTeX$ code:

$latex your-latex-code-here$

Some of the basic examples were been taken from the wordpress codex page, others I've created. The references from Andy Roberts were very helpful (though he didn't talk about integration as far as I could see). His reference of symbols is quite handy

The code \LaTeX will show a properly formatted $latex \LaTeX$ string, and adding &s=X (where X is a number from -4 to 4 will change the size).

$latex \LaTeX&s=X$

$latex \LaTeX&s=-4$
$latex \LaTeX&s=-4$
$latex \LaTeX&s=4$
$latex \LaTeX&s=4$

There are a lot of symbols which I can use, e.g. + - ! = / () [] <> and a few others. For other symbols such as Greek letters, arrows, boolean algebra there are commands to issue. Thus the instruction $latex v=f\lambda$ gives $latex v=f\lambda$

To create a fraction, the \frac command is used. This as the format \frac{numerator}{denominator}

$latex \frac{1}{1+z}&s=4$
$latex \frac{1}{1+z}&s=4$

Commands can be nested:

$latex \frac{ \frac{(z+1)^2}{z+2}-1 }{1+z}&s=4$
$latex \frac{ \frac{(z+1)^2}{z+2}-1 }{1+z}&s=4$

It'd be nice to have some brackets here:

$latex \frac{ (\frac{(z+1)^2}{z+2})-1 }{1+z}&s=4$
$latex \frac{ (\frac{(z+1)^2}{z+2})-1 }{1+z}&s=4$

However, those new brackets are a little weedy, let's make them bigger:

$latex \frac{ \left(\frac{(z+1)^2}{z+2}\right)-1 }{1+z}&s=4$
$latex \frac{ \left(\frac{(z+1)^2}{z+2}\right)-1 }{1+z}&s=4$

By adding \left and \right in front of the bracket symbols, I am telling $latex \LaTeX$ to automatically resize the brackets to fit whatever is inside.

Powers can be easily done with the expected ^, and curly brackets are again used to group things, note the space after \pi

$latex e^{\pi i}+1=0&s=4$
$latex e^{\pi i}+1=0&s=4$

Let's try something a little more tricky

$latex \psi(t)=Ae^{i(\omega t-kx)}&s=4$
$latex \psi(t)=Ae^{i(\omega t-kx)}&s=4$

Matrices can be typeset with the array command:

$latex \left[ \begin{array}{ c c c } 1 & 0 & 0 \\ 0 & -1 & 0 \\ 0 & 0 & 1 \end{array} \right]$
$latex \left[ \begin{array}{ c c c } 1 & 0 & 0 \\ 0 & -1 & 0 \\ 0 & 0 & 1 \end{array} \right]$

$latex cos\left(\frac{3\pi}{9}\right) \int^{\sqrt[3]{3}}_1 t^2 \, dt = ln \sqrt[3]{e}&s=4$
$latex cos\left(\frac{3\pi}{9}\right) \int^{\sqrt[3]{3}}_1 t^2 \, dt = ln \sqrt[3]{e}&s=4$
I hope that someone stumbling on this page found it useful, and they weren't searching for other types of $latex \LaTeX$....