How to convert latex to wordpress acceptable latex format

The essential difference between ordinary latex and wordpress latex is that the latter requires the \$latex $ deliminator for latex code. This is annoying to type especially if you are like me who is so accustomed to the simple $ $ deliminator in ordinary latex. And there is no easy substitution method to convert one to the other in a latex editor, because one would have to skip every other $ in the substitution $-> latex. So here is so far the quickest way I have found to do the conversion. I assume people are using windows operating system (no offense to the Unix or Mac users, it’s just that the latter two are much easier to work with py2exe which I am about to introduce, and can be easily learned on google).
The first step is to download version 2.6 of Python (or any version > 2.4 presumably). Then search and download latex2wp zip file, which contains a bunch of python files and latex sample files. Finally look for py2exe installation file for the particular version of python and operating system you are using. Make sure not to download 64 bits if you are using 32 bit operating system. And put all the executables under the same folder.
Now after installations of all the above programs, move all the python files in latex2wp into the python base level folder, e.g. c:\python\. Create a new python file called setup.py, which can be done by duplicating any other python file such as latex2wp.py and renaming it to setup.py. Change its content to the following

from distutils.core import setup
import py2exe

setup(windows=[‘latex2wp.py’])

Now open up a command window by typing cmd in the start menu, and go to the folder c:\python, or wherever python and latex2wp.py are located. Type in the following command:

python setup.py py2exe

This will compile an executable called latex2wp.exe in the c:\python\dist\ folder. Now you can copy and paste this executable anywhere you want and start converting latex files into wordpress style latex. But you must use a command of the following form

latex2wp sample.tex

and it will output sample.html, in which you will find wordpress style tex rendition of your original, ready to be copied and pasted onto your wordpress editor!

Please let me know if you have any technical questions. I am surprised that no GUI has been made to do such conversion. The true CS people are warmly invited to make it happen, in less than 5 minutes or so perhaps. All credits are due to the developers of python, latex2py, py2exe, and wordpress.

Advertisements

About aquazorcarson

math PhD at Stanford, studying probability
This entry was posted in Uncategorized and tagged , , , . Bookmark the permalink.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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