## Friday, 16 April 2010

### LaTeX in Blogger / Blogspot

UPDATE, 2012-02-13: The approach described under is now outdated. I would recommend taking a look at other alternatives, for example MathJax.

I was wondering if it would be possible to display latex formulas in Blogger - and of course it is. :-) I found a post by Watchmath describing how this can be done by adding a HTML/Javascript Gadget (like the "Blog Archive" on the right) with a little piece of javascript code. If it works, the following code

X(k) = \sum\limits_{i=0}^{N-1}x(n)e^{-2\pi ik \frac{n}{N}}

should magically turn into a beautiful LaTeX equation:

$X(k) = \sum\limits_{i=0}^{N-1}x(n)e^{-2\pi ik \frac{n}{N}}$

Nice! What's actually happening here is that the LaTeX expression is sent to a server for compilation, and then returned as an image which is pasted into the blog post. If you want to do the same, get the code and instructions here.

Note: This option does not work with "Preview" while editing - the code is compiled when the post is published, not before.