GeneralBox height from given width (TeX?)

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
ogtifs
Posts: 8
Joined: Mon Dec 28, 2009 3:08 am

Box height from given width (TeX?)

Post by ogtifs »

Hello
I am interested in developing a package for a specific type of tabular layout which cannot be implemented on top of existing table packages. I expect to start with perlTeX and perhaps eventually remove the dependency if I feel masochistic enough to learn TeX internals.
Central to this plan is the need to determine the height of a (fixed-width) parbox for a given text block, as the number is needed for further dimensional calculations - ideally without actually outputting anything as multiple iterations are necessary. I expect this is fairly low level TeX - does anyone know how to do this?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

Box height from given width (TeX?)

Post by josephwright »

You could perhaps fill us in on what type of layout you need! Developing table-related stuff needs a good understanding of TeX low-level stuff, so you should first be sure you know enough TeX.

Anything which is boxed up can in principle be measured using the \ht, \wd and \dp primitives:

Code: Select all

\newbox\tempbox
\tempbox=\hbox{abc}
\newdimen\tempdimen
\tempdimen\ht\tempbox\relax
Most of this work is done using TeX primitives rather than LaTeX wrappers. However, you can apply the same to anything which is a box (for example, if it's created using LaTeX's \newsavebox).
Joseph Wright
Post Reply