Optimized Latex

Latex is a great language to use when you are writing mathematical formulas. This is an optimized version of two other latex plugins. It is easy to use but the latex syntax is tricky. This page will give you some examples.


  1. Download the plugin at WordPress.org
  2. Upload the plugin source to the `/wp-content/plugins/` directory
  3. Activate the plugin through the ‘Plugins’ menu in WordPress
  4. Make sure your `/wp-content/cache/` directory exists and is writeable


This plugin does not allow you to use your own latex server like many other latex plugins. I thought: ”If you have your own latex server you would probaply not need this plugin anyway.”


How do I add LaTeX to my posts?
[latex]e^{\i \pi} + 1 = 0[/latex]
Or use the inline syntax:
$latex e^{\i \pi} + 1 = 0$

How do I change the color on the images?
To change the default color on all images, go to Settings -> Optimized LaTeX. If you want to change color on just one image, use this syntax:
[latex color="ff0000" background="00ff00"]e^{\i \pi} + 1 = 0[/latex]
Or use the inline syntax:
$latex e^{\i \pi} + 1 = 0&bg=00ff00&fg=ff0000$

Can I change the size of the image?
[latex size="4"]e^{\i \pi} + 1 = 0[/latex]
Or use the inline syntax:
$latex e^{\i \pi} + 1 = 0&s=4$
The size can be any integer from -4 to 4 (0 is the default).

How can I change the latex images appreance?
Use CSS! You can adjust the CSS used for the LaTeX images to suit your theme better. Go to Settings -> Optimized LaTeX and edit the Custom CSS.

Error messages

  • Formula does not parse: Your LaTeX is invalid; there must be a syntax error or something in your code (WP LaTeX doesn’t provide any debugging).
  • Formula Invalid: Your LaTeX code attempts to use LaTeX commands that this plugin does not allow for security reasons.
  • You must stay in inline math mode: Fairly self explanitory, don’t you think? See above.
  • The forumula is too long: Break your LaTeX up into multiple images. WP LaTeX limits you to 2000 characters per image.
  • Could not open TEX file for writing or Could not write to TEX file: You have some file permissions problems. See Intallation instructions.



LaTeX Syntax

Here are some examples of latex code. Mix them together and you get some crazy math formulas.

Syntax Description
\cdot Multiplication
\dfrac{2}{3} Division
\approx Approx
\int_{0}^{\inf} f(x) dx Integral
\sum_{0}^{1} Sum
\prod_{0}^{1} Product
\sqrt{} Squareroot
\left( \dfrac{5x}{2y} \right) Big parentheses
\Rightarrow{} Right arrow
^{x} Superscript
_{x} Subscript
\geq Greater than
\leq Less than
\begin{equation} text \end{equation} Squareroot
^{ \circ } Degree
\, Small space
\: Normal space
\; Big space
\! Decrease space
|x| Absolute value

Thanks to

Javier Meseguer – He suggested the 0.7.3 update.


0.7.3 (2010-10-07):
Replaced the ajax URL to an absolute URL instead of an relative.

0.7.2 (2010-08-23):
Removed the ajax script for pages with no LaTeX.

0.7.1 (2010-08-06):
I created it.