2

Exercise 12.13 (p. 81) makes the following assumptions:

  • \box1 is 1pt high 1pt deep and 1pt wide
  • \box2 is 2pt high 2pt deep and 2pt wide
  • \baselineskip=9pt minus3fil
  • \boxmaxdepth=-4pt

The exercise is to describe \box4 after:

\setbox4=\vbox to4pt{\vss\box1\moveleft4pt\box2\vss}

The answer as shown on p. 312 is as follows: Now \box4 will be 4 pt high, −4 pt deep, 1 pt wide, and it will contain

\vskip-2.4pt, \box1, \vskip-1.2pt, \moveleft4pt\box2, \vskip-2.4pt. 

From the baseline of \box4, go up exactly 5.4 pt to reach the baseline of \box1, or exactly 3.6 pt to reach the baseline of \box2.

I don't get how the glue is calculated. The desired height of the box is 4 pt. What is the natural height? How to calculate the glue set ratio?

Another thing that I don't understand is the effect of a negative value of \boxmaxdepth. On p. 81 Knuth says: When rule (4) does decrease the depth, TEX adds the excess depth to the box’s natural height, essentially moving the reference point down until the depth has been reduced to the stated maximum.)

In the example rule 2 applies, as the last box (\box2) is followed by glue. So the depth must be 0pt. Now rule 4 comes in saying if the computed depth (0) exceeds \boxmaxdepth (-4pt) then the depth will be the current value of \boxmaxdepth (which is -4). How does this related to the quoted sentences above?

1 Answer 1

2

\tracingonline2
\showboxdepth100
\showboxbreadth100

\setbox1=\hbox{}\dp1=1pt\ht1=1pt\wd1=1pt
\setbox2=\hbox{}\dp2=2pt\ht2=2pt\wd2=2pt

\baselineskip=9pt minus3fil
\setbox4\vbox{\vss\copy1\copy2\vss}
\showbox4

\boxmaxdepth=-4pt
\setbox4\vbox{\vss\copy1\copy2\vss}
\showbox4

\setbox4\vbox to 4pt{\vss\copy1\copy2\vss}
\showbox4

\bye

Just looking at height so I ommitted the \moveleft.

the first showbox produces

\vbox(12.0+0.0)x2.0
.\glue 0.0 plus 1.0fil minus 1.0fil
.\hbox(1.0+1.0)x1.0
.\glue(\baselineskip) 6.0 minus 3.0fil
.\hbox(2.0+2.0)x2.0
.\glue 0.0 plus 1.0fil minus 1.0fil

showing a natural height of 12pt.

When you set the \boxmaxdepth it needs to move 4pt from the depth to the height, and the second \showbox is

> \box4=
\vbox(16.0+-4.0)x2.0
.\glue 0.0 plus 1.0fil minus 1.0fil
.\hbox(1.0+1.0)x1.0
.\glue(\baselineskip) 6.0 minus 3.0fil
.\hbox(2.0+2.0)x2.0
.\glue 0.0 plus 1.0fil minus 1.0fil

so now it is height 16pt and depth -4pt

So in the third case where you specify \vbox to 4pt the height needs to be forced to 4pt from 16pt so you need to shrink by 12pt. There are 5fil units of shrink (one from each \vss and 3 from \baselineskip) so each of these becomes 2.4pt hence the glue set being -2.4fil`

> \box4=
\vbox(4.0+-4.0)x2.0, glue set - 2.4fil
.\glue 0.0 plus 1.0fil minus 1.0fil
.\hbox(1.0+1.0)x1.0
.\glue(\baselineskip) 6.0 minus 3.0fil
.\hbox(2.0+2.0)x2.0
.\glue 0.0 plus 1.0fil minus 1.0fil
3
  • why the middle glue changes from 9pt minus3fil to 6pt minus3fil?
    – Stephen
    Commented Mar 10 at 8:13
  • @Stephen baselineskip glue is added to ensure even baseline-to-baseline spacing so in the normal case with 10pt text on 12pt baseline, the actual glue added between each line is 12pt - depth of descenders in row above - height of following height. here the row above has 1pt depth and the following row is an hbox with height 2pt so 3pt less glue is needed Commented Mar 10 at 9:25
  • Oh. I see. Thank you!@DavidCarlisle
    – Stephen
    Commented Mar 10 at 11:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .