3

Is it possible to get syntax highlighting for LaTeX code blocks in ikiwiki (just something like it is automatically done in tex.sx)?

To avoid misunderstandings: I don't mean math output produced for example by mathjax. I want to document latex-tricks in my wiki, so I have to put some snippets of latex source code in it to show how something is done in latex. For example:

"Here is an example how to use tikz:

\begin{document}{article}

\usepackage{amsmath}
\usepackage{tikz}

\begin{document}
   \begin{tikzpicture}
   \draw (0,0) --node[sloped,above]{$x$} (1,1);
   \end{tikzpicture}
\end{document}

"

Here the code block above just appears with a grey background but without syntax highlighting of the source code. If I would put the same snipped on tex.sx there would be a syntax highlighting of the code.

2

For syntaxhighlighting in Ikiwiki there is a plugin called highlight. You can use it like

[[!format tex """
\documentclass{scrartcl}
…
"""]]

This will give you nice syntax highlighting. It uses Perl bindings. The library itself has a longer documentation.

  • Thanks, that's what I want. However I don't see, how to install and enable it. Can you include the relevant steps into your answer? I just did sudo aptitude install libhighlight-perl to get the libraries. According to your link then I have to get and install a plugin called format, but I don't know where and how... – student Nov 3 '12 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.