If you are a scientist you will frequently want to write an equation in your blog. The methods that are commonly used are quite inelegant. In this article I talk about a wonderful new way to write equations in Wordpress through the use of LaTeXMathML. Actually this method will work for any webpage, not only Wordpress blogs.
Typically, you will use a plugin that allows you to write LaTeX in your blog. The plugin will translate LaTeX to images of the equation when your blog is viewed in a browser. That can be a problem when you have many equations (pages with a gif for every equation is definitely not cool).
Philosophically you might also ask: Why should math be treated on a different footing? Text for everything else but images for equations? You may also be worried about the loss of semantic meaning. Text can be understood by search engines but images (of equations) cannot. If equations could be understood by search engines it would allow all kinds of applications like searching for particular equations and so on in the future. Enter MathML. MathML is a markup language like HTML used to display mathematical expressions. Currently MathML is understood only by Firefox. Internet Explorer understands it but you need to install the MathType plugin.
So how do you go about using LaTeX in your Wordpress Blog? The simplest way is to install a link to Javascript code that dynamically converts all your LaTeX code between two successive dollar signs into MathML. Sample:
\$\omega = \omega_0 + \sum_{i=0}^{30} n^2\$
gets converted to:
$\omega = \omega_0 + \sum_{i=0}^{30} n^2 + \int_{0}^{\infty} \frac{\sin x}{x} dx$
Note that this will only work on Firefox. Whats cool that the above math snippet is not an image…you can select parts of it with your cursor. Go ahead and try it out!
To get this working on your blog enter the following HTML code in your Wordpress header. Go to Presentation->Themes. Edit the header code. Insert the following:
<script type="text/javascript"
src="http://www.maths.nottingham.ac.uk/personal/drw/LaTeXMathML.js">
</script>
You enter LaTeX as and when you require it in your blog post by putting it between two dollar signs. The Javascript dynamically converts LaTeX to MathML when page is accessed using the Firefox browser. It doesn’t seem to work in Internet Explorer yet…though in theory it should work with the MathPlayer plugin installed.
To learn more, check out LaTeXMathML. Happy LaTeXing!
Recent Comments