ID #1029

Why latexrender based on LaTeX does not work in my WordPress/blog?

Latexrender has a plugin for WordPress, which can be donwloaded here. However, this plugin has a butch of problems, so to use it properly really needs some efforts... at least from my perosnal experiences..

Download the zipped plugin, and follow the instructions to change the source files in PHP. Things to note:

  1. In the file class.latexrender.php, to add the path of LaTeX, dvips, etc., remember to add the full path of each executable binary, e.g., for DVIPS the path may be /home/domainname/texlive/2008/bin/dvips. NOTE that the path for convert is /usr/bin/convert for the convert binary is installed by the host server admin. If you've followed the advice in LaTeX installation, then the binaries are already site-wide accessible, so the path can be shortened to dvips.
  2. Unparseable or potentially dangerous latex formula. Error 6 or 4. (*     0 OK
    *     1 Formula longer than 500 characters
    *     2 Includes a blacklisted tag
    *     3 (Not used) Latex rendering failed
    *     4 Cannot create DVI file
    *     5 Picture larger than 500 x 500 followed by x x y dimensions
    *     6 Cannot copy image to pictures directory) Error 4 is normally caused by the incorrect config of the above binaries -> just check the path. Error 6 arises because the pictures folder has a wrong permission -> make it writable. Error 6 may also be caused because the image is not correctly converted due to the incorrect path of ImageMagick. Refer to this post.(this is not the case for HosMonster since the convert and gs is indeed installed in /usr/bin/)
  3. The image is created in /pictures but not displayed, instead, only the orginal command is shown in WordPress. One possible solution is to change the image type to be converted to. -> in class.latexrender.php, var $_image_format = "png"; (
  4. Note that the two files class.latexrender.php and latex.php (together with pictures and tmp directories) should be located in a directory readable by the world, while the latexrender-plugin.php shuould be under the plugins directory of WordPress.
  5. Troubleshooting (suggested by Steven): Try commenting out the 6 unlink lines at the end of class.latexrender.php with // then have a look at the files that are generated in /tmp. There should be .tex .log .dvi .aux .ps and .gif files. Which are missing? Are those that are there correct?
An example is shown in the first comment under this article ~~ elegant, right? :)

Categories for this entry

Tags: installation

Related entries:

You can comment this FAQ