TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

What's the (quick and) easy way to set the indentation of a \begin{code}/\end{code} or \begin{spec}/\end{spec}? That is, I want to set only the indentation of the whole block, not the indentation of the columns in the code (which can be configured by \hsindent as described in the documentation).

One solution would be to use \texths (as mentioned here) and a minipage, but I suspect there are better/nicer options.

share|improve this question
up vote 3 down vote accepted

By default, lhs2TeX uses \mathindent to determine the amount of indentation. So you can say


to get an absurd amount of indentation.

You can get more flexibility by using \hscodestyle. This command is executed for every code block, and you can put arbitrary style-changing commands in there. For example:


would change both indentation (to a value independent of \mathindent) and set the size of the code block.

share|improve this answer

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.