Take the 2-minute tour ×
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.

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

1 Answer 1

up vote 2 down vote accepted

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

\setlength\mathindent{4cm}

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:

\renewcommand\hscodestyle{%
   \setlength\leftskip{-1cm}%
   \small
}

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

share|improve this answer

Your Answer

 
discard

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.