Friday, March 12, 2010

Embeding LaTeX in Blogger

The goal is to include mathematical equations in blog posts. My plan was to create images from the output of MacTeX. Apart from being painfully slow to crop and upload with multiple distinct equations, the LaTeX source would not be contained in the post.

Embedding LaTeX in HTML led me to jsLaTeX. Option 4 from Solutions for JavaScript Hosting in Blogger solved the Blogger hosting issue. After some CSS shenanigans we have Bayes rule right here, right now.

\mathbb{P}(B_j|A) = \frac{\mathbb{P}(A|B_j)\mathbb{P}(B_j)}{\sum_{i=1}^n\mathbb{P}(A|B_i)\mathbb{P}(B_i)}

It is easier to write simple equations in the CodeCogs online equation editor first as Blogger preview doesn't seem to execute the JavaScript to render them.

Edit 23/03/2010: No longer using jsLaTeX, see Embedding LaTeX in Blogger take 2.

1 comment:

Brad Clow said...

The downside is that the LaTeX isn't rendered in RSS readers. All this could be avoided if Blogger had server-side LaTeX support.