# Tag: wordpress

Having

latexrender
available, one can edit the _class.latexrender.php_ file


string .= '\usepackage{xy}\n';
string .= '\xyoption{all}\n';
string .= '\newcommand{\vtx}[1]{*+[o][F-]{\scriptscriptstyle #1}}\n';


makes it possible to include quiver-pictures in this weblog.
Observe the double blackslash before newcommand, a single backslash
would produce a new-line and fail to define something.

After
three days of desperate trial-and-error I seem to have managed to get latexrender working for
wordpress under Mac
OS X.
First things first : if you only want to include some
symbols in your blog-posts the easiest way to do so is to use mimetex and the
corresponding
wordpress-plugin
written by Steve Mayer. Follow the
instructions and you will be able to include a limited subset of LaTeX
in your blog within 10 minutes.
If you want more, you have to
work a lot harder. The starting point is to follow Steve’s
blog-entries on latexrender
.
But then under Mac OS X you will probably get error messages
when you activate the plugin. The reason seems to be that most versions
of imagemagick available for
OS X require X-terminal support and PHP gets confused between the two
shells. A typical error message is

Warning:
copy(70afbabac176169545d01f4bd91f3055.gif): failed to open

stream:
No such file or directory in
/Users/lieven/Sites/wordpress/latexrender/class.latexrender.php on
line

269

[Unparseable or potentially dangerous latex
formula. Error 6 ]

As suggested by Steve Mayer there are
uncomment the _unlink commands _ at the end of the
_class.latexrender.php_ file and look in the _wordpress/latexrender/tmp_
directory for which conversions were done and which failed. The normal
latexrender-procedure is : tex->dvi->ps->gif. Probably you will
get all files but the gifs!

Another (and more useful) source of
informations is to look in the _error-log_ of the Apache-WebServer and
see whether you get things like

This is dvips(k) 5.94a
\\’
TeX output 2004.08.30:1433\\’ ->
0d48700a5dde6d746813733d26dd8df8.ps

. [1]
sh: line 1:
convert: no decode delegate for this image
format

/Users/lieven/Sites/weblog/latexrender/tmp/
0d48700a5dde6d746813733d26dd8df8.ps\\’.

convert: missing an image
filename/Users/lieven/Sites/weblog/latexrender/tmp/
0d48700a5dde6d746813733d26dd8df8.gif\\’.

identify: unable to
open image 0d48700a5dde6d746813733d26dd8df8.gif\\': No such file or directory. identify: missing an image filename0d48700a5dde6d746813733d26dd8df8.gif\\’.



Here the essential point is that the webserver doesn’t
seem to be able to find GhostScript (even if you have several versions
installed).

To bypass these problems I did two essential
things : (1) in the _class.latexrender.php_ file I rewrote the
conversions so as to use _pdflatex_ instead of tex (to get
immediately a pdf-file rather than the tex->dvi->ps process) and then
use _convert_ to translate this pdf-file into a gif-file. (2) the
version of _convert_ and _include_ (both part of the
ImageMagick package) are those provided by Fink but you should be extremely
careful to install the imagemagick-nox package and not
the imagemagick package! After the command
 sudo fink install imagemagick-nox `
you are presented with several
configuration choices. Do _not_ choose on auto-pilot the default
choices but look for options specifying that there is no X-support!
After this, everything should work. If you want to have a look at how
I changed the PHP files, mail
me
.