September 8, 2007

Latex on wordpress

So, you are a geek. You want to write lot of technical things on your wordpress blog. And since you are a geek you want to write technical things in Latex. How do you do? One way is that you write latex code, make pdf, take screenshot, pick the desirable part, and use that image on blog. Ofcourse thats inconvenient and surely doesn’t go with your nerd personality. You want to write Latex code in your blog post. Here are 2 solutions. One is that you use wp-latex plugin. Using this plugin you will be able to write proper Latex code in your blog using <latex></latex> tags. But the problem is that this plugin uses Latex, which is not usually supported by web hosts, including Bluehost. And installing tetex locally is painful. So, here comes the second solution. Use mimetex. Checkout http://www.forkosh.dreamhost.com/mimetex.cgi?l_2 . Similarly you can get other latex output by replacing l_2. One guy used this property and made a plugin. Using this plugin you can use latex code, basically mimetex (which is a bit different from Latex) with <tex></tex> tags. I couldn’t get it working. Another guy changed this script and made it working with \[tex\]\[\/tex\] tags. It didn’t work as well. This new plugin downloads this image and stores in wp-content/cache folder. But it downloads this image every time someone opens the post. Of course it consumes lot of server and bandwidth. So, I made a small tweak in it. I replaced it’s 15 lines with 1 line. :) Basically, now instead of downloading the image, it puts src as http://www.forkosh.dreamhost.com/mimetex.cgi? blah blah. And see I am able to use latex code.

 f(x) = x^2 + l_2

Enjoy

Update : You can download the plugin (after my modification) from Plugin for using Latex

Update2 : The plugin is under GPL.

Update3 : So, the code I changed was suggested by Nitin Munjal. You can find him here

Filed under: Bluehost, Wordpress, latex — 11:55 am

14 Comments »

  1. Test :
    Lets see if it works with comments as well.
    f(x) = x^2 + l_3 :
    f(x) = x^2 + l_3

    Comment by rohitj — September 8, 2007 @ 12:02 pm

  2. e^i\$pi+1=0

    Comment by Naresh Venkateshappa — September 10, 2007 @ 2:28 pm

  3. e^i\pi + 1 = 0

    Comment by rohitj — September 10, 2007 @ 5:40 pm

  4. dude.. atleast(!!) acknowledge. where’s my name??

    Comment by Nitin Munjal — September 18, 2007 @ 3:57 am

  5. I apologize sir. See update 3. :) . Now I should get a good treat in CCC.

    Comment by rohitj — September 18, 2007 @ 5:25 am

  6. test
    $$ \frac{a}{b} = \omega $$

    Comment by Joe — October 24, 2007 @ 11:06 am

  7. it should be [tex\]\frac{a}{b}=\omega[/tex\]
    Note: there is no space in between. space is replaced by +

    \frac{a}{b}=\omega

    Comment by admin — October 24, 2007 @ 12:04 pm

  8. [tex\]\frac{a}{b}=\omega[/tex\]

    Comment by test — October 26, 2007 @ 2:52 pm

  9. write “[tex" without quotes, then write "]” without quotes. Then you write your latex code, without any spaces. Then write “[/tex" without quotes and then write "]” …. Note you should not put “\”before “]” or “[”.

    Comment by admin — October 27, 2007 @ 12:59 am

  10. [...] installed, but my host, Bluehost, does not. One solution seems to be to use mimetex, as explained here, here, and here. I will try to install it soon and tell you when it is [...]

    Pingback by think again! » Blog Archive » Math stuff in comments — December 10, 2007 @ 7:56 am

  11. Latex is a great plugin for maths blogs.

    Comment by estetik — January 2, 2008 @ 4:50 am

  12. [...] observation. This observation is important for 2 reasons at least : one that 65% students in IIT Khttp://rohitj.net/blog/?p=30WikiAnswers - What is the chief reason why students drop out of …School Subjects question: What is [...]

    Pingback by reasons students dropout — June 20, 2008 @ 2:13 am

    Using WordPress WordPress 4.01
  13. g this plugin you will be able to write proper Latex code in your blog using tags. But th

    Comment by arkadaş bul — October 18, 2008 @ 4:58 pm

    Using Mozilla Firefox Mozilla Firefox 3.0.3 on Windows Windows XP
  14. Cool! Peshi ischo

    Comment by Julia — November 5, 2008 @ 9:14 pm

    Using Netscape Navigator Netscape Navigator 3.0 on Windows Windows XP

RSS feed for comments on this post. TrackBack URL

Leave a comment

This work is copyrighted by Rohit Jain under CC-BY-SA license.
Valid XHTML 1.0 Transitional Valid CSS! Creative Commons License Blog Powered By wordpress Wiki Powered By dokuwiki