TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am a LaTeX / Haskell newbie and this question involves lhs2tex. Please let me know if I am posting on the wrong forum. I am writing a report in which I have fragments like:

fib n = case n of  
    0 -> 1  
    1 -> 1  
    _ -> fib (n-1) + fib (n-2)  
\caption{Simple recursive function to calculate the $n^{th}$ Fibonacci number}  

The report is preprocessed with lhs2tex. Since some of the other examples are a lot longer than this one, I want to reduce the font size only for the code and spec blocks. Is there an easy way to do this?

Thanks for your time.

share|improve this question
And these spec and code environments are defined by a package, or did you define them? – Gonzalo Medina May 28 '12 at 2:01

Don't change the file which is produced by lhs2tex! Then you have to change it every time you run lhs2tex. Put


in the .lhs file instead.

share|improve this answer
I'd prefer to just upvote or comment on the answers, but can't because I just registered and lack the reputation to do so. I am the author of lhs2tex and want to express strong support for the answer given by Bengt. That's the right way to do it. Generally, never edit generated files, and in particular, don't edit the output of lhs2tex. – kosmikus Jun 2 '12 at 7:32

you can define the \hscodestyle command in the resulting .tex to be whatever you want for formatting. Open the output .tex that lhs2tex produces, and change the line that looks like this:



share|improve this answer
Awesome!! Thank you! – Neil May 28 '12 at 22:34
No problem! If this answer was ok, then please accept it, so other people who come upon your question can easily find it as well. Cheers! – mvarela May 29 '12 at 4:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.