Tuesday, August 11, 2009

Using Latex on Blogspot

I have been looking for a way to incorporate Latex code on Blogspot to write math, and here is a great way of doing it.
It looks quite nice too, $\sum_{i=1}^n 2^i$

By default, the math, as a rendered image, is displayed within a border. The border can be easily removed by modifying the html content under layout -> edit html

.post img{
border:1px .......

Simply set the border attribute to 0px. I think this also means your uploaded images will no longer have a border, but you can probably give that up for the sake of Latex.

[Update on August 17, 2009] I don't like the size of the rendered image displaying the math, it creates white space between consecutive lines if the math is put in as inline, making a large blog entry with lots of inline math equations look ridiculous. Wordpress does a much better job in handling latex code. Blogspot should incorporate latex handling if it wants to be popular among bloggers who like to use math in their blogs.


  1. Hi, thank you for testing the script.
    In this script we use the display style by default. If you want to force it to use the text style add \textstyle command to your latex code.
    So writing ${\textstyle \sum_{i=1}^n x_i}$ gives you $\textstyle \sum_{i=1}^n x_i$. Is that what you want?

  2. That looks good, thanks. The script is great, but I still think blogspot should handle latex code.