Typesetting box (source code)

= Typesetting box

A \b[typesetting box] is a piece of material treated as one unbreakable item at a given stage of <line breaking>. The simple paragraph model assigns it a width. A word already assembled from <glyphs>, or a small diagram placed within text, can be represented by such an item.<Breaking paragraphs into lines by Donald E. Knuth and Michael F. Plass>[pp.1123–1125: boxes as rigid-width items]{ref}

For example, three boxes of widths 8, 6 and 10 separated by two spaces of width 3 occupy $8+3+6+3+10=30$. Keeping the boxes fixed while changing only the spaces is the model used by <typesetting glue>. If <hyphenation> makes an internal split available, the word must instead be represented with that <discretionary break>; a single indivisible box would hide the choice.

A box's width describes layout advance, which need not equal the exact ink extent of its <glyphs>. A more complete <TeX> box also has height and depth relative to a <text baseline>. These measurements allow boxes to be combined while maintaining baseline geometry.<TeX source code by Donald E. Knuth>[Box-node representation: width, height, depth and shift fields]{ref} The <CSS box model> uses its own rules for content, padding, borders and margins; interpreting every CSS box as an indivisible paragraph item would lose those distinctions.