[texhax] An idea for finding good page breaks

Karl Berry karl at freefriends.org
Wed May 27 00:35:58 CEST 2009


    I'm playing around with  typesetting a book of interviews

Funny, me too :).  (http://tug.org/interviews in my case.)

    all the vskips on a page should be the same but they can differ from
    page to page as a way to help expand or contract the text a bit to
    get good breaks.

Certainly a good idea, and easy to do.  This is exactly what
stretchable/shrinkable glue does.  Vertical glue works just the same way
as horizontal (e.g., interword spaces), as Phil replied.

For the sake of example, my \question and \answer macros start
approximately like this:

\long\def\question{\penalty-1000\vskip6pt plus3pt minus3pt ...
\long\def\answer  {\penalty-100 \vskip3pt plus2pt minus2pt ...

(These are all primitives, not the Approved LaTeX Way, but it works fine
with LaTeX.)

The negative \penalty (bonus) tells TeX, hey, this is a pretty good
place to break -- of course it's much better to break before the
question than before the answer.  But, if the page break is not taken,
then insert some glue.  The exact values will of course depend on your
layout.

Hope this helps,
Karl


More information about the texhax mailing list