Skip to content →

neverendingbooks Posts

latexrender plugin for wordpress under tiger

Promises and pie-crusts are made to be broken, a wiser man once
said. Still, promises have a much longer life-span and sometimes their
real content becomes redundant over time.

A year ago, I
promised
to document how I got the
LaTeXRender Plugin for WordPress
working under OS X. The procedure
consisted of some trial-and-error operations, installing non-standard
versions of software and hardcoding certain directories throughout
certain files…

Not something I was looking forward
to when I decided to upgrade this WordPress blog but,
surprisingly, things went pretty smoothly this time (Mac-technology
has improved a lot). So, please don’t worry too much about this
post
and follow the (late) instructions below.

First
things first : I will assume you have the ‘generic’ LaTeX
running under Tiger (10.4),that is, use the i-Installer to download BOTH
LaTeX and Imagemagick! Further, in order to get WordPress up and
running, have the standard
MySQL 4.0 package
installed for 10.3 (not version
4.1…) and don’t use the generic Mac-PHP version, but
instead download Marc
Liyanage’s PHP5 package
which has plenty of additional
packages installed (notably, GDlib and MCRYPT which comes in handy if
you want to fight spam-comments using BotCheck).

\r
\n

Download wp-
latexrender.zip
and follow the instructions given to the letter
(there is one undocumented extra directory you have to fill in at the
start of the latexrender-plugin.php file). There is
just one additional thing to do. Find in the
class.latexrender.php file the line starting
with

// convert dvi file to postscript using
  dvips

and include the following lines just before it
:

// begin of workaround // extending the PATH
  environmental variable Soldpath =
  getenv(“PATH”); Swhere_imagemagick_is =
  “/usr/local/bin”; if (Soldpath) { Swhere_imagemagick_is .=
  “:Soldpath”;} putenv(“PATH=Swhere_imagemagick_is”); //
  end of workaround 

activate the plugin and it
should work! Still, there are three things you may want to change. In
the latex.php file uncomment the indicated lines as
you will be using htmlArea to input your posts. In addition, if you
have the MarkDown-plugin enabled, it is best to append additional
lines such as

 Slatex_formula =
  str_replace(“_”,”_”,Slatex_formula);     Slatex_formula
  =
  str_replace(“_”,”_”,Slatex_formula); 

(
between the first ” ” should be the beginning and end
em-tag respectively) or underscores will be interpreted as em-tags.
If you run into additional similar problems, the procedure is to
comment-out the line

 
  unlink(Sthis->_tmp_dir.”/”.Sthis->_tmp_filename.”.tex”); 
  

near the end of class.latexrender.php , look in the
tmp directory for the TeX-file, detect the problem and add similar
lines to the ones above to solve it. Another useful thing to do
is to add TeX-packages in the class.latexrender.php file. My own
version has the following predefined symbols and loaded
packages

 function wrap_formula(Slatex_formula) { 
  Sstring  =
  “\\documentclass[“.Sthis->_font_size.”pt]{“.Sthis->_latexclass
  .”}\\n”;  Sstring .=
  “\\usepackage[latin1]{inputenc}\\n”;  Sstring .=
  “\\usepackage{amsmath}\\n”;  Sstring .=
  “\\usepackage{amsfonts}\\n”;  Sstring .=
  “\\usepackage{amssymb}\\n”;  Sstring .=
  “\\usepackage{xy}\\n”;  Sstring .=
  “\\xyoption{all}\\n”;  Sstring .=
  “\\\\newcommand{\\vtx}[1]{*+[o][F-]{Scriptscriptstyle
  #1}}\\n”;  Sstring .= “\\\\newcommand{\\mathbb{C}c}{\\Bbbk}\\n”; 
  Sstring .= “\\\\newcommand{\\mathbb{C}}{\\mathbb{C}}\\n”;  Sstring .=
  “\\\\newcommand{\\mathbb{Q}}{\\mathbb{Q}}\\n”;  Sstring .=
  “\\\\newcommand{\\mathbb{Z}}{\\mathbb{Z}}\\n”;  Sstring .=
  “\\\\newcommand{\\mathbb{N}}{\\mathbb{N}}\\n”;  Sstring .=
  “\\\\newcommand{\\mathbf}[1]{{\\\\text{\\em \\usefont{OT1}{cmtt}{m}{n}
  #1}}}\\n”;  Sstring .= “\\pagestyle{empty}\\n”;  Sstring
  .= “\\begin{document}\\n”;  Sstring .=
  “S”.Slatex_formula.”S\\n”;  Sstring .=
  “\\end{document}\\n”;          return Sstring;     }  
  

which, among other things, allow all commenters to add
quiver-pictures using xymatrix and vtx to depict vertices. Oh yes, you
can allow comments to include LaTeX-code by uncommenting the
line

  // add_filter(‘comment_text’,
  ‘addlatex’); 

in the latexrender-plugin.php
file (but before you do make sure you have spam under control, such as
with BotCheck mentioned above). That’s all for now. If you want
to use TeX in a comment, make sure to put the code between tags [ tex
] and [ /tex ] (omitting the extra spaces). If you want me to add
other LaTeX-packages, leave a comment.

Leave a Comment

work in progress

The third volume in the NeverEndingBooks-series will be written by Geert Van de Weyer and will
be about (double) Poisson structures in the noncommutative world. Volume
4&5 are becoming clearer every day and if you think you have a
project fitting in this series, you can always email to
[info@neverenedingbooks.org][3].

As for the NeverEndingBooks-URL, I will
probably close this blog by the end of the month (at its first
birthday). The main reason is that I found out that it takes several
people to maintain a mathematical blog for some time. So, if you want to
co-author a group-blog on noncommutative algebra and/or noncommutative
geometry, please [email me][5] (or even better, leave a comment here so
that other people may be willing to join in too) and if there is enough
critical mass to go ahead with the plan I will be happy to set up a
group-blog at noncommutative.org.

At
this URL I’ll probably put a frontpage for the book-series we started
and which you can buy at all times via lulu.com/neverendingbooks. It will contain errata- and suggestions-pages for each volume and
details about forthcoming books, links etc… Btw. it would probably
be a good commercial move to delete TheLibrary links sooner, now that
even String Theorists are driven to this site via
Lazariou’s paper On
the non-commutative geometry of topological D-branes

As my
main objective next year will be to write courses (from first year down
to post-doc level) I will set up (again) a Moodle site (mainly in English,
although UA-students will be free to add to it in Dutch). News about it
will be posted eventually at my regular, but forgotten
homepage
and perhaps here.

Once again, if you are interested
to contribute at unregular intervals to a noncommutative group-blog,
please leave a comment!

[3]: mailto: info@neverendingbooks.org
[5]: mailto: lieven.lebruyn@ua.ac.be

Leave a Comment

publish

A quick reply to some of the comments
to the lulu/neverendingbooks post.

_Are they also
responsible for the graphical design in your books ?_ No! In fact it
was one of the more pleasant experiences of the last couple of weeks to
develop our own format, LaTeX-style and covers. The usual gang had their
say in all of this but it is only fair to say that Jan did most of the work. We developed
the cover-concept (that is, macro shots of games in duotones and placing
of titles etc) by trial and error. Jan is responsible for the
photo-shoot, I did choose the shots to be used and did the initial
coloring and placing of titles and left the final tweaking to Jan, who
did some lay-out work before. We, at least, are happy with the
result… As mentioned before, the LaTeX-style sheets were made
using the
memoir package
.

_Who is responsible for trying to sell
the book, you or them?_ I dont think we are doing great efforts to
try to sell the books, yet. Up to now, you can only get to the
book-sites via this blog or via my homepage. Lulu claims that they will only make
money if we do… and as this is clearly sales-talk (they make money
on every book they print) it involves no (or a very small) financial
risk on our part. Anyone who wants to have a copy of one of our books,
orders them at Lulu, they print it and ship it to you. But beware! They
have several shipping options and for most of them it costs you more to
get them shipped than to buy the books… In fact, that was the main
reason why we didnt put the URL online before we had two volumes out.
The reason being that if you buy for over 25dollars you can have them
shipped via their “SuperSaver” option, that is, shipping is free (but
probably slow). But, based on my own experience it works well (I ordered
a few copies of book 1 via SuperSaver and another one via their
InternationalShipment and got the free SuperSaver package a day before
the costly other shipment…). Our real investment is that we have
bought ISBN-numbers for the books (at a price of 35dollars/book) and
hope to earn this back from a small royalty we get from each book (the
Lulu-rule is that they get 25% of any royalties you set). Even though we
are not entirely happy with the distribution process we opted for this
series for an unusual book-format making it handy and fun to use (the
square 7.5 x 7.5 inch format is very pleasing to read and the
coil-binding makes it extremely handy to lay flat on the table). So we
view this series as a student-edition of the books and we keep them as
cheap as possible. At a later stage it may happen that we will also have
a library-edition of the books which will have global distribution
(meaning that you can order them via Amazon or your local bookshop). For
this to work, you have not so much freedom in your book-format and can
only have regular binding. Besides, buying such a global-ISBN is more
costly and will make this edition (a lot) more expensive. But, as you
can see from the picture, the books get printed and shipped and look
VERY nice. In fact, of the few copies I ordered, I had to hand out
already two because some people just liked the feel and touch of it. I
think, people will only gradually be willing to buy their own copy when
(1) they have glanced through a copy at some meeting or seminar and (2)
if more volumes come out and they have a greater choice in bying 2
volumes to get free shipping. On this last issue : already three people
have expressed interest in writing a book in our series. My own hunch is
that the next book out will have to do with Poisson noncommutative
geometry and will have a macro shot of a war-game on its cover (authors
can give suggestions for which games they want on their cover), curious
how this will work out…

_How many have you sold so
far?_ Well, not enough so far to get our ISBN-investment back…
But, once again, I think it will take some time for people to trust the
series enough to buy a volume or two. In the first week we made the URL
available we sold 16 books, so if you want to increase our sales-index
please do by going to this
page
for the first volume and to this page for the second
volume. But perhaps it is easier to bookmark the lulu/neverendingbooks if
you want the latest news on the series. I”ll keep you posted on our
sales via this page. If you buy a book and like the result, please tell
others about it (or even better, let them see and feel the copy.
Hopefully you will get it back…)

Leave a Comment