Using LaTeX2WP

The distribution contains the following files:

  • the conversion program
  • specifies typesetting options, and environments and macros recognized during the conversion
  • readme.txt: some basic information on how to use LaTeX2WP
  • sets the typesetting options in the style of Terry Tao’s blog.
  • macrosblog.tex: defines LaTeX commands recognized by LaTeX2WP for typsetting colors, links to URLs, and images, so that LaTeX files containing such commands can be typeset and previewed offline
  • example.tex: a sample post showing how to use the main functionalities recognized by LaTeX2WP
  • post-template.tex: a starting point for writing a post in LaTeX; it imports various packages and macros so that pictures, hyperlinks etc. can be seen in the preview the same way they will appear in the post.
  • knuth.png: a picture (from xkcd, Copyright Randall Munroe) required to preview example.tex
  • gpl.txt: the text of the GNU General Public License
  • changelog.txt: a list of changes from previous versions.

By looking at example.tex, it should be easy to see how to get started. Indeed, just starting to write LaTeX, and seeing what happens with the conversion should be fine.

Your mathematical posts do not have to look like mine. A number of stylistic changes can be made by editing (make a copy before editing it); comparing it to, and reading the comments in the code, should help understand how to make such changes.

It is possible to add your own LaTeX macros, if they do not involve passing of parameters. It wouldn’t be too hard to add support for arbitrary LaTeX macros and environments, but right now I have run out of energy (maybe during the Summer).

Another limitation is that there is no support for footnotes, and no support for bibliographic references. I will definitely work on this during the Summer.

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.

25 thoughts on “Using LaTeX2WP

  1. Pingback: A bash workflow script for LaTeX2WP « Christian Marks

  2. Hi, is there a way to write equations such that they appear centered in WordPress? I’ve tried using both \[ ‘equation’ \] and \begin{equation} \end{equations} without luck.


  3. WordPress seems to be changing the html I get from latex2wp. I’ve only had a problem starting today. I was able to make two posts using latex2wp html that turned out perfect. Strangely, even when I post the html of one of these old successful posts into a new draft post wordpress still changes it.

    In particular it seems they are removing some of my ‘s, which results in my boxes surrounding way more text than they should.

  4. In my above comment the last sentence was meant to be

    “In particular it seems they are removing some of my div code for boxes, which results in my boxes surrounding way more text than they should.”

  5. Pingback: First Draft | Eigenpost

  6. Pingback:     $latex LaTeX$ na WordPress – porada « FIKSACJE

  7. Pingback:     LaTeX na WordPress – porada « FIKSACJE

  8. It is giving the following error:
    Traceback (most recent call last):
    File “E:\”, line 657, in
    File “E:\”, line 140, in extractbody
    for i in range(1,(len(L)+1)/2) :
    TypeError: ‘float’ object cannot be interpreted as an integer

  9. Pingback: De Latex a WordPress « Memorandum Matemático

  10. Pingback: LaTeX and | Thiago G. Martins

  11. @ziyuang I’ve tried to change the files so that subsubsections would be supported but with little success. Do you think you can give me a hand?

  12. Pingback: [¯|¯] Scrivere formule matematiche con LaTeX su WordPress | » Esercizi svolti di Matematica

  13. Pingback: De Latex a WordPress | Notas breves de Matemáticas

  14. Pingback: Tools for Writing Mathematical Blog Posts | Rob Hubbard's Blog

  15. Hello,
    I think this programme is pretty cool but it seems like both $$…$$ and \[…\] are not working properly. I have read my html file, and found out that there are no
    part in html but instead the html file is already aligned in the centre. I have no idea how to fix this problem as I know nothing about python, so I am writing a comment here to possibly get a respond from you. (Moreover, hyperlink, colouring and attaching photo also have the same issue)

    By the way, I am a Macbook user, with macOS Sierra, version 10.12 and as a python programme, I use terminal that is equipped in mac from the beginning

  16. My brother suggested I might like this website.
    He was entirely right. This post actually made my day.

    You can not imagine simply how much time I had spent for this information! Thanks!

  17. I am receiving the following error
    : File name too long
    import-im6.q16: not authorized `re’ @ error/constitute.c/WriteImage/1037.
    from: can’t read /var/mail/sys
    from: can’t read /var/mail/latex2wpstyle
    ./ line 33: syntax error near unexpected token `(‘
    ./ line 33: `count = dict()’

    There is a line in latex2wp that looks like `count = dict()’ ?

  18. Pingback: LaTeX Teste… – Letras Católicas

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 )

Connecting to %s