[Haskell-cafe] lhs2TeX: automatic line wrap within code blocks?
Dominique Devriese
dominique.devriese at cs.kuleuven.be
Thu Apr 5 08:01:53 CEST 2012
David,
The easiest solution is probably to use multi-line string literals and
line-wrap manually:
\begin{code}
cyphertext = "rlkmlj, zlnift ekblvke pqc elvm if pzlp gblrk, akrlomk zk zle \
lfpiriglpke pzlp, if pzk flpojlb rcojmk cs knkfpm, morz qcobe ak pzk rcfeorp \
cs nkjriftkpcjiu, bklnkm pzk ljdv ofekj gjkpkfmk cs jlimift jkrjoipm lfe \
rlnlbjv"
\end{code}
Dominique
Op 4 april 2012 20:14 heeft david.mihola <david.mihola at gmail.com> het
volgende geschreven:
> Hello,
>
> I am currently using lhs2TeX for the first time and have encountered a
> problem which I am unable to solve myself: Some code lines are too long to
> fit into a single line of the output (PDF) file and thus go off the right
> edge of the page.
>
> Consider the following example:
>
> -------------------------------------
>
> \documentclass{article}
> \usepackage[utf8]{inputenc}
>
> %include polycode.fmt
> %options ghci
> \begin{document}
>
> Our encrypted message:
>
> \begin{code}
> cyphertext = "rlkmlj, zlnift ekblvke pqc elvm if pzlp gblrk, akrlomk zk zle
> lfpiriglpke pzlp, if pzk flpojlb rcojmk cs knkfpm, morz qcobe ak pzk rcfeorp
> cs nkjriftkpcjiu, bklnkm pzk ljdv ofekj gjkpkfmk cs jlimift jkrjoipm lfe
> rlnlbjv"
> \end{code}
>
> Our decryption function:
>
> \begin{code}
> decrypt = id
> \end{code}
>
> The original message was:
>
> \eval{decrypt cyphertext}
>
> \end{document}
>
> -------------------------------------
>
> Converting this to .tex with lhs2TeX and to .pdf with pdflatex produces a
> PDF in which both instances of the cyphertext go off the right edge of the
> page.
>
> Is there any way to tell lhs2TeX to allow/force line wrap within code blocks
> and eval-statements?
>
> Thank you very much for any help!
>
> David
>
> P.S.: I have only found one prior discussion of my question
> (http://tex.stackexchange.com/questions/15048/how-to-typeset-a-multiline-text-in-math-environment)
> but to my understanding no real answer came out of that.
>
> --
> View this message in context: http://haskell.1045720.n5.nabble.com/lhs2TeX-automatic-line-wrap-within-code-blocks-tp5618600p5618600.html
> Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list