[Haskell] ANN: pandoc 1.2

Sebastian Fischer sebf at informatik.uni-kiel.de
Thu Mar 5 07:35:03 EST 2009


On Mar 1, 2009, at 8:21 PM, John MacFarlane wrote:

> I'm pleased to announce the release of pandoc version 1.2
> (uploaded today to HackageDB).
>
> The most significant new feature is support for literate Haskell.

That is a very useful feature. It let's us mash-up pandoc and lhs2TeX  
to create nicely formatted PDFs from literate Haskell formatted as  
markdown:

pandoc --to=latex+lhs --custom-header=header.tex program.lhs |\
lhs2TeX --output=program && pdflatex program

The file header.tex must contain an appropriate document style and the  
line

%include lhs2TeX.fmt

A slight drawback is that code written indented or between ~~~ (and  
hence not meant to be executed) is converted to a `verbatim`  
environment. As a consequence, lhs2TeX does not use the same  
formatting as in code blocks. To fix this we can insert this in the  
pipe:

sed s/\\begin{verbatim}/\\begin{spec}/ |\
sed s/\\end{verbatim}/\\end{spec}/

but of course this is hack, that does not work, if we want to write  
the replaced strings somewhere in our document..

Unfortunately, I did not manage to use the citeproc extension to get  
references in the text and a bibliography at the end of the latex  
file, thus need to resort to \cite{...} in the source code and bibtex.

Nevertheless, a very useful tool!

Cheers,
Sebastian



More information about the Haskell mailing list