Posts tagged ‘latex brush’

Latex brush for Syntax Highlighter Plus WordPress plugin

I post source code snippets quite often and I use this plugin for syntax highlighting. It works great but it doesn’t support every programming language. For example it lacks Latex support. On the other hand you can define coloring rules for unsupported languages by creating new “brushes”.

Taking advantage of this feature, I’ve defined an extremely simple Latex brush which highlights:

  • Latex comments beginning with a percent symbol ‘%’.
  • Latex commands beginning with a backslash “\”.
  • Some keywords such as ‘if’, ‘else’, etc.

You can download the brush from here.

If you want to see Latex coloring in action, you can take a look at the Latex section of my blog.

Note: I also had to add this line:

'Latex'     => array('latex', 'tex'),

…to the SetVariables() function in syntaxhighlighter.php for the new brush to work.