Documentation for lhs2tex shows a serif font being used by default as the output from the preprocessor (http://www.andres-loeh.de/lhs2tex/Guide2-1.17.pdf):


However, when I run lhs2tex --poly input.lhs > out.tex;pdflatex out.tex, the Haskell source is formatted in a computer-modern font:


My input file is

\%include polycode.fmt
Hello World!

> main :: IO ()
> main = putStrLn "Hello, world!"

  • Computer Modern is a serif font? Well, Computer Modern Roman is a serif font, Computer Modern Sans serif is, ähm, sans-serif font.
    – Johannes_B
    Mar 26, 2015 at 17:18
  • sorry - I am probably not referring to the font correctly. I've added screenshots to help describe the current issue Mar 26, 2015 at 17:24
  • To be honest, i don't know how that works in detail and i won't read the doc. Try to add \usepackage{tgchorus} to your inputfile and see if there are differences.
    – Johannes_B
    Mar 27, 2015 at 20:04
  • thanks. that still gives the same result though. I think the issue is related to the polytable package not being found, although no errors are shown when running pdflatex Mar 28, 2015 at 11:06
  • You can make some edit to the question, add some detail, this will make the question appear back on top of the main site. Do it at around 20 pm standard time, most people online.
    – Johannes_B
    Mar 28, 2015 at 13:34

1 Answer 1


It seems that alignment in lhs2TeX (which uses the polytable packake) is driven by spaces in the .lhs source file. I was able to set the font using


and adjusting the input to

> main  ::   IO()
> main  =    putStrLn "Hello, world!"

resolved the alignment issue.

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.