[Download] [Using LaTeX2WP]

LaTeX2WP is a program that converts a LaTeX file into something that is ready to be cut and pasted into WordPress.

This way, you can write, and preview, your post in LaTeX, then run LaTeX2WP, and post into WordPress whatever comes out.

Why would you want to do that? Most users of WordPress wouldn’t.

But if you have ever found yourself typing

<p align="center"> $ latex \displaystyle \mathop{\mathbb E}_{x\sim X} f(x):= 1 \ \ \ \ (1)&fg=000000$ </p>

in order to get

\displaystyle \mathop{\mathbb E}_{x\sim X} f(x):= 1  \ \ \ \ (1)

and wondered whether there is a better way, maybe this is for you.

WordPress does a good job supporting simple LaTeX expressions. You type $ latex 2^{2^k}$, and out comes 2^{2^k}. There are, however, some inconveniences if you are typing something more complex:

  • The editor windows is small, and it can be slow to save and produce a preview;
  • Simulating LaTeX’s displayed equations is a bit painful. If one wants to have numbered equations, they have to be numbered by hand; if one wants to insert one more equation or rearrange the order of presentation, equations must be renumbered by hand, and so do all references to equations;
  • If one wants to publish the notes/ expositions posted on WordPress, then one needs to convert them back to LaTeX.

There are also smaller concerns: for example some WordPress themes (including in theory‘s one) typeset LaTeX equations in gray. This can be changed by appending &fg=000000 to every formula, which is nice to automate. If you are used to having simple macros like \E for expectation, it is annoying to have to type {\mathop{\mathbb E}} each time.

With LaTeX2WP you write your whole post in LaTeX, and use LaTeX to preview it. You cannot use arbitrary macros, but any macro that can be implemented by a simple substitution can be easily added. Any set of theorem-like environments such as theorem, lemma, proposition, remark, etc. can be defined, with any combination of counters. Displayed equations are automatically numbered and centered, and all math equations are typeset with black fonts. The LaTeX commands \label, \ref and \eqref are supported, and \ref and \eqref translate to clickable links. You also maintain a LaTeX source for your post, which is ready for publication in another venue.

So far LaTeX2WP has been used at what’s new and here, at in theory. You’ll notice that the typesetting styles for theorems and section names look different. It is easy to modify the typesetting options to suit your own taste.

I would like to thank Terry Tao with his patience while using a very buggy early version and suggesting several useful improvements.

LaTeX2WP is distributed as free software with a GPL 3 license.

(More or less, this means that you can do with it whatever you like. If you create and distribute a modified version, however, you must distribute it as free software under the same GPL license and credit me for having written the original version.)

If you would like to try it out, click the download tab. If you would like to learn more about the features and limitations of LaTeX2WP, or if you are using it and have a question or a bug report, click the using LaTeX2WP tab.

If you end up using it, do let me know, by commenting on this page or by sending an email to LaTeX2WP at gmail dot com. Do include a link to your blog.