# LaTeX to WordPress

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.

## 300 thoughts on “LaTeX to WordPress”

1. Luca,

This sounds great. Thanks for making this available. I maintain a blog for my coding theory course and the limitations of wordpress LaTeX support has been somewhat annoying. I’m looking forward to using your program to make my life much easier. Thanks again.

2. Excellent! Would you consider licensing this under GPL V2 or GPL V2+? Some people at big companies (e.g. Microsoft) can’t contribute to GPL3 software because of its terms regarding patents.

3. Cool! I’ll give it a try, definitely.

Thanks again.

Ran

86. Pingback: Complex Analysis « Andy Soffer

87. Pingback: Visto nel Web – 34 « Ok, panico

88. Using your program at studeocs. It’s very nice so far! I need to include citation information in my blog (for example, have a bibliography at the end of the post and numbered in-document links within the text). Any idea how I could automate that? I’ll be using a bib file for all my references. Thanks.

89. HI, I just started blogging and posted my very first blog with your latex to wordpress script. It is very nice, Thanks!

The only thing I noticed is that it seems the following escape sequences are not converted correctly:
1. “\{” or “\}” is rendered “{” or “}” in latex but “\{” or “\}” in latex2wp
2. “\verb|…|” is rendered “…” in latex but “\verb|…|” in latex2wp
3. “\^{}” is rendered “^” is latex but “\^{}” in latex2wp

Please let me know if there is a way to print those special symbols consistently in both latex and latex2wp 🙂

Thanks

90. To render curly brackets, put them in a math environment: $\{$ will render as {. Same for ^. Unfortunately there isn’t a simple workaround for the verbatim mode of latex

91. Thanks!

92. Pingback: LaTex display « Free Mind

93. Pingback: Hello « Anurag's Math Blog

94. Hi Luca!

I think that if you use some service like github.com to share the code, the community maybe could improve it. This script is very useful and I’ll be glad to help at least a little.

Regards.

95. I think this is among the most important info for me.
And i’m glad reading your article. But wanna remark on few general things, The site style is great, the articles is really great : D. Good job, cheers

96. Hey – I wanted to thank you for this. I’ve just started using it as well.

I maintain a mathblog at mixedmath.wordpress.com.

97. $latex \displaystyle \mathop{\mathbb E}_{x\sim X} f(x):= 1 \ \ \ \ (1)&fg=000000$

98. Supply basic details of a phone number like name of the owner, address and the number itself to get a search will
underway. This process only allows for two removals, so if you have multiple entries in their
database, you may have to use other email addresses to remove all instances
of your information from their website. How can I do reverse cell phone lookup to find
who owns it.

99. Hi,
used it for my first post- works quite fine, but did have to do some editing.

100. Hello Luca,

I would like to thank you for your latex2wp program. It has helped me a lot! I have also included a link to yours in my own blog.

Thanks again.

101. Try this
$\displaystyle \li_{s}(i)=-2^{-s}\eta(s)+i\beta(s)\quad (1)$

102. $\displaystyle \li_{s}(i)=-2^{-s}\eta(s)+i\beta(s)$

103. Nice post. I used to be checking continuously this blog
and I am inspired! Extremely useful information particularly the final phase :
) I take care of such information much. I used to be looking for this certain
info for a very long time. Thanks and best of luck.

104. Hi there, everything is going fine here and ofcourse every one
is sharing information, that’s genuinely excellent, keep up writing.

105. My client George is a good start. Technology and Jealousy in easy weight loss tips Why
do we get jealous that our partner is always on their phone
or constantly checking their social network account.
In conjunction with a qualified medical professional, the symptoms of this addiction?
So, what can we do in easy weight loss tips to stop communication break down
and our relationship. A counselor may provide you with healthy coping mechanisms to relieve jealous feelings.

106. This diet promises that after a few days of following Sean Murray Weekly Diet Plan.
The dried green stems of three species in Asia equisetina ephedra, Academia Sinica, ephedra, you will have plenty of hours in
your life. Some of the ingredients in Banital may
support weekly diet plan. Huge numbers of people are afflicted by an underactive thyroid.

107. Pingback: $latex LaTeX$ | Brain Design

108. Awesome blog! Is your theme custom made or did you download it from somewhere?
A design like yours with a few simple tweeks would really make my
blog shine. Please let me know where you got your design.

Cheers

109. We had to construct you just one very small comment too finally thanks quite definitely over again for your attractive facts you’ve reviewed on this web site. It is often really open-handed with persons just like you to allow quickly juat just what a few individuals probably have marketed being an automated e-book to assist along with generating a number of dough for his or her very own conclusion, just remember given that you have attempted it in the event you wanted. These tips likewise acted similar to a great way to fully grasp lots of people have identical attention similar to my personal unique to find out an increasing number of in respect in this make a difference. I believe there are several more pleasurable predicaments in the beginning for many who commence studying your own log submit.

110. Pingback: Test for LaTeX2WP | Elliot's Blog

111. In February 2004 he embarked on UN-sponsored talks with the Turkish Cypriot administration of North paphos car hire.

112. Pingback: Short Latex Helper | mathtuto

113. Pingback: math | electericity

114. Awesome! I was about to write an app like this. Looks like I can focus on math instead 😛

115. Thanks for this program! I started using it at amakelov.wordpress.com.

116. Pingback: Moving over « The Quantum Gang

117. Pingback: Moving over | Climbing the Mountain

118. You’ll for certain do not have something to lose with Adiphene, thus for those
that actually need to slim while not losing their time and power,
then Adiphene is that the product for you. This means
thay everybody who makes use of Adiphene should shed pounds.
Adiphene Weight Loss Supplements Offers a Unique 25% Discount n select package fr Online B Worldwide If the online critiques are something to go by, Adiphene is an efficient
weight-loss option.

119. Hi Luca, thank you for your wonderful LaTeX-to-WordPress program. Just wanted to let you know that I have been using it for my recent posts and have shared this page so that others can also find out about the program.

120. Thank you very much!

I wanted to construct a table and it worked great. It would be perfect if we could construct vertical lines separating the table using tabular (e.g. something like \begin{tabular}{c||cc|cc}) but it seems that the program could not parse it.

121. Hi Luca,

Thanks for the program. I played around with your code and I have implemented the align environment (not the align* one). I can send you the modified code. Since I am not really familiar with Python, I just did somethings with trial and error. I would be happy if you can check the changed code and write it in a better way and update the version, since mine looks like a mess!

If you are interested let me know.

Thanks!

122. I do consider all of the ideas you have introduced on your post.
They’re really convincing and can certainly work. Nonetheless, the posts are too quick for novices.

May just you please prolong them a little from subsequent time?
Thanks for the post.

123. są pochopne wyrazić sumę stwórz matrymonialnych, jednocześnie spośród zacisznymi,
jeśli obejmują że znaczenie się na nie sprowadzi im
nazwaną pociecha. Istnieją poważnie chłodne i jeśli rzeczywiście to potrafię ucapić – sztywne.
W 4 faktach na 5 zdecydowanie zaciekawione zostawieniem rozporządzeń do
skupionego majątku.

124. Pingback: Quantum Lovasz Local Lemma | Pieces

125. Hi. I searched for latex in wordpress and found your program. This is really great work. I have some knowledge in python too. If I have time, I may improve it. Specially, the area of using definition theoremstyle or other commands like eqnarray in latex. Anyway, than you very much for your time in this. Let me know when you try to improve it. I will help if I can. And the codes were nice and readable by the way.

126. Though I said this in mail, I think I should say it here too. This program is compatible with python version 2 only. Not with version 3(probably latter versions). Anyone who is getting errors like “float to integer version” or “s=extractbody(s)”, be sure to reinstall python 2 and it should be gone. Thanks.
BTW, you asked to include blog address too. This is mine: https://karushib.wordpress.com/2015/08/19/ease-the-pain-of-latex-writing-in-wordpress/

127. Hey Luca, thanks very much for sharing the code! I’m using a slightly modified version to run a jekyll-based website here: https://amakelov.github.io

128. Pingback: LaTeX2WP Test Post | TCS Notebook

129. Pingback: WordpressでのLaTeX (メモ) – Konno Log

130. Hi and thanks for this very helpful tool! One question: Is there an easy way to change the numbering of theorems to something like “2.3.1” for Theorem 1 in Section 2, Subsection 3, instead of plain “1”? Putting _SecNumb_._SubSecNumb_ in front of _ThmNumb_ seems not to work …

131. Pingback: buy boldenone online

132. Is there a list somewhere of the LaTeX packages which are supported? I like to use some packages, like enumitem or tcolorbox, which maybe are not commonly supported and thus I am unsure whether I should rewrite my LaTeX documents to not use those packages or not.

133. Cool tool, thanks for making this.

I had a quick question though, you mentioned that:

If one wants to publish the notes/ expositions posted on WordPress, then one needs to convert them back to LaTeX.

Do you know a good tool for this direction? Especially for batch jobs? For example, a whole wordpress blog from back-up files. I’ve seen a few that convert straight to pdf, but it’s nice to have LaTeX in between to do some clean up. Also, prefer not to go through html scraping and html-to-TeX since it’d lose info from within the wordpress latex environments (since they just become images).

134. Hi can I indent paragraphs? I tried to set up indent, for example, \setlength{\parindent}{0.4in}. But in HTML it did not come out.

135. Pingback: Test 1 – Math Blog

136. Pingback: Terrytao(Software) – MathWorks

137. How to math equation is responsive? I create math formula using Katex but it is not responsive. This is link that we create math formula https://vumath.com/simpson-1-3-rule-with-matlab/, Please tell me any method to responsive math equation or formula

138. Pingback: Blogger blog… | Thiago Araujo

139. Hello, Thank you for your program. I am using it in my blog

140. If you use Python 3 and see the problem
for i in range(1,(len(L)+1)/2) :
TypeError: ‘float’ object cannot be interpreted as an integer
Simply change the division operator / to the integer division operator //
There are two occurrences, one on line 140 and the other on line 153.

Explanation: Python 2’s integer division behaves like C, it rounds down. To get the same behavior in Python 3, use // instead of /.

141. You shared a great content of MATLAB. Thank you for sharing this.