
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}. I'd also like to know if anyone as changed is xemacs configuration file in such a way that is easy to change from haskell to LaTeX mode from within lhs files, and compile (latex compile) them. I always have to change to latex mode, the change the syntax highlight, and even then I can't compile the from the included lhs files - it always calls view instead of compile, even if I specify the correct Master file. Thanks in advance J.A.

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}.
Use \begin{code} fac 0 = 0 fac (n+1) = (n+1) * fac n \end{code} instead of \begin{verbatim}
fac 0 = 0 fac (n+1) = (n+1) * fac n
\end{verbatim}
and then define the `code' environment to do verbatim typesetting. You could start by looking at the LaTeX verbatim.sty package, or moreverb.sty, or simply copy the code for \verbatim and \endverbatim from latex.ltx with appropriate modifications (the latter is probably NOT recommended for the faint-hearted!).
(Haskell knows about both styles of literate comments, and the top one is designed for what you are doing).
HTH.
--KW 8-)
--
Keith Wansbrough

Keith Wansbrough
Use
\begin{code} fac 0 = 0 fac (n+1) = (n+1) * fac n \end{code}
and then define the `code' environment to do verbatim typesetting.
...or just download one of the available LaTeX styles for lhs, and get a bit of visual sugaring for free. See http://haskell.org/libraries/#tex -kzm -- If I haven't seen further, it is by standing in the footprints of giants

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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On Thursday, March 21, 2002, at 08:05 PM, Phil Molyneux wrote:
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 -
(2) The fancybox.sty package ---
I've been using the fancyvrb package. It has lots of options for presenting the text including frames, line numbering and font selection. \usepackage{fancyvrb} \DefineVerbatimEnvironment{code}{Verbatim}{} \DefineVerbatimEnvironment{deadcode}{Verbatim}{frame=leftline} This was recommended to me by someone on comp.lang.functional. At the time it was also suggested that the TeX and Haskell sources need not be the primary source, that the .tex file and/or .hs/.lhs files could be generated from something else. I took that to heart and wrote this: http://www.cit.gu.edu.au/~arock/haskell/SimpleLit/SimpleLit.lhs typeset as: http://www.cit.gu.edu.au/~arock/haskell/SimpleLit/SimpleLit.pdf Cheers, Rock.
participants (5)
-
Andrew Rock
-
Jorge Adriano
-
Keith Wansbrough
-
ketil@ii.uib.no
-
Phil Molyneux