From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/1253 Path: main.gmane.org!not-for-mail From: ecashin@coe.uga.edu (Ed L. Cashin) Newsgroups: gmane.comp.tex.context Subject: Re: balancing columns with little formatted entries Date: 15 Nov 1999 12:53:25 -0500 Sender: owner-ntg-context@let.uu.nl Message-ID: References: <37EEB0E9.FA9A6530@wxs.nl> NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1035392083 31138 80.91.224.250 (23 Oct 2002 16:54:43 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 23 Oct 2002 16:54:43 +0000 (UTC) Cc: NTG-ConTeXt mailing list Original-To: Hans Hagen Xref: main.gmane.org gmane.comp.tex.context:1253 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:1253 Back in September, I asked about balancing a two-column series of entries in a directory. Hans suggested a solution that used the grid feature in context. Hans Hagen writes: > See attached file [attached file simple.tex contents follow] ... > \setuplayout > [grid=yes] > > % and > > \setuphead > [subsection] > [number=no,style=bold,command=\Example, > before=\blank,after=\blank] ... and for formatting the subsection head: > \def\Example#1#2% > {\hbox to \hsize > {\vrule width 1em height .6ex depth -.5ex > \quad\strut#2\quad > \leaders\vrule height .6ex depth -.5ex\hfill}} ... > % #1: last name #5: email > % #2: first name #6: dept > % #3: phone number #7: room > % #4: position > > \def\fsdhcentry#1#2#3#4#5#6#7% > {\snaptogrid\vbox > {\forgetall > \bf > \strut\uppercase{#1},\space#2\space\dotfill\ #3\par > \tfx > \strut\quad#4\hfill#5\par > \strut\quad#6\hfill#7}} That produces output that looks better than before using the grid. However, while the entries are lining up with the grid, the "subsectionhead"s are not. That means that the bottom of the page will sometimes have unbalanced columns; namely, on pages that have subsectionheads. Here is a pdf that shows how on pages that have subsectionheads two vboxes across from one another snap to different lines on the grid: http://www.coe.uga.edu/~ecashin/temp/fsdhc-grid1.pdf (Page nine, for example.) I thought that I would solve the problem by putting both the entries and the subsectionheads into vboxes of equal height. That way, all the vboxes across from one another would snap to the same line. It looks promising, but when I try to put the subsectionhead in a vbox of "entryheight" and snap it to the grid, I get errors about missing braces. I feel like I'm on the right track (getting vboxes of equal height to line up), although I worry about what will happen if one of the boxes has to be bigger than entryheight. I'm not sure why it is failing, though. Here's a simplified demonstration what I'm trying: \setupwhitespace [halfline] \setupbodyfont [10pt] \setuplayout [grid=yes] \setuphead [section] [number=no,style=\bfb,textcommand=\BoxedSection, before=\blank,after=\blank,header=high,footer=section, page=yes] \setuphead [subsection] [number=no,style=bold,textcommand=,command=\RuleSubsection] \def\entryheight{2cm} \def\BoxedSection#1% {\framed[width=broad,height=1cm,corner=round]{#1}} \def\RuleSubsection#1#2% {\snaptogrid \vbox to \entryheight{% \forgetall \vfil \hbox to \hsize{% {\vrule width 1em height .6ex depth -.5ex \quad\strut#2\quad \leaders\vrule height .6ex depth -.5ex\hfill}}}} % #1: last name #5: email % #2: first name #6: dept % #3: phone number #7: room % #4: position \def\fsdhcentry#1#2#3#4#5#6#7% {\snaptogrid\vbox to \entryheight {\forgetall \bf \strut\uppercase{#1},\space#2\space\dotfill\ #3\par \tfx \strut\quad#4\hfill#5\par \strut\quad#6\hfill#7\blank[small]\vfil}} \starttext \section{College of Education Personnel} \startcolumns % \input personnel % % personnel.tex consists of many entries like this: \subsection{Z} \fsdhcentry{Zeitler}% {William R.}% {}% {}% {wzeitler@coe.uga.edu}% {Sci. Ed.}% {}% \fsdhcentry{Zepeda}% {Sally .}% {}% {}% {szepeda@coe.uga.edu}% {Educational Leadership}% {}% \stopcolumns \stoptext -- --Ed Cashin PGP public key: ecashin@coe.uga.edu http://www.coe.uga.edu/~ecashin/pgp/