[Tex/LaTex] Confused with TeX terminology: height, depth, width

boxesdimensionsstruttex-core

The LaTeX reference card states for example

\strut box w/ ht and depth of “(”, zero width

I came to see text as a two dimensional feature, but I must be missing out on something…

(following was off-topic: by the way, im trying to find documentation on how to use \vbox, \hbox,… i.e. to align a hbox within a vbox to the right)

Best Answer

I made the following diagram for the adjustbox bundle. It will be part of the trimclip manual (The trimclip package will be an extracted part of the current adjustbox package).

Box

As you can see the text lies on the baseline, the height is everything above it and the depth everything below it. Usually only some lower-case character and punctuation go below it. Both together is the totalheight. Note that the coordinate system for the depth is going down, i.e. it is always positive. The width is the normal width of the content.

The macros in the document show how to access these values in LaTeX macros like \raisebox (first line) or with a TeX box register called \br here (second line).

There are further diagram which explain the trimming and clipping of boxes. The current work-in-progress version of the manual with this diagrams can be downloaded as PDF from the code repository. The source code for this and all other diagrams are also available.

Related Question