kosmikus / lhs2tex

Preprocessor for typesetting Haskell sources with LaTeX
Other
99 stars 28 forks source link

Document example of using \aligncolumn #22

Open spl opened 12 years ago

spl commented 12 years ago

It seems there has been a TODO in the guide for a long time.

ivanperez-keera commented 6 years ago

I came here to open this ticket, and saw that it was here. I absolutely agree. They are briefly documented, but there are no examples.

I'm hitting a problem regularly where I define a product type and my constructors are centered. Wrong. I'm having to add an empty word that renders to nothing after them, but then the Haskell code is invalid.

Could someone, please, add an example to align the following code nicely to the left (notice the double spaces)?

data A  =  A1LongWord
        |  A2
        |  ...
kosmikus commented 6 years ago

I usually do the following:


%if style /= newcode
%format DOTS = "\dots"
%endif

\begin{code}
data A  =  A1LongWord
        |  A2
        |  DOTS
\end{code}
kosmikus commented 6 years ago

I know that's a workaround, and not answering your original question. But it's much more robust than working with \aligncolumn, because \aligncolumn forces me to specify the column number manually, and if I later edit the code, it's very easy to forget to adapt that number.

ivanperez-keera commented 6 years ago

Ok. I'll do that for this case. But, more generally, how would you align the column to the left here. I must be making a very stupid mistake, but a simple align column 4 to the left wouldn't work.