[texhax] A question about \halign

Donald Arseneau asnd at triumf.ca
Sat Jul 4 01:40:37 CEST 2009


Rodolfo Medina <rodolfo.medina at gmail.com> writes:

> But now, suppose that I want a third argument of the alignment to stay on the
> first line, instead:

There is only one reference point for a box, so you cannot
have a paragraph box (\h)aligned on two different baselines
automatically.  

>       \quad\rm\ \ \ \ \llap{1.2}\ 

If you know the width of something (like this) then you don't
need halign adjustment, but put this at the beginning of
the \vbox entry.

If all three absolutely *must* be in separate \halign columns,
then it is possible to set the second column first in \vbox,
then rebox it into \vtop, measuring the difference in height;
\lower the third entry by that difference.

>       \vbox{\parindent=0pt\hsize=105mm\hangindent 0em\strut#\hfill\strut}%
>       \tabskip=0cm plus20cm minus20cm&\hfil#\tabskip=0pt\cr
>       bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
>       bla bla bla bla bla bla bla bla bla bla bla bla bla &bnbnbnbnb\cr}

This looks like a table of contents entry

> Help very much appreciated: it's for the format of a table of content.

A ha!  It is.  Table of contents macros usually don't use \halign
at all!  Just use paragraph settings with \rightskip \leftskip
and \parfillskip.  If you use dot leaders then that is the best
way to get the dots lined up.

You have to assign some maximum width for the section and page numbers,
but you have to do that anyway implicitly when you set \hsize for
the title text.


-- 
Donald Arseneau                          asnd at triumf.ca


More information about the texhax mailing list