# [texhax] listings' alignment function

Wed Jan 11 12:37:59 CET 2012

```Hello,
** Neal H. Walfield [2012-01-11 11:43:41 +0100]:

> Hi,

> I like the listings package a lot, in particular, I like that I don't
> need to use an ugly monospace font to have the code reasonably well
> aligned.  I'd like to improve the alignment a bit.  Consider the
> following C code:
(IMHO, not monospace font is ugly for source code.)
>   for (s = list;
>        s;
>        s = g_slist_next (s))
>     ...

> The three s's are supposed to be aligned.  Unfortunately, they are
> not.  listings does not realize that an open parenthesis indicates
> where the text on the following line should start.  It instead formats
> the code as follows:

>   for (s = list;
>           s;
>           s = g_slist_next (s))
>     ...

> It's acceptable, but not pretty.

> Is there a way to do what I want?  Perhaps some function that I'm
> overlooking that says, align here, e.g.:

>   for (\alignhere{}s = list;
>        s;
>        s = g_slist_next (s))
>     ...
Search for 'columns' in documentation and play with it.

P.S. I tried small example with listings but it default style distract
me. From 'listings' documentation: "If fancyvrb and listings provide
similar functionality, you should use fancyvrb's.".

---