LaTeX and

I use LaTeX2WP to type posts that require mathematical symbols. It is a (python) program developed by Luca Trevisan that converts a LaTeX file into something that is ready to be cut and pasted into WordPress.


You can download LaTeX2WP following these instructions. Once you have a .tex document with latex features compatible with LaTeX2WP (see below) you just need to type

python yourFile.tex

in your command-line, where is one of the files you need to download. This will generate yourFile.html which you can cut and paste in your text editor. Done!

LaTeX Features

It supports many features of latex. The ones I use the most are:

  • Link to URLs without snapshot preview: \hrefnosnap{}{link_text}.
  • Numbered and unnumbered equations via \begin{equation} ... \end{equation}, $$ ... $$ and \[ ... \].
  • eqnarray* is supported, but not eqnarray.
  • Refer to equations and theorems with \ref, \eqref and \label commands.
  • The theorem-like environments theorem, lemma, proposition, remark, corollary, example and exercise are defined, as is the proof environment.
  • {\bf text} for bold text and {\em text} for italic.

Limitations and work arounds

Obviously, it has some limitations. One that annoys me a little is that, as far as I know, it doesn’t work well for bibliographic references.

However, when LaTeX2WP cannot do what you want, you can always put HTML code in the scope of a \ifblog . . . \fi. The conversion will output such HTML code verbatim, and it will be ignored in the LaTeX preview. Conversely, anything in the scope of \iftex . . . \fi is compiled in the LaTeX preview but skipped in the conversion.

Another work around to use when some latex’s feature you want is not available for use in LaTeX2WP is to use the wordpress own syntax for latex equations. Another path that has helped me a couple of times is to use one of the many online latex converter (like this one for example) and then upload the image yourself.

Further Reading

You can find more detailed example of LaTeX2WP capabilities by looking at this .tex and .pdf example provided by Luca Trevisan, as well as his blog post about it.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s