[comp.text.tex] Marginality

kelly@nmt.edu (Sean Kelly) (03/08/91)

AAGGGGH!!

     For quite some time now, I've battled with TeX and my own limited
knowledge of TeX in producing ``Marginal Headings,'' ``Marginal
Definitions,'' ``Marginal Keyword Highlighting,'' ``Marginal
Figures,'' and so on, with only marginal results.

     My big questions are:  how was the keyword highlighting done in
the TeX-typeset book _Digital Design: Principles and Practices_ by
John F. Wakerly?  And how was the marginal grafitti done in Graham's,
Knuth's, and Patashnik's book _Concrete Mathematics_?

     Non-LaTeX solutions, please.  An instructor convinced me
that ``real people use Plain TeX.''

     What follows is my longish, soapboxish discussion on why anyone
would want to do this.  Skip rest of message if in a hurry.

     Many people who use typesetting systems don't understand the idea
of how the eye traces back from the end of one line of text to the
beginning of the other.  That's why many books aren't the typical 8
1/2 by 11 inch size.  Unfortunately, most laser printers only take 8
1/2 by 11 inch paper.  So, most of these people still blindly go on as
if TeX were a typewriter, and put in their one inch margins on all
sides, with a ten point type.  And, so that the eye doesn't get lost
when tracing back, they (gasp) double-space.  It's really ugly.

     So, after staring at a set of manuals printed on 8 1/2 by 11 inch
paper, I noticed that they didn't look all that bad.  And how did they
do it?  They had a narrower text column!  It looks like this:

               +-------------------------------------+
               |                                     |
               |            blah blah blah blah blah |
               |            and eeep fish zing sushi |
               |            blah blah blah blah blah |
               |            and eeep fish zing sushi |

and so on down the page.  So what did the designers of the manual put
in all that white space?  Headings, keyword highlighting, definitions,
warnings, figures, and so on.  It's a really great idea!

     I've been able to do such things myself, but with limited
success. Headings aren't that hard to do.  I can \rlap the heading for
a paragraph (and \llap on even-numbered pages) out to the side, making
sure it contributes no extra depth to the first line of the paragraph.

     Keyword highlighting I've done using \vadjust, again lining up
the baseline of the keyword in the margin with the line of text on
which the keyword appears.

     I did encounter problems when trying to put definitions or
warnings or notes in the margin, though.  If they were too long, and
happened to start near the bottom of the page (where the line to which
they were ``anchored'' started), they were cut off.

     Floating figures weren't that hard though.  I defined a margin
box that gets output along with \box255 in the output routine.  The
margin box is initially empty, and as figures are called for, they are
placed in the box.  Should so many figures appear on a page, \vsplit
takes what doesn't fit, and puts it in the margin box for the next
page.

     From this, I found that there are two types of marginal items:
floating items (like figures), and fixed items (like headings).  The
big problem comes when trying to mix both.

     How can it be done?  How was the grafitti in _Concrete
Mathematics_ tied to certain places in the text, and made to fit so
well, so it wasn't necessarily broken across pages?  And how was the
keyword highlighting in _Digital Design_ done, even when multiple
keywords existed on the same line, even when the keyword would be too
long to fit in the margin and was automatically indented?  And how can
I combine with that figures that float in the margins?

     Perhaps a scheme akin to memory allocation?  While building a
page, stick fixed items in the marginal box, and collect floating
items elsewhere.  When it's time to output the page, fit the floating
items in whatever space exists, using the best-fit method, and then
output the page.  Whatever didn't fit stays in the collection area for
the next page.

     Any ideas at all?  Anyone?

--
kelly (sean)                      `Did you get your precious photos?'
kelly@nmt.edu                     `Someone was there.'
Std disclaimers apply             `Men? ... Police men?'
--