The concept of boxes in TeX

boxboxescharacterssymbols

  • Am I right that TeX considers a text in terms of boxes (rectangles) where each character (char) is in a rectangle with three dimensions (height, width and depth (hwd)) and the origin point?
  • And that each box contains not a character itself, but the information about it (its ASCII code, etc.)?
  • So that TeX is to place boxes correctly by their metrics (geometry) and build a dvi-file where it is explained where to put a character, what character it is and its size and which font to use? Then a dvi-driver (viewer) is only to visualize the information? So the visualization is divided from?
  • And that a character, a word, a line, a paragraph and a page are all boxes with the same structure (a rectangle with hwd and the origin)?
  • So the box concept is recursive like? A subbox is a smaller copy of the parent box? And the smallest part is a box with only one character?

Best Answer

Abstractly your description is more or less right. Classical TeX doesn't have any information about character shapes from the font. It just deals with font metrics where each character is four numbers (height, depth, width and italic correction), but while the overall model is often known as "boxes-and-glue" within TeX itself, characters form a separate node type, corresponding to horizontal or vertical lists (which as you note can be nested) and while characters and rules are somewhat box like they are not actually boxes.

So \setbox0=\hbox{a} saves a box with a horizontal list containing the character node for a. That character is not itself a box and you can't do \setbox0=a.

Related Question