# [texhax] One (more) question about \halign

Barbara Beeton bnb at ams.org
Wed Feb 3 22:28:38 CET 2010

from donald arseneau:

> (Actually, for a TOC it is better to use paragraph parameters and no
> boxes or alignments. Then you have to pre-measure your page numbers
> and section numbers, but that is inevitable even with halign because
> you have to set the \hsize.)

from rodolfo:

Thanks for your suggestion.  However, I'm not able to build a TOC structure
otherwise.  Can you suggest how to do that with paragraph parameters?

here's a very raw, very plain example.

a chapter number or such can be set
in an \llap'ed box of specified fixed
size on the first line instead of the
negative kerned name on a separate line.
if you do that, you'll want to adjust
same width as the box.

if you want dot leaders, they can be
used to replace the \hfill on the last
line; you'll want to adjust the width
of the \rlap'ped box to avoid too much
of a gap before the page number.  note
that the \hsize is narrower than the
assumed page width.

i heartily recommend ragged right text
for titles.

i'm sure this isn't exactly what you
want, but you should be able to crib
dirty tricks, p.392 ff., "paragraph
maneuvers".

enjoy.
--------------------

\def\contitem#1\\#2\\#3<{%
\hsize=3in \leftskip=2em
\rightskip=0pt plus.3\hsize
\parindent=0pt \parfillskip=0pt
\leavevmode\kern-2em{\bf #1}\hfill\break
\ignorespaces#2\hfill
\rlap{\hbox to3em{\hfil#3\unskip}}}

\contitem
First Author\\
Title of first article\\
23<

\contitem
Second Author\\
Title of second article\\
37<

\contitem
Third Author\\
Title of third article, which is very long and goes
on and on taking up much more than one line\\
45<

\bye