# Indentation of a code block in lhs2TeX

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.

-

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.

-