LaTeX in comments

A quick post which follows on from my earlier mention of QuickLaTeX. What I did not say was that as well as letting me use LaTeX in my posts, it also lets everyone use it in their comments. All you need to do is to put ![latexpage] at the start of your comment, and QuickLaTeX will then parse it and insert the relevant graphics. See for example my own use of this feature in a comment earlier today.

QuickLaTeX: A LaTeX plugin for WordPress

[latexpage]
Reading through the chat page for the {TeX} Q&A site today, I stumbled upon a reference to QuickLaTeX. This is a plugin for WordPress to allow you to show LaTeX code in your page or blog. That’s not unique, but what is interesting is that it runs the LaTeX on the QuickLaTeX server, meaning that you don’t need LaTeX on your web host’s system. For me, that was immediately interesting as I don’t have a TeX installation on the host for this site. (It looks like QuickLaTeX is built using TeX Live 2010, so most packages should be available unless you are on the bleeding-edge.)

The system seems pretty easy to use. The plugin follows the standard WordPress model: download, install and activate. The plugin page gives some details on how to use it, but a few examples here will show off the power of the system. It’s possible to put something simple into the blog, such as

!\[ y = mx + c \]

and get
\[ y = mx + c \]
or something much more complex, like

!\begin{tikzpicture}
[+preamble]
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
[/preamble]
\begin{axis}
\addplot3[surf,domain=0:360,samples=40] {cos(x)*cos(y)};
\end{axis}
\end{tikzpicture}

and get
\begin{tikzpicture}
[+preamble]
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
[/preamble]
\begin{axis}
\addplot3[surf,domain=0:360,samples=40] {cos(x)*cos(y)};
\end{axis}
\end{tikzpicture}
All that is needed, beyond the plugin, is to put ![latexpage] at the start of the page. You can then escape any ‘raw’ LaTeX by prefixing the beginning with !, for example

!!\[ y = mx + c \]

is what I used for the first of my demos.

I don’t often find the need to post actual LaTeX examples in my blog, but the facility is certainly one I’m happy to have access to. The license for QuickLaTeX asks for a public link to their site, which seems like a small pay-off for a very handy service.