Sunday, November 08, 2009

Google can render your equations for you!

In my last post I mentioned that Knol and Google Docs now have equation editing. What I didn't mention is that this is an undocumented feature of the public Google Chart api, and it's easy to use. For instance, if I wanted to include the Schrödinger equation on this blog. I would construct an url like this:

http://chart.apis.google.com/chart?cht=tx&chf=bg,s,FFFFFF00&chco=AACCFF&chl=i\hbar\frac{\partial}{\partial t} \Psi(\mathbf{r},\,t) = \hat H \Psi(\mathbf{r},t)

Put your code in the chl parameter. The chf parameter lets you specify a background color in RGBA, chco lets you set the foreground color in RGB. When you drop it in inside of an image tag you get this:



If you anticipate making 250,000 calls to the chart server a day, contact Google first at chart-api-notifications@google.com. There's no limit to how much you can use it, but they reserve the right to turn you off.

←me