Jul 21 2012

LaTeX for SyntaxHighligther 3

I’m using a WordPress blog system, and I’m using WP SyntaxHighligther for syntax highlighting.

In the last few posts I’ve made, I had to paste a lot of latex code into them. The problem was that SyntaxHighligther (The script that WP SyntaxHighligther is based on) lacks support in latex highlighting.

Luckily enough, The SyntaxHighlighter script is very generic, which allowed me to just add my own latex brush into it.

You can find the brush here.

Just add a script tag to your HTML referencing this script and in SyntaxHighlighter “pre” command use the attribute class=”brush: latex;”.

% Example

\title{Hello World!}
Hello this is an example: $\int_{a}^{b}xdx$.

I’ve also made a patch for  WP SyntaxHighligther which adds the brush. It can be found here. You might need to reset the settings. I’ve submitted a request to add it to the official WP SyntaxHighligther version, hopefully it will be added soon enough.