literate haskell
Phil Molyneux
bs_s024@kingston.ac.uk
Thu, 21 Mar 2002 10:05:45 +0000 (GMT)
On Wed, 20 Mar 2002, Jorge Adriano wrote:
> Why is it necessary to leave a blank line between comments and code?
> I'm using LaTeX in my lhs files, with the code inside a verbatim
> environment, and I'd rather start writing my code right after the
> \begin{verbatim}.
Haskell allows you to use a LaTeX \begin{code}...\end{code} environment to
signify code in a literate script (Report Appendix C) --- the only snag is
finding a definition for the ``code'' environment.
The two that work for me are:
(1) Andrew Cooke's haskell.sty --- this is based on the listings.sty package
which has lots of features to pretty-print your code without editing it or
inserting LaTeX commands. This is available at haskell.org
(2) The fancybox.sty package --- if the listings package is not available or
fairly old on your LaTeX system then the following will probably still work
% code environment for Haskell/HUGS
% Environment for code --- requires fancybox package
\usepackage{fancybox}
\newenvironment{code}%
{\VerbatimEnvironment
\begin{Verbatim}}%
{\end{Verbatim}}
Phil
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Phil Molyneux email molyneux@kingston.ac.uk
tel work 020 8547 2000 x 5233 direct 020 8547 8233 home 020 8549 0045
Kingston Business School room 339 WWW http://www.kingston.ac.uk/~bs_s024
Kingston University, Kingston Hill, Kingston upon Thames KT2 7LB, UK
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~