ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: ecashin@coe.uga.edu (Ed L. Cashin)
Cc: NTG-ConTeXt mailing list <ntg-context@ntg.nl>
Subject: Re: balancing columns with little formatted entries
Date: 15 Nov 1999 12:53:25 -0500	[thread overview]
Message-ID: <m3d7tbbq0a.fsf@kali.coe.uga.edu> (raw)
In-Reply-To: <37EEB0E9.FA9A6530@wxs.nl>

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 <pragma@wxs.nl> 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/


  parent reply	other threads:[~1999-11-15 17:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-22 20:59 Ed L. Cashin
1999-09-26 22:53 ` Hans Hagen
     [not found]   ` <37EEC4DD.34E1DD18@gc.maricopa.edu>
1999-09-27 11:09     ` context on miktex Hans Hagen
     [not found] ` <37EEB0E9.FA9A6530@wxs.nl>
1999-11-15 17:53   ` Ed L. Cashin [this message]
1999-11-15 19:40     ` balancing columns with little formatted entries Hans Hagen
1999-11-16 14:47       ` Ed L. Cashin
1999-11-16 15:16         ` Hans Hagen
1999-11-15 20:30     ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3d7tbbq0a.fsf@kali.coe.uga.edu \
    --to=ecashin@coe.uga.edu \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).