1

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:

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

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.

1
  • And these spec and code environments are defined by a package, or did you define them? May 28 '12 at 2:01
3

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

\renewcommand{\hscodestyle}{\small}

in the .lhs file instead.

1
  • 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
0

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:

\newcommand{\hscodestyle}{}

to

\newcommand{\hscodestyle}{\small}
1
  • 1
    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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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