[texhax] [solved] Re: A question about \halign

Rodolfo Medina rodolfo.medina at gmail.com
Sat Jul 4 13:43:24 CEST 2009


On Fri, Jul 03, 2009 at 10:14:57PM +0100, Rodolfo Medina wrote:

>> \halign to \hsize{%
>>       \quad\rm\ \ \ \ \llap{1.2}\
>>       \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}
>>
>>
>>
>> \bye
>>
>>
>> I want that `\quad\rm\ \ \ \ \llap{1.2}\ ' stays on the first line and
>> `bnbnbnbn' on the second line.



Oleg Katsitadze <olegkat at gmail.com> writes:

> \halign to \hsize{%
>       \vbox{\parindent=0pt\hsize=105mm\hangindent 0em
>       \strut\rm\llap{1.2 }#\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}



Donald Arseneau <asnd at triumf.ca> writes:

> 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.



Thanks for you help.  This seems to work fine for my purposes:

    \halign to \hsize{%
      \quad\ \ \ \ \ 
      \vbox{\parindent=0pt\hsize=105mm\hangindent 0em\strut%
            \rm\llap{1.2\ }#\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}

\bye



, even though it is not very orthodox for a table of content, as Donald says.
But it works and looks fine.  I've been writing by myself plain TeX macros for
sections and subsections and also for TOC, surely not without errors.

Rodolfo



More information about the texhax mailing list