A friend of mine asked me the other day how ‘pretty printed’ source code can be inserted into wordpress posts. Here’s how:
If you have a self-hosted wordpress server, get the plugin ‘SyntaxHighlighter Evolved’. Defaults work fine. If you have a wordpress.com account, the plugin is already. For LaTeX, you need the ‘WP-Latex’ plugin. After that, you can insert the source code using the syntax
[sourcecode language=”bash”]
[sourcecode language=”lang”]
… code here (there is no space after the [ in the lines above and below).
[/ sourcecode]
[/sourcecode]
You can get a list of supported languages here. Latex code can be inserted using the syntax:
[sourcecode language=”bash”]
$ latex 2^x $
[/sourcecode]
Again, no space after the $ in the above code. There you go!