Article View: comp.text
Article #1430Re: TeX \vbox trouble
From: Peter Ilieve
Date: Tue, 12 Dec 1989 09:44
Date: Tue, 12 Dec 1989 09:44
44 lines
2062 bytes
2062 bytes
I tried mail but it bounced, so I will burden everyone with this.
In article <272@oksce1.okstate.edu>
walters@oksce1.okstate.edu (Harold G. Walters) writes:
>
>I'm trying to make an exactly 1 inch \vbox with text set in
>paragraph mode along the bottom of the \vbox.
>
>with the macro
>
>\long\def\oneline#1{\vbox to 1.0in{
>\vfil{#1}
>}}
>
>BUT if the bottom line has descenders like
>
>The actual size of the box is greater than 1 inch by an amount
>of the depth of the descenders. I guess the \vbox is calculating
>the height based on the baseline of the text inside.
>
>IS this what is happening?
Yes, the 1.0in does not include the depth of the text.
>WHY does is happen this way, it seems like a \vbox should contain
> all of its contents in their entirety?
The box still does contain its contents. The problem is that a \vbox has both a
height and a depth. The "\vbox to 1.0in" construct is DEFINED as only affecting
the height, that's just how TeX is.
>COULD someone tell me how to fix it?
The rules for setting the depth of a \vbox are explained in a "double
dangerous bend" section in Chapter 12 of the TeXbook (page 80 in mine).
One simple thing that will fix it is to put a \vskip 0pt after the {#1}
in your macro definition. A \vbox that has at least one internal box
(the text in your case) gets set with zero depth if the final box is
followed by kerning or glue.
I have tried this here and it works, changing the box in your example from
\vbox(72.26999+1.94444)x469.75499 to \vbox(72.26999+0.0)x469.75499.
Peter Ilieve peter@memex.co.uk
Technical Details
Message-ID:
<342@memex.co.uk>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!strath-cs!cs.glasgow.ac.uk!memex!peterReferences:
<272@oksce1.okstate.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!strath-cs!cs.glasgow.ac.uk!memex!peter From: peter@memex.co.uk (Peter Ilieve) Newsgroups: comp.text Subject: Re: TeX \vbox trouble Keywords: TeX \vbox \vfil Message-ID: <342@memex.co.uk> Date: 12 Dec 89 09:44:44 GMT References: <272@oksce1.okstate.edu> Reply-To: peter@memex.co.uk (Peter Ilieve) Organization: Memex Ltd., East Kilbride, Scotland Lines: 44