This site is a showcase for using LatexRender for mathematics in WordPress

Using LaTeX in WordPress

LatexRender as a plugin

Monday 9th August 2004

Filed under: — Steve @ 6:02 pm

I have now managed to make LatexRender as a plugin (download files here) which means that it won’t be necessary to edit WordPress files. Before you get too excited this assumes

  1. You are using at least WordPress 1.2 (which uses plugins)
  2. You have the latest files which don’t eat backslashes (detailed on page 2)

If not, you can still use the method in 5th August’s post. Also you will need to put some information about where to find files in the latexrender files.

1. You need to have \LaTeX and ImageMagick installed on your server. If this is not possible, then try mimeTeX (see page 2)

2. latexrender-plugin.php
Ensure that
contains the correct path to where you have put latex.php

3. latex.php
Ensure that
$latexrender_path = "/home/domain_name/public_html/path_to/latexrender";
$latexrender_path_http = "/path_to/latexrender";
contain the correct path to where your latexrender files are to go

4. class.latexrender.php
Ensure that
var $_latex_path = "/usr/bin/latex";
var $_dvips_path = "/usr/bin/dvips";
var $_convert_path = "/usr/bin/convert";
var $_identify_path = "/usr/bin/identify";

point to the right places.

For Windows the paths in class.latexrender.php must use \ or / not just a single \
For example
var $_latex_path = "C:\texmf\miktex\bin\latex.exe";
var $_latex_path = "C:/texmf/miktex/bin/latex.exe";

5. Create a new latexrender folder in your WordPress folder, with sub folders tmp and pictures. These 2 folders must be chmod to 777. Upload latex.php and class.latexrender.php to the latexrender folder

6. If you are happy to let commenters use LaTeX (but beware spammers) then in latexrender-plugin.php remove // from the line:
// add_filter(‘comment_text’, ‘addlatex’);

7. Upload latexrender-plugin.php to WordPress’s plug-in folder (/wp-content/plugins) and activate it in the Plugins menu

\LaTeX should now be enabled! Use [tex ] and [/tex ] (without the space) to surround your maths. There’s a tex button to do this for you.


RSS feed for comments on this post. TrackBack URI

  1. […] ¤í¤¤¤í¤Ê¥Ö¥í¥°¥Ä¡¼¥ë¥µ¥¤¥È¤ò²ó¤Ã¤Æ¡¢ WordPress ME¤Ë°ìÌܤܤì£÷ Íýͳ¤Ï¤³¤Î¥×¥é¥°¥¤¥ó¤Ç¤¹¡£ Using LaTeX in WordPress Á°¤«¤éµ¤¤Ë¤Ê¤Ã¤Æ¤¤¤¿¥Ä¡¼¥ë¤Ç¤¹¤¬¡¢ ¤³¤ó¤ÊÁÇŨ¤Ê¥×¥é¥°¥¤¥ó¤¬¤¢¤Ã¤¿¤Ê¤ó¤Æ¡£ ¶á […]

    Pingback by ALL 4 ONE and ... » WordPress ME ¤ÇºÆ¥¹¥¿¡¼¥È¡ª — Thursday 19th August 2004 3:06 pm #

  2. […] 12; tornado @ 12:25 am

    IllustRender is a plugin for WordPress, heavily based on LatexRender, which replaces illustration code in your posts with the actual illustration. Cu […]

    Pingback by ChapterZero » IllustRender — Sunday 2nd January 2005 5:26 am #

  3. Hi, I’ve been waiting for this!But, where do we find mimetex.php for the mimetex installation? Could you expand a little bit on how to install the plug-in using mimetex?

    Comment by d — Tuesday 10th August 2004 3:31 am #

  4. Your site seems to be working now

    Comment by Steve — Tuesday 10th August 2004 12:04 pm #

  5. I’ve tried your setup with Latex and ImageMagick and it works flawlessly. I plan to try using the mimetex method later this week and will let you know.

    Comment by d — Wednesday 11th August 2004 7:11 pm #

  6. Hey Steve. The first instruction on this page should be line number 226. Line 233 is function format_to_post.

    Comment by Clay — Wednesday 15th September 2004 2:34 am #

  7. Oh yes! Thanks for that. Changed now

    Comment by Steve — Wednesday 15th September 2004 4:30 pm #

  8. Hey Steve, I’m a little confused. I don’t have latex or imagemagick installed on my server, so I installed mimeTex and activated your mimetex plugin. Now, is this an alternative or a necessary substitute to latexrender, i.e. does not having latex and imagemagick mean that I can’t use latexrender and must settle for mimeTex?

    Comment by Felipe — Friday 1st October 2004 1:23 am #

  9. your link in this post “download files here” doesnt work, I eventually realised you have another link in the top right, but you might want to update that.

    Comment by NickM — Sunday 16th January 2005 9:25 pm #

  10. Thanks NickM for pointing that out. It was an error in the file name which I have corrected now :)

    Comment by Steve — Sunday 16th January 2005 9:35 pm #

  11. Steve, i’m using the latest nightly build of 1.5 and installed your plugin for use with mimetex. However, even though mimetex works fine, I’m getting this message when I try to use it in a post:

    [Mimetex cannot convert this formula]

    Can you help me?

    Comment by Felipe — Saturday 12th February 2005 1:24 am #

  12. Oh, and the formula works with mimetex.html, so it’s not my sintax.

    Comment by Felipe — Saturday 12th February 2005 1:33 am #

  13. If mimetex is working OK on your system then:
    1. are you sure you have the paths correct in mimetex.php?
    2. is /pictures chmodded to 777?
    3. it could be that PHP had been locked down preventing it using some commands. In mimetex.php change the line
    which calls mimetex in a different way and see if that works

    Comment by Steve — Saturday 12th February 2005 3:40 pm #

  14. Steve:

    Thanks. For some reason it didn’t like the cgi created with the “-DAA” command, but it did like the one created with the “-DGIF” command.

    Comment by Felipe — Saturday 12th February 2005 5:58 pm #

  15. Steve, I’m using mimetex for my blog. I’ve just upgraded to wordpress 1.5 and there is a little problem. In the montly archives view and category views, the TeX portions does not work. Could it be a bug on wordpress 1.5?

    Comment by tpc — Sunday 20th February 2005 7:43 am #

  16. I really can’t see why that should be, since all WordPress is doing is showing some of the posts, but should process each post as normal. I haven’t got 1.5 installed so it is difficult to see what the problem is.

    Does anyone else have it working with 1.5 or offer any help?

    Could you point me to your blog so I can see for myself?

    Comment by Steve — Sunday 20th February 2005 11:44 am #

  17. Update: Thanks to RustIndy on WordPress support I have the answer. In Archives and Categories view WordPress 1.5 shows an excerpt of the text so you need to add a line in latexrender-plugin.php. After
    add_filter('the_content', 'addlatex');

    add the line
    add_filter('the_excerpt', 'addlatex');
    and that should do the trick :smile:

    Comment by Steve — Sunday 20th February 2005 1:13 pm #

  18. Yes, added that line and it works perfectly. Thanks! Hope that didn’t take up too much of your time.

    Comment by tpc — Sunday 20th February 2005 4:34 pm #

  19. Latexrender is installed and working fine, except my images get cut off. Is there a default setting for thumbnail or image size? When I look at the image in the picture folder I can see the whole image, so it is rendered correctly just not displayed. Is there a formatting preference in WordPress?

    Comment by Eric Pingel — Tuesday 22nd February 2005 1:47 am #

  20. Have a look at Ozzin’s 2 posts at
    Is this what you see? If so, then the best bet is to upgrade Imagemagick but, failing that, using PNGs insteadof GIFs should solve the problem.

    Comment by Steve — Tuesday 22nd February 2005 12:47 pm #

  21. Hey, Steve, thanks for leaving this comments section open all this time! I just had my admin install latex and i’ve been trying to install your plugin. I think I followed your instructions pretty carefully, but I’m getting the following errors:

    Warning: copy(44d7a6a2b923b8e0dc922bcbc88e73be.gif): failed to open stream: No such file or directory in /var/www/felipe/latexrender/class.latexrender.php on line 271

    Warning: unlink(/var/www/felipe/latexrender/tmp/
    44d7a6a2b923b8e0dc922bcbc88e73be.aux): No such file or directory in /var/www/felipe/latexrender/class.latexrender.php on line 289

    Warning: unlink(/var/www/felipe/latexrender/tmp/
    44d7a6a2b923b8e0dc922bcbc88e73be.dvi): No such file or directory in /var/www/felipe/latexrender/class.latexrender.php on line 291

    Warning: unlink(/var/www/felipe/latexrender/tmp/ No such file or directory in /var/www/felipe/latexrender/class.latexrender.php on line 292

    Warning: unlink(/var/www/felipe/latexrender/tmp/
    44d7a6a2b923b8e0dc922bcbc88e73be.gif): No such file or directory in /var/www/felipe/latexrender/class.latexrender.php on line 293

    I chmoded those directories 777 and all, I don’t know what’s up. Help.

    Comment by Felipe — Monday 28th February 2005 8:18 am #

  22. Warning: unlink(/var/www/felipe/latexrender/tmp/
    44d7a6a2b923b8e0dc922bcbc88e73be.aux): No such file or directory

    makes it look like LaTeX isn’t working properly. Comment out the 6 unlink lines in class.latexrender.php with // and try again. If you get a .log file then that is produced by LaTeX and reading it should tell you what’s gone wrong. If you don’t get this file than are you absolutely sure that you have the correct path for latex in class.latexrender.php?

    Ask your admin if, after installing latex, they had run texhash. This command makes a database of the paths of the various files latex needs. If admin hadn’t done this (or even if they have), get them to run this command (takes a few seconds to work) then try again.

    Comment by Steve — Monday 28th February 2005 1:36 pm #

  23. I commented those lines out and here’s what I get now:
    Warning: copy(7733d0c525808c6a7537e2a948b24e1c.gif): failed to open stream: No such file or directory in /var/www/felipe/latexrender/class.latexrender.php on line 271

    I also asked my admin about texhash, and he said he doesn’t know what that is… so no, he didn’t run it. What is it, does it come standard with a Apache/2.0.52 (Debian GNU/Linux) PHP/4.3.10-2 mod_ssl/2.0.52 OpenSSL/0.9.7e mod_perl/1.999.20 Perl/v5.8.4 server, and if not, where do we get it to install it?

    Comment by Felipe — Monday 28th February 2005 6:50 pm #

  24. You are not getting the other warnings because you are not trying to delete (=unlink) non-existent files. Did you look in the .log file? Was it there?

    admin not running texhash is good news because it is probably the cause of your problem. It’s the vital bit of the installation that is often forgotten :)

    Texhash should come with the installation as it is an integral part of LaTeX and would have been installed with it. Just go into root and run texhash and that’s it!

    For info:
    teTeX’s (a popular latex distro) documentation says (files used by LaTeX are kept in a /texmf folder):
    texmf trees can get very large and to speed up searching in such a tree, a file name database is used. A file name database exists in the root of each texmf tree and has the name ls-R. It should list each file in the texmf tree. The command texhash can be used to build an up-to-date file name database for each texmf tree. It should be used after files have been added to a texmf tree

    Comment by Steve — Monday 28th February 2005 7:16 pm #

  25. I did not see a .log file in /latexrender, is that where it would be? I’ll let him know about this.

    Comment by Felipe — Monday 28th February 2005 7:29 pm #

  26. I just ran texhash in command line off of the root, said it was successful, but I still get this error (haven’t un-commented the unlink lines):

    Warning: copy(a5cd8170a93c043028013608d6cabc11.gif): failed to open stream: No such file or directory in /var/www/felipe/latexrender/class.latexrender.php on line 271

    [Unparseable or potentially dangerous latex formula. Error 6 ]

    Comment by Felipe — Monday 28th February 2005 7:32 pm #

  27. The log file would be in the latexrender/tmp folder. Normally unlink deletes it once it has been used, which is why I said comment it out and see if it’s there.

    Comment by Steve — Monday 28th February 2005 7:33 pm #

  28. Aha! Latex is working now :) Have you now got .tex .log .aux .dvi and .ps files but no .gif file? If so, has ImageMagick been installed? Would you like to continue this conversation via email?

    Comment by Steve — Monday 28th February 2005 7:37 pm #

  29. Dear Steve i have problem doing it as well… could u send the e-mail to me?

    Comment by sampan — Thursday 24th March 2005 4:13 pm #

  30. Wonderful plugin – I almost got everything working straight off. My only problem is that the pictures rendered by the scripts end up .. fuzzy, kind of like this one – rendered on my installation; whereas if I do the exact same command sequence by hand – issuing each command to the shell of the same box, I get sharp and good pictures. Any ideas whatsoever on how to deal with this?

    Comment by Mikael Johansson — Friday 6th May 2005 8:18 am #

  31. I’m a bit puzzled by this as it looks fine to me in both IE & Firefox,as does the image in your blog, which makes me wonder if you have solved the problem.

    If not, have you tried using gifs to see if that works? How about downloading a manual and automatic version of an image into an image editor and comparing the difference between the two? Or even just compare the hex bytes between them as they should be identical.

    Comment by Steve — Friday 6th May 2005 2:02 pm #

  32. Hi, great work!

    There’s one problem. If I want, for example write the first derivative of a function f, everybody usually writes: f'(x), that’s just like it works in usual tex, but it doesn’t in the latexrender-plugin. Any ideas? In the output it displays some ascii-number.

    Comment by Sean — Monday 9th May 2005 2:52 am #

  33. A workaround is to use f^{\prime}(x). I find using ^{\prime} looks better anyway as the ‘ can sit too near the f

    Comment by Steve — Monday 9th May 2005 12:19 pm #

  34. Yeah thanks, I already saw that on your math-blog :-) Thanks anyway!

    Comment by Sean — Monday 9th May 2005 2:48 pm #

  35. LaTeX Testposting
    Für denn Fall, dass ich mal was Mathematisches poste, hab ich mal ein Plugin installiert. Scheint zu funktionieren.

    Comment by (christian.) — Saturday 14th May 2005 5:23 pm #

  36. Hey Steve thanks a million for this great work — FYI the download link at the end of your post seems to be broken: “download”

    Comment by Chris D'Amato — Thursday 19th May 2005 3:59 pm #

  37. Thanks for that! I’d missed the wp- part of the filename. Corrected now.

    Comment by Steve — Thursday 19th May 2005 6:37 pm #

  38. 1) the mimetex plugin is working fine.
    2) latexrender does not work. I get the following error message:

    No such file or directory in
    class.latexrender.php on line 293

    [Unparseable or potentially dangerous latex formula. Error 6 ]

    I found here
    the information that “the system will only work with recent versions of ImageMagick
    (such as 6.1.2)”.

    It looks like my server is using an old vesion of ImageMagick:
    mg20163@server:~$ /usr/local/bin/convert
    Version: ImageMagick 6.0.6 09/01/04 Q16

    I assume that is the cause of the problem. +=

    Comment by MarcinGomulka — Friday 10th June 2005 8:35 am #

  39. “the system will only work with recent versions of ImageMagick(such as 6.1.2)” only applies to the enhancement to the image generation, not to the original latexrender.

    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?

    Comment by Steve — Friday 10th June 2005 8:40 am #

  40. I cannot get the plugin to work. I have downloaded the files, and I have put them in the directory ‘/var/www/html/blogname/latexrender’. In latexrender-plugin.php, I have include_once(‘/var/www/html/blogname/latexrender/latex.php’); In latex.php, I have $latexrender_path = “/var/www/html/blogname/latexrender”; and $latexrender_path_http = “/var/www/html/blogname/latexrender”;

    I have to be doing something wrong, and I think it’s almost definitely in latex.php. Does any see immediately what’s going wrong? Thanks a bunch.

    Comment by jjk — Thursday 28th July 2005 7:45 am #

  41. The last path $latexrender_path_http = “/var/www/html/blogname/latexrender"; needs to be changed as it needs to be a URL rather than the path on your server. In fact it is a relative path and you can leave it as $latexrender_path_http = "/latexrender";
    If everything else was working correctly your browser should have shown a cross or whatever because it couldn’t find the image and changing the URL should make the image appear.

    Comment by Steve — Thursday 28th July 2005 10:26 am #

  42. It looks like my problem is a little more involved than I may have first reported. When I activate the plugin, and then I click on ‘Manage’ on the top of the administration page, none of my posts are listed. When I click on ‘Dashboard’, none of the news is listed. When I deactivate the plugin, everything returns normally. When I activate the plugin and include the [tex] tags, the page will render up to the point of the opening [tex] tag and stop there.

    Comment by jjk — Thursday 28th July 2005 6:21 pm #

  43. That is very odd – not seen that before. Check first that it’s not the tex button that’s causing a problem. In latexrender-plugin.php delete everything after the lines
    Add a TeX button

    BUT make sure the last line
    is still there and that there’s nothing after it

    If you are still getting problems then again in latexrender-plugin.php comment out (using // at the beginning of the line) each of the following one at a time
    add_filter('the_content', 'addlatex');
    add_filter('the_excerpt', 'addlatex');

    Also you could see if there’s a conflict with another plugin by deactivating those.

    Let’s see the results of these tests before trying anything else.

    Comment by Steve — Thursday 28th July 2005 7:04 pm #

  44. Okay, I tried the first two suggestions, in order, and I still get the behavior where when the latexrender plugin is activated, and I click on ‘Manage’, I see the ‘Posts’, ‘Pages’, ‘Categories’, etc., and I see the ‘ID’ and ‘When’ of the most recent post, but nothing else appears.

    I have no other plugins activated. The only other plugins installed are ‘Hello Dolly’, ‘Markdown’, and ‘Textile 1’, but, like I said, none are activated.

    Comment by jjk — Thursday 28th July 2005 10:57 pm #

  45. And I just realized I did not mention that I am using WordPress version

    Comment by jjk — Thursday 28th July 2005 11:00 pm #

  46. I have just installed a brand new version of WordPress and LatexRender worked perfectly so it must be something else.
    Could you try the following:
    1. Re-download the LatexRender plugin and reinstall it in case one of the files has got corrupted
    If that doesn’t help
    2. Install a new copy of WordPress somewhere else and see if that works, again in case of a corrupted file. Fortunately, installation is very quick.
    If that doesn’t help then it could be a problem with the LaTeX installation on the server
    3. Go to and download LatexRender (or directly ). Inside you will find otherPHP/latexrender folder. Install the files in that folder somewhere on your system (altering the paths as necessary) and then see if example.php works correctly. This will test LatexRender without any possible interference from WordPress

    You may wish to email me the results (address in the readme.txt files) to see what we do next.

    Comment by Steve — Thursday 28th July 2005 11:52 pm #

  47. I could not find your email address in either ‘readme_plugin.txt’ or ‘readme_noplugin.txt’.

    With a fresh installation of WordPress and LatexRender, everything works fine. I have not copied over the theme I usually use yet, though, so maybe that’s causing some sort of problem.

    Now, when I put code into my post like ‘a+b=c’, I receive the following error:

    [Unparseable or potentially dangerous latex formula. Error 6 ]

    Do you know what this means?

    Comment by jjk — Friday 29th July 2005 6:35 am #

  48. The email address is in the readme.txt files in the other download I suggested. Glad to see things are starting to work.

    latex.php has details of the error which in this case is “Cannot copy image to pictures directory”. That could be because you’ve forgotten to chmod 777 /pictures or it could be because the gif hasn’t been created yet. To find out have a look at the instructions in Path Problems in Linux to see what files are being created.

    Comment by Steve — Friday 29th July 2005 9:57 am #

  49. The six ‘unlink’ lines in class.latexrender.php were uncommented by default, and both ‘/var/www/html/blogname/latexrender/tmp’ and ‘/var/www/html/blogname/latexrender/pictures’ where ‘chmod 777’. In latex.php, I now have

    $latexrender_path = “/var/www/html/tgrounds/latexrender”;
    $latexrender_path_http = “/tgrounds/latexrender”;

    I understand the last variable is supposed to be a relative path, and the ‘DocumentRoot’ for my httpd server is set to ‘/var/www/html’ in the ‘httpd.conf’ file. Are those settings correct?

    Comment by jjk — Friday 29th July 2005 6:48 pm #

  50. 1. You were supposed to add // in order to comment out the lines so that the files in /tmp are not deleted by unlink and look like the ones in Path Problems in Linux. Then we can look at which files have been created and if they are correct.

    2. If you are getting Error code 6 then LaTeX is running correctly so $latexrender_path = “/var/www/html/tgrounds/latexrender"; would be correct.
    The relative path in $latexrender_path_http = “/tgrounds/latexrender"; is the (relative) URL for the gif which hasn’t been created yet, but should be correct

    3. Earlier today I emailed the hotmail address you enter when you make a post which will give you my email address assuming that your address is live.

    Comment by Steve — Friday 29th July 2005 8:11 pm #

  51. I managed to fix my instalation.

    The directory where ‘gs’ is, needs to be in the $PATH for convert to work correctly.

    I have wordpress installed on an university server and they
    put ghostscript in an unusual directory.

    The following workaround adds the additional directory into the PATH variable:

    // class.latexrender.php

    // begin of workaround
    // extending the PATH environmental variable
    $oldpath = getenv(“PATH”);
    $where_gs_is = “/usr/sfw/bin”;
    if ($oldpath) { $where_gs_is .= “:$oldpath”;}
    // end of workaround

    // imagemagick convert ps to image and trim picture
    $command = $this->_convert_path.” -density “.$this->_formula_density.
    ” -trim -transparent “#FFFFFF” “.$this->_tmp_filename.”.ps “.
    $status_code = exec($command);

    Comment by MarcinGomulka — Sunday 31st July 2005 12:20 pm #

  52. Great! I’m glad it now works.
    I have taken the liberty of copying your workaround into the discussion of this issue at Path Problems in Linux for the benefit of anyone else who may have the same problem.

    Comment by Steve — Sunday 31st July 2005 12:33 pm #

  53. Heh, I immediately noticed it over there… :)

    Comment by MarcinGomulka — Sunday 31st July 2005 12:46 pm #

  54. I am getting an error 5 when I use commands like $a_i^\dagger$. I guess this is because it is rendering pictures which are too large. Any idea what might cause this?

    Comment by Dave Bacon — Thursday 15th September 2005 11:19 am #

  55. You shouldn’t be using $ which is causing the problem. Use a_i^\dagger. Note that it is \dagger not \dagger

    Comment by Steve — Thursday 22nd September 2005 5:46 pm #

  56. I am trying to get latexrender installed. I don’t get any error messages but I just get my LaTeX text returned. I have proper .gifs appearing in my pictures folder and I think I have my relative paths right. Any other things to report/check. Thanks in advance.

    Comment by Morgan Hough — Sunday 16th October 2005 5:39 pm #

  57. I have emailed you directly, basically to check the path in the variable $latexrender_path_http in latex.php

    Comment by Steve — Sunday 16th October 2005 6:10 pm #

  58. Hey, I am getting a similar problem as the one above but I don’t have any text that’s inside [tex] tags and my $latexrender_path_http looks correct to me.

    Comment by Kyle — Monday 24th October 2005 4:15 pm #

  59. I have had a look at your page. The gif is there though it’s not what you expect.
    Just above sqrt there’s a line which is the gif and you see it directly at

    Thus the path is correct but generating the picture is not.
    In class.latexrender.php comment out the 6 unlink lines at the end with // then generate a different formula. You should find 6 files in /tmp with extensions of tex, log, aux, dvi, ps, gif
    Have a look at each of these and find where the conversion is failing to see what to do next.

    Comment by Steve — Monday 24th October 2005 4:26 pm #

  60. Morgan Hough’s problem (16 October above) was solved by setting $latexrender_path_http to the absolute value of the path

    Comment by Steve — Monday 24th October 2005 4:30 pm #

  61. Writing the tex tags with breaks don’t work. I.e.,


    will result that the break tags are included in the latex_formula variable (for example) in class.latexrender.php and rendered as < br/>. Making
    $latex_formula = str_replace(“
    “, “”, $latex_formula) in function wrap_formula (for example) solves this problem. I don’t want to write html-tags in tex so this works for me.


    Comment by Anders Ericsson — Friday 4th November 2005 10:15 am #

  62. Ok. Now the first argument in str_replace didn’t show because I am stupid. Here it is

    $latex_formula = str_replace("
    ", “", $latex_formula)

    Comment by Anders Ericsson — Friday 4th November 2005 10:19 am #

  63. Aargh, anyway. You get the point. The first argument should hold all the < and > and ‘br’ and ‘/’ stuff.

    Comment by Anders Ericsson — Friday 4th November 2005 10:24 am #

  64. Aaaaaaargh, anyway. You get the point. The first argument should hold all the ‘< ' and '>‘ and ‘br’ and ‘/’ stuff. Sorry for the spamming Steve. 😛

    Comment by Anders Ericsson — Friday 4th November 2005 10:25 am #

  65. Yes that will get rid of unwanted breaks. You’ll find a series of these commented out in latex.php suggested for htmlArea (a WYSISWYG editor) which can be adapted for this and other uses.

    I agree WordPress makes it hard to show the code. You have to use & lt ; and & gt ;(without the spaces)
    $latex_formula = str_replace("<br />", “", $latex_formula)

    Comment by Steve — Friday 4th November 2005 10:57 am #

  66. Hi Steve,
    great plugin ! I’m having a strange bug with my installation.  and work fine, and images get stored and rendered. However, if I have a series of latex commands in a post, more often than not the image for the first one gets replicated for the latter latex images ! I have had bizarre examples where when I insert a single character in the second tex formula it renders fine, but if I remove the character it instead displays the image for the first tex formula.

    this behaviour is difficult to reproduce: sometimes deleting the post and starting again helps ! sometimes not. have you ever seen anything like this ?

    Comment by Suresh — Friday 9th December 2005 1:08 am #

  67. That is strange. Each image has a unique 32-character name to avoid this happening. When it happens again could you have a look at the source code to see what filenames are being used for the image? Could you also check if all the correct images are being stored – maybe they are being generated but the wrong code is being used somehow?

    Comment by Steve — Friday 9th December 2005 10:19 am #

  68. Hi Steve, me again. The error has reappeared, and here is some information.

    I tried creating a test post with the content

    This is a test a =  b and another one c = d

    I then published, and although the two tex instances are associated with distinct image files:


    they both contain the same image !! (a = b)

    I then inserted a space between the  and the c in &#8216;[tex]c=d’. This generated the same image file for the first one, but a new image file for the second, and now it worked fine.

    So it’s the images themselves that are not being generated correctly.

    Comment by Suresh — Monday 9th January 2006 9:42 pm #

  69. When you generated b71bb3f69b20a95df0ac54b8ada0079b.gif did you type exactly a = b with one space before and one after the equals sign? If so, it should generate e62d239822831122dd571c0d362408f7.gif so something else is interfereing. Do you have another plugin that changes the text somewhere? Do you get a=b in the popup when you hover over the image?

    Comment by Steve — Monday 9th January 2006 9:55 pm #

  70. I corrected the extra space in my a = b, and got the hash that you indicated. The popup on the second gif is also correct, as is the HTML source. However, the image is still wrong (the second image is a = b instead of c = d). I then added a space between [tex] and c, and suddenly it worked.

    Comment by Suresh — Monday 9th January 2006 10:05 pm #

  71. […] display equations, I recently installed LaTeX into WordPress by using a Latexrender plugin and it works great!  I am going to really try it out by blogging about a relatively easy way to […]

    Pingback by Online Cortex » Double-Angle Formulas — Tuesday 20th March 2007 5:06 am #

  72. […] It’s nice. Thank you for LatexRender, LatexRender plugin for WordPress and LatexRender Installation Script. I plan to write the installation process in the future. […]

    Pingback by Test LaTeX on WordPress « Computing Freak — Tuesday 20th March 2007 12:06 pm #

  73. […] LaTeX als Plugin […]

    Pingback by MathGraph und LaTeX für Wordpress — Friday 20th April 2007 12:30 pm #

  74. I’m still getting the same symbols even after I’ve added/removed all the spaces between  and . I’m on DreamHost, my /tmp contains lots of files, both /tmp and /pictures are 777, I’m lost and crying. On the mouse over to \frac{3}{5}+\frac{1}{6} I get \frac{-13}{36}, but still see the contents of \frac{3}{5}+\frac{1}{6}.

    Comment by Billy — Monday 23rd April 2007 2:59 am #

  75. You may disregard my previous note since I’ve switched to Forkosh’s site: if you take a look at the site’s MA1 post and compare it to the MA2 post, you’ll see the difference and understand why I’ve switched. Thanks anyway.

    Comment by Billy — Monday 23rd April 2007 4:08 am #

  76. The problem is that the tmp files aren’t being deleted. Have the unlink lines at the end of class.latexrender.php been commented out?
    Also in class.latexrender.php change the a+ to w+ in the line
    // create temporary latex file
    $fp = fopen($this->_tmp_dir."/".$this->_tmp_filename.".tex","a+");

    which will stop this bug even if tmp files aren’t deleted.

    Comment by Steve — Monday 23rd April 2007 9:33 am #

  77. I will definitely check this one out: the Forkosh’s site is great, but it’s his bandwidth after all. And when I’m able to use my own bandwidth, but don’t know how to, it really isn’t his problem, but mine; therefore, I shouldn’t be using his bandwidth. So, yes, implementing LatexRender will be a great experience in my computer life. One more thing [off the topic]: that isn’t my official website, Student Block is. Ironically, I’m using Drupal on that site, not WP, and the Latex is working perfectly. However, I’m still deciding whether to switch to WP or not. Although, on one side Drupal is one of the [if not the] best CMS available, on the other hand, do I really need a full-featured CMS for what I do: help students with the subjects, teach them how to find solutions to common problems and so on. I may implement a classifieds section [available for WP as well] to help them trade the books and stuff like that. Do you think I’d need a full CMS for that?

    Comment by Billy — Monday 23rd April 2007 5:17 pm #

  78. I haven’t checked, but I expect that there’s a WordPress plugin that will do what you want.

    Comment by Steve — Monday 23rd April 2007 6:26 pm #

  79. I’ve changed the a+ to w+, but it’s still there, showing identical symbols fractions over and over again. The 6 unlink lines at the end of class.latexrender.php have been commented out. /tmp contains 166 files with 612028 bytes combined. Just take a single look at MA1 post.

    Comment by Billy — Monday 23rd April 2007 10:58 pm #

  80. Please remove the commenting out from the unlink lines so they work. Then delete all the non-index files from both /tmp and /pictures. Now when you view the blog the images should be fine.

    Comment by Steve — Tuesday 24th April 2007 9:53 am #

  81. Non-index?

    Comment by Billy — Tuesday 24th April 2007 11:54 am #

  82. Just keep index.php which keeps the directories private. Try going to http://whatever_your_path_is/pictures in a browser to see what I mean.

    Comment by Steve — Tuesday 24th April 2007 12:03 pm #

  83. Yeah, it says “You are not supposed to access this directory.”

    Comment by Billy — Tuesday 24th April 2007 2:30 pm #

  84. […] Installerade idag (tack till LaTeXRender […]

    Pingback by LaTeX at Nikodemus blogg — Tuesday 24th April 2007 7:55 pm #

  85. Ok, here’s what I have now: /**
    * Cleans the temporary directory
    function cleanTemporaryDirectory() {
    $current_dir = getcwd();



    Also I’ve removed all files in the /tmp except for index.php.

    Comment by Billy — Tuesday 24th April 2007 10:12 pm #

  86. OK. Now don’t forget to do the same for /pictures – delete all files except for index.php

    Comment by Steve — Tuesday 24th April 2007 10:21 pm #

  87. Ok, done. Works out now. Thanks a million!

    Comment by Billy — Tuesday 24th April 2007 10:33 pm #

  88. […] upgraded my blog to WordPress 2.1.3 and installed the LatexRender plugin. Now I can use pretty symbols for math posts. All the cool math bloggers are doing it. Like […]

    Pingback by Rotten Cotton » Blog Archive » Latex — Wednesday 25th April 2007 4:20 am #

  89. 用mimetex for wordpress插件在blog上写数学公式


    Trackback by 阅微堂 — Tuesday 1st May 2007 5:22 pm #

  90. […] adopted. Also I have added the widgets plug in although I have not add anything yet and the LatexRender  which is an old friend from implementing it in a phpbb physics forum I used to administrate (A […]

    Pingback by Qubit Fractions » Hello world! — Saturday 5th May 2007 5:50 pm #

  91. […] LaTeX 編譯器以及 ImageMagic 的話,可以考慮 latexrender 這個外掛。萬一伺服器沒有安裝 LaTeX […]

    Pingback by Walking in the woods » LaTeX 與 Wordpress — Wednesday 30th May 2007 2:29 am #

  92. […] LaTeX als Plugin […]

    Pingback by MathGraph und LaTeX für Wordpress » Leertaste — Friday 1st June 2007 7:47 pm #

  93. […] in the root of your webpage. All the installation directions are located here. There is also a wordpress plugin, which is really cool. You can find the user’s manual […]

    Pingback by Blog » Blog Archive » Math Function - MediaWiki - Wiki Tutorial — Friday 8th June 2007 1:43 pm #

  94. […] o funcionamento de scripts como o mimetex (foi através dele que produzi esta expressão) ou de mecanismos que necessitem do próprio Latex nos servidores, normalmente, não se conseguem pôr a funcionar num servidor “standard”. É sempre […]

    Pingback by Mais que multilingual, um artigo universal at diário de bordo — Thursday 28th June 2007 2:57 pm #

  95. Hi, this looks like a great plugin, but it’s not working for me, because the ImageMagick convert process fails… Do you have any idea why this could be? If I extract the $command line that’s run in the // imagemagick convert ps to image and trim picture bit (ie, by echoing it directly before the command is run) and then run it on the command line directly, it works… But it doesn’t work running in the script…
    I’m running Windows, btw.

    I also get sets of .aux, .dvi, .log, .ps, .tex files in my tmp, but no gif (except, as I said, if do it by hand). Is it probably just my ImageMagick that’s borked?

    Comment by Matt — Friday 29th June 2007 3:51 pm #

  96. I wonder if it’s a path problem. Perhaps ImageMagick can’t find Ghostscript for some reason. Try adding the path into class.latexrender.php as documented in MarcinGomulka — Sunday 31st July 2005’s comment above and see if that helps.

    Comment by Steve — Friday 29th June 2007 4:06 pm #

  97. That fixed it, thanks a lot :)

    Comment by Matt — Friday 29th June 2007 9:26 pm #

  98. […] is: LatexRender, the WordPress plugin used in this site is at: – […]

    Pingback by my upou days / LaTeX test — Tuesday 3rd July 2007 10:14 am #

  99. […] ma per chi ne avesse la necessità e non ha la possibilità di installare plugin per WordPress come LatexRender, che permette l’inserimento di espressioni matematiche nei post attraverso il sistema Latex, […]

    Pingback by Levysoft » Soluzione universale per rappresentare formule matematiche sul proprio sito — Monday 6th August 2007 8:05 am #

  100. I use your plugin, but changed the code in latexrender so that I the lateformular excepts everything valid in LaTeX:
    $string .= “”.$latex_formula.”\n”;

    However I experience that if I have linebreaks inside the wordpress editor, then these appear in $latex_formula also as code which makes the plugin more or less unusuable.

    Is there a possible workarround?


    Comment by Matthias Pospiech — Friday 17th August 2007 8:14 am #

  101. Yes, you can remove them in latex.php quite easily. After the lines
    // prevent WordPress changing & and ' to 038; and 8217;
    // add more such lines to avoid other odd effects
    $latex_formula = str_replace("&#038;","&",$latex_formula);
    $latex_formula = str_replace("&#8217;","'",$latex_formula);

    add either
    $latex_formula = str_replace("&#13;","",$latex_formula);
    $latex_formula = str_replace("&#10;","",$latex_formula);

    $latex_formula = str_replace("\r","",$latex_formula);
    $latex_formula = str_replace("\n","",$latex_formula);

    depending on how the linebreaks are translated by your system.

    Comment by Steve — Friday 17th August 2007 8:43 am #

  102. […] other component I used was which is nice because it allows me to use some markup language in wordpress instead of having to […]

    Pingback by Distant Traveler » Blog Archive » Finally - Latex for Wordpress that’s for Everyone… — Saturday 8th September 2007 3:08 pm #

  103. Steve,
    I’ve installed the plugin on a Windows XP machine, and am a little mystified as to why it’s not working. If I try to post anything (doesn’t have to include any LaTeX code), I get

    Warning: Cannot modify header information – headers already sent by (output started at C:\xampp\htdocs\wordpress\wp-content\plugins\latexrender-plugin.php:95) in C:\xampp\htdocs\wordpress\wp-includes\pluggable.php on line 341

    If I deactivate the plugin, this issue disappears. It does seem obvious that some of the path settings must be wrong, but I’ve gone through them a number of times, and — well, there must be something in your instructions that I still misunderstand.

    Here’s what I have:
    In latexrender-plugin.php
    $latexrender_path = “C:\xampp\htdocs\wordpress\latexrender”;
    $latexrender_path_http = “/latexrender”;

    In class.latexrender.php
    var $_latex_path = “C:/texmf/miktex/bin/latex”;
    var $_dvips_path = “C:/texmf/miktex/bin/dvips”;
    var $_convert_path = “C:/Program Files/ImageMagick-6.3.5-Q16/convert”;
    var $_identify_path=”C:/Program Files/ImageMagick-6.3.5-Q16/identify”;

    In latexrender.php
    $latexrender_path = “C:\xampp\htdocs\wordpress\latexrender”;
    $latexrender_path_http = “/latexrender”;

    There’s a folder called C:\xampp\htdocs\wordpress\latexrender containing subfolders tmp and pictures. Everyone has all privileges for these folders. And latexrender.php is in the folder C:\xampp\htdocs\wordpress\wp-content\plugins.

    If you have any suggestions, I’d really appreciate them!


    Comment by Gordon — Sunday 16th September 2007 11:24 pm #

  104. Tow things to try
    1) make absolutely sure that there’s no space or new line after the final ?> in files such as latex.php. That’s frequently the source of Warning: Cannot modify header information errors.
    2) Being Windows you either have to reverse the slash or double it, so in latex.php try changing
    $latexrender_path = “C:\xampp\htdocs\wordpress\latexrender”;
    $latexrender_path = “C:/xampp/htdocs/wordpress/latexrender”;
    $latexrender_path = “C:\xampp\htdocs\wordpress\latexrender”;
    and similarly for the path in latexrender-plugin.php

    Comment by Steve — Monday 17th September 2007 11:37 am #

  105. Thanks. Those error messages are now gone. But now I have new ones: when I go to view a post that I saved, I now get:

    Warning: include_once(C:/xampp/htdocs/wordpress/latexrender) [function.include-once]: failed to open stream: Permission denied in C:\xampp\htdocs\wordpress\wp-content\plugins\latexrender-plugin.php on line 12

    Warning: include_once() [function.include]: Failed opening ‘C:/xampp/htdocs/wordpress/latexrender’ for inclusion (include_path=’.;C:\xampp\php\pear’) in C:\xampp\htdocs\wordpress\wp-content\plugins\latexrender-plugin.php on line 12

    Fatal error: Call to undefined function latex_content() in C:\xampp\htdocs\wordpress\wp-content\plugins\latexrender-plugin.php on line 13

    Any suggestions?


    Comment by Gordon — Monday 17th September 2007 12:56 pm #

  106. Warning: include_once() [function.include]: Failed opening ‘C:/xampp/htdocs/wordpress/latexrender’
    That’s because there is no such file. In latexrender-plugin.php line 12 you forgot to put /latex.php at the end so it reads something like

    Comment by Steve — Monday 17th September 2007 1:04 pm #

  107. More progress still!

    Now it posts pure text just fine, but objects to inclusion of tex.

    Posting the following: “One more test, with math. \int_{\alpha}^{\omega} \frac{1}{x} dx

    I get:

    Warning: copy(a267f936e54d7c10a2bb70dbe6ad7a89.gif) [function.copy]: failed to open stream: No such file or directory in C:\xampp\htdocs\wordpress\latexrender\class.latexrender.php on line 271

    Warning: unlink(C:/xampp/htdocs/wordpress/latexrender/tmp/a267f936e54d7c10a2bb70dbe6ad7a89.gif) [function.unlink]: No such file or directory in C:\xampp\htdocs\wordpress\latexrender\class.latexrender.php on line 293

    One more test, with math. [Unparseable or potentially dangerous latex formula. Error 6 ]

    Indeed these gif files aren’t in those directories — I assume they were specified incorrectly. Since even posting \alpha gets the same message about unparseable or potentially dangerous about the LaTeX.



    Comment by Gordon — Monday 17th September 2007 2:04 pm #

  108. If that’s the only error messages you get (so there’s none about unlinking other files) then it’s only a problem with the last part of the image creation. It could be that ImageMagick isn’t finding Ghostscript, which does sometimes happen.

    Can you confirm that you have Ghostscript installed? If so, then try the workaround posted by MarcinGomulka in the first comment at Do be sure that you replace the line
    $where_gs_is = “/usr/sfw/bin”;
    by the directory containing gswin3c.exe so it may look something like
    $where_gs_is = “C:/gs/gs8.54/bin”;
    depending on your server.

    Comment by Steve — Monday 17th September 2007 2:34 pm #

  109. Thanks for the suggestions . . . but still no joy here. I’ve made the change you suggested as well as the workaround you pointed to, and I’m getting the same messages.


    Comment by Gordon — Monday 17th September 2007 9:34 pm #

  110. In the same post Matthew Leingang said that:
    I was getting the same symptoms and I discovered it was because my convert doesn’t support the -trim option. I was able to get it to work by replacing “-trim” with “-crop 0×0″ in the line defining $command.
    which is worth trying. You could also try removing -transparent “#FFFFFF” from the same line and see what happens.

    If that doesn’t work, temporarily comment out the 6 unlink lines at the end of class.latexrender.php using // and try again. You should end up with 6 files with long names in /tmp directory. Check that the tex, dvi, ps files are correct and that the latter 2 do really show the correct image.

    Comment by Steve — Monday 17th September 2007 10:03 pm #

  111. This is getting strange . . . still the same error messages and nothing in the tmp directory. I’m guessing that the tmp directory isn’t specified properly?


    Comment by Gordon — Tuesday 18th September 2007 2:24 am #

  112. That’s very strange as you should have got error messages where it couldn’t unlink any of the 6 files (before you commented them out that is).

    Please could you email me (address is in readme_plugin.txt) your customised class.latexrender.php, latex.php and latexrender-plugin.php files in case there’s a path problem we have missed.

    Comment by Steve — Tuesday 18th September 2007 9:48 am #

  113. […] es todo. Si se quiere expandir aún más la usabilidad de esta herramienta, se puede instalar un plugin que permite insertar las imágenes renderizadas sin tener que escribir las etiquetas HTML […]

    Pingback by Blogaritmo natural » Cómo mostrar LaTeX en WordPress — Thursday 20th September 2007 7:33 pm #

  114. […] Steve 就搞出了LaTeXrender, 用来在Blog里内嵌入数学公式. 基本上这个插件要求有自己的服务器, […]

    Pingback by » Blog Archive » LaTeX on Blog — Monday 8th October 2007 12:17 pm #

  115. […] 今天成功为 Open Attitude 安装了 LatexRender 插件,现在可以在 WordPress 里正常使用 LaTeX 了。这里就把安装过程简单的叙述一下。 For English refer here. […]

    Pingback by Open Attitude | 萬物並做 » » 安装 LatexRender 插件,在 Wordpress 中使用 LaTeX — Friday 16th November 2007 6:15 am #

  116. […] did not have the native handling of LaTeX that did, so I had to find a plugin to handle it […]

    Pingback by LaTeX LimeriX | — Thursday 31st January 2008 4:16 pm #

  117. […] a fresh install. I think I chose “the hard way” so I wouldn’t have to re-install latexrender, but it seems I may have to do that anyways.. but more on that […]

    Pingback by Setting up to expand my blog empire… | — Tuesday 5th February 2008 2:10 pm #

  118. […] used Gunnlaugur Þór Briem’s bash script (here: ) to install Steve Mayer’s LatexRender plugin and can testify that it works, but am not sure how much practical it would be to use this blog as a […]

    Pingback by What the rain knows » Blog Archive » Marble composition notebook time again it seems — Saturday 9th February 2008 7:17 pm #

  119. […] […]

    Pingback by Optimal Design of Experiments » Blog Archive » Wordpress Latex Support — Monday 3rd March 2008 9:54 am #

  120. […] Using LaTeX in WordPress » LatexRender as a plugin Uncategorized […]

    Pingback by Using LaTeX in WordPress — Thursday 20th March 2008 11:44 pm #

  121. […] looked into this WordPress plugin, but it requires LaTeX on your server, and tech support at my ISP were less than interested in […]

    Pingback by jsMath in Wordpress blogs - squareCircleZ — Sunday 23rd March 2008 6:55 am #

  122. […] latex. But no such default functionality for self hosted wordpress blogs. But there are plugins (latexrender, wp-latex) which can facilitate similar things. But for these to work you will need to install […]

    Pingback by Latex on wordpress blog : Burad’s Blog — Sunday 25th May 2008 10:15 am #

  123. Hello Steve,
    First of all, congratulations, This program is the best of latex code makers! (sorry my bad english)

    Well, I read all content of this help and I cannot configure the latexrender very well and I receive some errors.
    I configure the files on latex.php and class.latexrender.php and the paths looks correct for me.
    The paths I put are:
    $latexrender_path = “/home/nerckie1/public_html/latexrender/”;
    $latexrender_path_http = “/latexrender”;

    All folders (pictures and tmp)are CHMOD 777.

    The server owner says that the all default paths of class.latexrender.php are correct and no changes are needed.

    So, I get some errors at this page:

    The errors I get, are:

    Warning: copy(e606120e20516e531aaeffad920c763c.gif) [function.copy]: failed to open stream: No such file or directory in /home/nerckie1/public_html/latexrender/class.latexrender.php on line 271

    Warning: unlink(/home/nerckie1/public_html/latexrender/tmp/e606120e20516e531aaeffad920c763c.gif) [function.unlink]: No such file or directory in /home/nerckie1/public_html/latexrender/class.latexrender.php on line 293

    Warning: copy(e606120e20516e531aaeffad920c763c.gif) [function.copy]: failed to open stream: No such file or directory in /home/nerckie1/public_html/latexrender/class.latexrender.php on line 271

    Warning: unlink(/home/nerckie1/public_html/latexrender/tmp/e606120e20516e531aaeffad920c763c.gif) [function.unlink]: No such file or directory in /home/nerckie1/public_html/latexrender/class.latexrender.php on line 293

    Warning: copy(e606120e20516e531aaeffad920c763c.gif) [function.copy]: failed to open stream: No such file or directory in /home/nerckie1/public_html/latexrender/class.latexrender.php on line 271

    Warning: unlink(/home/nerckie1/public_html/latexrender/tmp/e606120e20516e531aaeffad920c763c.gif) [function.unlink]: No such file or directory in /home/nerckie1/public_html/latexrender/class.latexrender.php on line 293
    Example Text:
    This is just text but [Unparseable or potentially dangerous latex formula. Error 6 ] should be shown as an image and so should [Unparseable or potentially dangerous latex formula. Error 6 ].

    Another formula is [Unparseable or potentially dangerous latex formula. Error 6 ]

    I´m going crazy… (LOL) Thanks for any help!

    PS: The server is the A2 Hosting

    Comment by nerckie — Tuesday 8th July 2008 9:22 pm #

  124. The gif is not being created so causing the error. I think it is almost certainly the Ghostscript error where ImageMagick can’t find Ghostscript. Fortunately you should be able to cure this by using Marcin Gomulka’s workaround at

    By the way (this has nothing to do with the problem) you should remove the final slash from $latexrender_path = “/home/nerckie1/public_html/latexrender/”;

    Comment by Steve — Tuesday 8th July 2008 10:43 pm #

  125. Thanks a lot Steve!!! Now it works!!!

    I have one more question:

    If you type any equation, the result (gif format) is very thin (not “bold”, like your results)

    You can see the results at:

    How can I do the gif a little more sharp? There are a command to do this in some PHP, or something like this? Sorry about lots of questions.
    Thanks my friend!!!

    Comment by nerckie — Wednesday 9th July 2008 4:16 pm #

  126. It could be due to the latex fonts. Things to try:
    1. use png format. In class.latexrender.php change
    var $_image_format = "gif";
    var $_image_format = "png";
    2. Try increasing the formula density to 150 in
    var $_formula_density = 120;
    You must delete the images in /pictures first as otherwise it will show the older cached files.
    If that works you may need to decrease the font size
    3. In class.latexrender.php comment out the 6 unlink lines at the end with //. Then make some images and see whether the dvi and ps files have thin fonts. If so, it’s a problem with the LaTeX fonts not the rendering.

    Comment by Steve — Wednesday 9th July 2008 4:55 pm #

  127. Hello my dear friend!

    I follow the steps 1 and 2 and this works very well.
    Thanks a lot!

    (Now I have a new challenge: To configure PHPBB3 with latexrender)


    Comment by nerckie — Thursday 10th July 2008 1:10 pm #

  128. Instructions for phpBB3 are in the latest download of LatexRender and at instructions 4 to 8

    Comment by Steve — Thursday 10th July 2008 1:19 pm #

  129. Howdy there,
    I just upgraded my DreamHost account to PHP5 and ran into a problem with using the wp-latexrender plugin.

    The diagnosis of the problem and a solution can be found on my blog:

    Comment by baxissimo — Friday 1st August 2008 2:44 am #

  130. Thanks for letting us know about that.

    Comment by Steve — Friday 1st August 2008 10:15 am #

  131. […] mathematical notation you see on this site is generated by a WordPress plugin called LatexRender, which uh, renders LaTeX […]

    Pingback by About the Math Notation - Exploring Binary — Wednesday 19th November 2008 2:59 am #

  132. […] an installation), enabling server side conversion of latex symbols to images is done through the LaTeXRender wordpress plugin. Other ways exist, when server side install of latex is not possible – see for […]

    Pingback by Notes on using LaTeX for Blogging | Nonoscience — Monday 9th February 2009 8:45 am #

  133. Regarding the upgrade from PHP 4 to PHP 5, I’ve been having the same problem as mentioned above by Bill Baxter. I have not yet been able to get Bill Baxter’s solution to work. It’s possible I’m doing something wrong, but I thought this was worth mentioning. More here:

    Comment by Michael Nielsen — Wednesday 11th March 2009 2:52 pm #

  134. Problem solved – I uninstalled my old version of LatexRender, and installed the latest version. Feel free to delete the comment above (and this one). Thankyou for making such a great plugin!

    Comment by Michael Nielsen — Wednesday 11th March 2009 5:32 pm #

  135. I think I’ll leave the comments here, if you don’t mind, as your solution may well be of help to others.

    Comment by Steve — Wednesday 11th March 2009 5:47 pm #

  136. […] an installation), enabling server side conversion of latex symbols to images is done through the LaTeXRender wordpress plugin. Other ways exist, when server side install of latex is not possible – see for […]

    Pingback by Notes on using LaTeX for Blogging « Unruled Notebook — Wednesday 18th March 2009 6:13 pm #

  137. I’ve been using LatexRender for several years, and it’s been working great (thanks!). However, very recently the math fonts have gone a little strange — see, e.g., paragraph 4 and 5 of . They’re not unreadable, but have more or less “faded”. I’ve spent quite some time trying to figure out what the problem might be, to no avail. Do you have any ideas what might cause this kind of problem?

    Comment by Michael Nielsen — Friday 5th June 2009 11:55 am #

  138. […] use the excellent LatexRender WordPress plugin to generate mathematics on this blog. Generally it works very well, but for the […]

    Pingback by Michael Nielsen » LaTeX font help — Friday 5th June 2009 11:58 am #

  139. Two things to try:
    1. Generate png instead of gif. Do this by changing “gif” to “png” in the line in class.latexrender.php
    var $_image_format = "gif"; //change to png if you prefer

    2. Comment out the 6 lines at the end of class.latexrender.php which start with unlink and make a new post. Have a look at the various files generated in /tmp. Do the dvi, ps and gif/png files show faded images? If the problem is only with gif/png then experimenting with the formula density might help
    var $_formula_density = 120;

    Comment by Steve — Friday 5th June 2009 12:23 pm #

  140. Thankyou, Steve, that solved the problem – seems to have been the gifs, for reasons I don’t understand, as I haven’t had problems before.

    Comment by Michael Nielsen — Friday 5th June 2009 12:38 pm #

  141. I installed the latest version of latexrender in WordPress 2.8.1. I can render things like 1+\sum_x{x+1} but for some reason I can’t render \abs{x}. It just produces x.

    Any ideas?

    Comment by Carlo — Friday 17th July 2009 1:07 pm #

  142. Sorry, in my previous comment I wrote [tex ] \abs{x} [/tex ] and it also appeared as x, so it’s not a problem with my installation. What’s going on with the abs command?

    Thanks again.

    Comment by Carlo — Friday 17th July 2009 1:08 pm #

  143. That’s because there is no such command as \abs in LaTeX (see The Comprehensive LaTeX Symbol List), so there is nothing wrong with the installation. You could use |x| or \lvert x \rvert to make the || resize with the formula.
    If you need it often, then you can do what you would do in a document, and add to class.latexrender.php after
    $string .= "\begin{document}\n";
    the line
    $string .="\\newcommand{\abs}[1]{\lvert#1\rvert}\n"; then you can use \abs{x}.

    Comment by Steve — Friday 17th July 2009 1:47 pm #

  144. Thanks Steve, I’m not sure why I thought there would be an abs command given that I usually use \left| and \right| myself.

    Thanks for writing the plugin :)

    Comment by Carlo — Saturday 18th July 2009 7:51 am #

  145. Hello Steve.

    I hope I haven’t missed the boat on this one and if I am disturbing you in important work I excuse myself.

    I have been trying to install your latexrender plugin for wordpress. It seems to work well until the pictures are about to load on the webpage. All I get are broken images, as in the images files wouldn’t exist.

    Of course when I look in my /latexrender/pictures/ folder they are all there.

    Is this something you have encountered before?

    Thank you very much


    Comment by Karl — Wednesday 20th January 2010 11:55 pm #

  146. Almost certainly there is an error in the line in latex.php
    $latexrender_path_http = "/latexrender";
    You needed to change this to give the path of your pictures.
    If you look at the source of the page with broken images you will see what URL img src is using and hence what the error is.

    Comment by Steve — Thursday 21st January 2010 10:09 am #

  147. Of course! How stupid of me. Thank you very much! It works now.

    Comment by Karl — Thursday 21st January 2010 11:32 am #

  148. […] an installation), enabling server side conversion of latex symbols to images is done through the LaTeXRender wordpress plugin. Other ways exist, when server side install of latex is not possible – see […]

    Pingback by Notes on using LaTeX for Blogging « Unruled Notebook — Monday 15th February 2010 10:34 am #

  149. […] […]

    Pingback by Frustoooooness. / WP Latex Math plugin for Wordpress. — Wednesday 19th May 2010 8:30 pm #

  150. I followed the instructions step by step. In the tmp folder, if I comment out the unlinks, I only get a valid .tex file generated. If I manually invoke latex on it, it works as advertised. Any ideas? latex, and all the other executables are in /usr/bin as specified in the php file. I also set the latexrender paths as specified.

    What could be the issue?

    Comment by George — Sunday 11th July 2010 6:40 am #

  151. It looks as if PHP is not allowed to run LaTeX. You need to ensure that PHP is allowed to run the exec command.

    Comment by Steve — Sunday 11th July 2010 8:32 pm #

  152. Solved. I modified the plugin to output $status_code to a file and figured out that the actual error was: “I can’t find the format file `latex.fmt’!”. So a simple:

    $ texconfig init

    From the command line, fixed it. :)

    Comment by George — Sunday 11th July 2010 8:39 pm #

  153. Hello

    I also got same error with images ( gif or png ) in tmp : unlink warning cannot open …

    After commenting 6 lines with unlink, I get in error log
    that .aux file isn’t there ( in tmp dir, but I see it -it is there )

    No file e0be77095f01b0e9fe22c9bb002835c2.aux.
    \openout1 = `e0be77095f01b0e9fe22c9bb002835c2.aux’.

    ls e0be77095f01b0e9fe22c9bb002835c2* in tmp dir returns:

    e0be77095f01b0e9fe22c9bb002835c2.aux e0be77095f01b0e9fe22c9bb002835c2.log e0be77095f01b0e9fe22c9bb002835c2.tex

    Comment by anon — Wednesday 9th March 2011 4:17 pm #

  154. There is no gif/png created so try the method given in the first comment at Path Problems in Linux

    Comment by Steve — Wednesday 9th March 2011 6:39 pm #

  155. Hello Steve,

    Great thank you ! My problem is fixed now.

    I’m running FreeBSD box , so my gs path
    $where_gs_is = “/usr/local/bin”;

    Comment by anon — Thursday 10th March 2011 3:43 pm #

  156. Hello again,

    I installed chemfig and latex-tkiz and I’m trying to show chemical graphics thougth this plugin in wordpress.

    I follow example from here :

    From these examples I can successfully draw : Sketal diagrams and 3rd and 4th Rings, but I cannot draw 1st and 2nd Rings example and any from basic usage ( for example methane molecule or bonds ).

    In erros log again I have there is missing .aux file ( image is created, but it is how to tell “not full” – I see only some parts from example from methane molecule 1/2 letter and one “-“. 3rd and 4th rings are exactly drawn as in the examples.

    I believe this problem may not be related to the plugin and I have to ask in other list ?

    Comment by anon — Friday 11th March 2011 6:43 pm #

  157. Hello again, forgot to tell I wrote the article for mhchem package, but I couldn’t find in it how to use it for drawing chemical structural formulas for example like this one :

    Comment by anon — Friday 11th March 2011 6:46 pm #

  158. It’s best to test code on your local computer to see if it compiles properly. Also check the versions of the files on the server to see that they agree. The command \listfiles in the document will do this for you.

    Comment by Steve — Friday 11th March 2011 7:01 pm #

  159. Hello,

    Thank you for your recommendations Steve,

    I made a screenshot of what I mean “not full” letters :

    I tried to add tikz package in class.latexrender.php, but with wrong syntax ( typo error )
    instead of $string .= “\usepackage{tikz}\n”;
    I typed
    $string .= “usepackage{tikz}\n”;

    which reproduced formula on the screen with title “usepackagetikz” :

    If I type it correct behaviour is the same – some formulas are ok ( as rings ) , but this one with bonds are as in the pictire 1

    Comment by anon — Friday 11th March 2011 7:25 pm #

  160. Try using png instead of gif to see if it improves the output.

    Comment by Steve — Friday 11th March 2011 7:42 pm #

  161. Hello,

    I’m using png
    Here is compiled code and log with \listfiles :

    I believe the problem is No file 6bac4b27ba2ad8ff206bcbd1f0bc27c6.aux.
    \openout1 = `6bac4b27ba2ad8ff206bcbd1f0bc27c6.aux’.

    May be some part of package chemfig cannot see aux file which is created ( also image is created ) .

    There is one warning I see it also without \listfiles, but it seems not be a problem because some parts are shows as drawings, but other not.

    I added usepackage tikz in class.latexrender.php, also I made changes in font size ( 10 -> 11 px ) . I tried without loading tikz and using 10px font size as in the original class, but same error with no .aux file is returned.

    Comment by anon — Saturday 12th March 2011 12:53 am #

  162. The log tells you the problem:

    Package pgf Warning: Your graphic driver pgfsys-dvips.def does not support marking the current position. This warning is given only once on input line 11.

    The TGF manual pages 108-111 will tell you all about pgfsys-dvips.def. Also discussion at suggests you should try a more up-to-date version of TeX.
    Compare results with that on your home computer if that has a more recent version.

    Comment by Steve — Saturday 12th March 2011 10:25 am #

  163. Hello Steve, thank you
    This is only warning, so I believe it is not the problem, but I switched to Texlive 2010 .
    I have already read it this manual .

    There is no more such warning, but still exist error with no aux file and I found this is path variable in some part of tikz library regarding path to latex.
    The output picture is still the same “half letters”.


    No file 5412d9ee5997af5cd4b1323e1e157207.aux.
    \openout1 = `5412d9ee5997af5cd4b1323e1e157207.aux’.

    This is pdfTeX, Version 3.1415926-1.40.11 (TeX Live 2010) (format=latex 2011.3.12) 13 MAR 2011 17:43

    After I find where it is placed this path variable I will reply here if somebody else have the same problem .

    Thank you for all your help.

    Comment by anon — Sunday 13th March 2011 3:57 pm #

  164. Hello,

    Switched to Xymtex

    Comment by anon — Monday 14th March 2011 8:29 am #

  165. […] an installation), enabling server side conversion of latex symbols to images is done through theLaTeXRender wordpress plugin. Other ways exist, when server side install oflatex is not possible – see for […]

    Pingback by [RT]using latex for blogging | riding in tech world. — Sunday 25th December 2011 11:51 am #

  166. […] legal é que tem vários plugins. Estou para instalar o plugin do GeSHi e já instalei o plugin do LaTeX Render. Realmente recomendo… […]

    Pingback by Mudança de Servidor » Tiago Madeira — Monday 22nd October 2012 9:32 pm #

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


This site is a showcase for using LatexRender for mathematics in WordPress