Thursday, July 31, 2008

Howto write equations in latex in Blogs or websites

1. For websites it is a little bit non-trivial. Just write the equations in Mathematica and save as xml+MathML type. Now open that xml file in any text editor and copy paste the portion starting with in the corresponding HTML code. That's it.

2. For blogs it's much easier. Just write the equation in LaTeX and sandwitch it between

like this \frac{1}{\kappa} \int d^{N+1}x \sqrt{-G} \ \exp^{-2\phi} \left[ c %2B R \right]+&bg=ffffff&fg=333333&s=0 +&bg=ffffff&fg=333333&s=0

This gives the following equation.

This will generate the picture of the equation dynamically. Now add the image URL to the blog.

One word of caution. Some of the characters are not easily recognised, like =, +. For them use the HEX code instead. In the link presented above I have used the HEX code %3D instead of = . A quick way to get the HEX code is to go here (
One more thing is that if this is done in blogger aas I have done it will stretch the image. To restore to its original form goto the edit HTML and remove the width option from the code of the picture. The code will start with a. Just change the width to auto like width : 400px.

The same procedure can be followed for websites but this dynamic rendering of the equation image puts a lot of load on the servers of wordpress. It is unfair to do so for our own advantage.

No comments:

OK GOOGLE on Samsung Galaxy S7 doesn’t work

To make Ok Google detection work on Galaxy S7 (Galaxy series phones) we need to perform a couple of steps. 1. As long as Samsung S vo...