[texhax] TeX Queries 4: Overfull boxes

Donald Arseneau asnd at triumf.ca
Thu Aug 2 02:22:29 CEST 2012

Paul Stanley <paulrichardstanley at gmail.com> writes:

> \begindisplay
> \hbox spread-1em{You don't get spaces between words narrower than this,\
> and}\cr
> \hbox spread+1.679895em{you don't get spaces between words wider than this.}\cr
> \enddisplay
>
> Does the above depend on the size of the font? Presumably the physical width
> of em varies from font to font.

The example is extremely specific and ad-hoc.

The default inter-word space with the cmr10 font has a stretch of 1.66666 pt
and a shrink of 1.111111 pt.  The em size for cmr10 is 10 pt, so the interword
shrink is 0.1111111 or one ninth of an em.  Knuth chose his words so there
were nine spaces on the line that is forced to shrink by 1 em.

The second line is trickier and somewhat of a lie as well.  Whereas the
limit on shrinking is absolute, there is no actual limit on the amount
of stretching.  The logic of Knuth's sample goes like this:  Plain TeX
has a \tolerance parameter of just 200, and lines with badness 200 (at
the limit of tolerance) have a stretch ratio of $(200/100)^{1/3} = 1.26$
(the cube root of 2).  Each of the eight spaces in the sample must stretch
by $1.26 \times 0.166666 em$ for a total stretch of 1.68 em for the line.

The lie is that, with forced breaks due to penalties, some lines may
indeed stretch more than the tolerance would normally allow.

> What is a box?

It is the conceptual building block and container TeX uses.  It is described
in a chapter of the TeXbook.  Each character has its own "bounding box";  lists
of characters and spaces etc form a "horizontal list" which is contained in
a "hbox".  Lists of hboxes and line-spaces plus other stuff form a "vertical
list" which is contained in a vbox.

Donald Arseneau                          asnd at triumf.ca