If your blog is hosted on WordPress.com, you can already render mathematical equations using LaTeX code (at least, that is my understanding). However, since I run WordPress on my own server, I would have to add a bit of software to produce similar results. A long time ago I tried using jsMath to generate math equations, but I tired of all the warning messages it produced if a user didn’t have the proper fonts installed. However, after seeing Robert Talbert mention MathJax on Twitter this morning, I decided to see if I could add it to this site. MathJax is apparently the successor to jsMath, and appears to be gaining some momentum in the mathematics community.
MathJax and WordPress have obviously been joined together before, as I quickly found the MathJax-LaTeX plugin for WordPress. While I could have installed MathJax on its own, I decided to install the plugin also, as it promised to inject MathJax javascript only on those pages that require it. Here is evidence (hopefully) that everything works: [mathjax] $$df(X_t)= \sum_{i=1}^d f_{,i}(X_t)\,dX^i_t + \frac{1}{2}\sum_{i,j=1}^d f_{,ij}(X_{t})\,d[X^i,X^j]_t$$
My knowledge of Linux is pretty limited, but I’ll share how I got my WP blog working. Be forewarned, however, that I likely won’t be able to answer questions about other installations; I’m barely capable of getting things working on my own system.
To begin, I used the WP plugin manager to add the MathJax-LaTeX plugin. I noted that it created a folder labeled mathjax-latex in my WP plugins directory, which I reference below. I next needed to install the MathJax files onto my WordPress server. My first approach was to download the files to my desktop, unzip them, and then FTP them back to my server. Bad idea! The MathJax folder is 16MB when compressed, much larger than that when uncompressed, and contains over 30,000 files! It would have taken hours to upload them via FTP.
So I launched Putty, logged into my webhost via SSH, and went to site-folder/wp-content/plugins/mathjax-latex/. From there, I issued the command wget http://sourceforge.net/projects/mathjax/files/MathJax/v1.0.1/MathJax-v1.0.1a.zip/download to download the MathJax files directly onto the server. Then, to unzip the downloaded file, I used the command unzip MathJax-v1.0.1a.zip. This put all the needed files into the directory .../plugins/mathjax-latex/MathJax, just as required by the MathJax-LaTeX plugin.
Next, to accommodate recent Firefox releases, it was necessary to download some updated font files. First, I went to directory .../MathJax/fonts/HTML-CSS/TeX and deleted the otf folder with rm -rf otf. Then I sucked down the new fonts with wget http://www.mathjax.org/dl/MathJax-Font-Update.zip, using unzip MathJax-Font-Update.zip to inflate the files. Unfortunately, this created an unwanted MathJax-Font-Update folder containing the needed otf subfolder. So I moved into the MathJax-Font-Update directory, then shoved the otf folder up a level with mv otf ../otf. Finally, I moved back up a level into the TeX directory, and removed what was left of the unneeded folder with rm -rf MathJax-Font-Update.
Lastly, I went back to the WP plugin page and activated the MathJax-LaTeX plugin. To put
code on a page, enclose your equation inside the tags [latex] and [/latex]. So [latex]e=mc^2[/latex] produces
. If you want to use dollar sign notation, simply include the tag [mathjax] somewhere on your page. Then $$e^{j\pi} = -1$$ generates $$e^{j\pi} = -1$$
When I first installed everything, Firefox would waste about 45 seconds trying to load web fonts, before rendering equations with image files. Reading through the MathJax documentation, this appeared to be a permission problem, and I created a suitable .htaccess file as suggested. However, the problem went away after I cleared the browser cache, and didn’t come back when I deleted the .htaccess file. So if you run into this problem, try clearing your browser cache first!