[comp.text.tex] Box height in LaTeX ???

pyt@hprpcd.HP.COM (Pierre-Yves Thoulon) (07/12/90)

LaTeX allows me to set a length command to the width of a box by doing
something like:

% define the box
\newsavebox{\boxone}
\sbox{\boxone}{%
%definition of box goes here
}

% define and assign a new legth command
\newlength{\lenghtcmd}
\settowidth{\lengthcmd}{\usebox{\boxone}


Does anybody know a way of doing the same thing with the height of
the box rather than the width (in LaTeX or just plain TeX) ?

Thanks for your help.
Pierre-Yves Thoulon.
pyt%hprvlc0@hplabs.hp.com

writer@me.utoronto.ca (Tim Writer) (07/13/90)

Pierre-Yves Thoulon writes:

>LaTeX allows me to set a length command to the width of a box by doing
>something like:

>Does anybody know a way of doing the same thing with the height of
>the box rather than the width (in LaTeX or just plain TeX) ?

Sure, its no problem in plain TeX.

\newbox\aBox%
\setbox\aBox=\hbox{%		or \vbox
%	contents of box
}
\newdimen\aHeight%
\dimen\aHeight=\ht\aBox%

By the way, you should remember that a box has three dimensions: width,
height, and depth.  The corresponding TeX control sequences are \wd, \ht,
and \dp.  In case you don't know, the height is the distance from the
baseline to the top of the box, while the depth is the distance from
the baseline to the bottom of the box.

Tim

spqr@ecs.soton.ac.uk (Sebastian Rahtz) (07/14/90)

In article <15220001@hprpcd.HP.COM> pyt@hprpcd.HP.COM (Pierre-Yves Thoulon) writes:


   Does anybody know a way of doing the same thing with the height of
   the box rather than the width (in LaTeX or just plain TeX) ?

the only problem is remembering that a box has depth as well as
height; I append a solution, which I haven't tested :-}

remember that all of plain TeX is there in LaTeX as well

   \newsavebox{\boxone}
   \sbox{\boxone}{%
   %definition of box goes here
   }
   % define and assign a new height
   \newlength{\bheight}
   \bheight=\ht\boxone
   \advance\bheight by \dp\boxone

--
Sebastian Rahtz                        S.Rahtz@uk.ac.soton.ecs (JANET)
Computer Science                       S.Rahtz@ecs.soton.ac.uk (Bitnet)
Southampton S09 5NH, UK                S.Rahtz@sot-ecs.uucp    (uucp)