[Tex/LaTex] Highlighting haskell listings in large *.tex document

beamerlistingstex-core

Suppose, there is a large *.tex document, which has many nested \input directives with many Haskell listings surrounded by \begin{code} \end{code}
commands.

How can all this code listings be highlighted like all haskell code is highlighted in many haskell papers (functional pearls is a good example)?

I heard, that many haskell papers written in lhs and then transferred to tex via lhs2tex. Yep, this is a nice tool, but it produces whole tex document and it is hard to be usable for the task like mine.


Btw, I've tried lstlistings and fancyvrb – it's far away from ideal.

Best Answer

I was pleased with my lstlistings setup which I used in my bachelor thesis:

\lstset{
  frame=none,
  xleftmargin=2pt,
  stepnumber=1,
  numbers=left,
  numbersep=5pt,
  numberstyle=\ttfamily\tiny\color[gray]{0.3},
  belowcaptionskip=\bigskipamount,
  captionpos=b,
  escapeinside={*'}{'*},
  language=haskell,
  tabsize=2,
  emphstyle={\bf},
  commentstyle=\it,
  stringstyle=\mdseries\rmfamily,
  showspaces=false,
  keywordstyle=\bfseries\rmfamily,
  columns=flexible,
  basicstyle=\small\sffamily,
  showstringspaces=false,
  morecomment=[l]\%,
}

You can find some examples in my thesis: https://www.dropbox.com/sh/zu56xcp1mj57ikq/TtFoHKmOLV/thesis.pdf

I can also provide the whole .tex source if needed.

Related Question