4

On page 69 of The TeXbook, there is a figure: enter image description here

On page 70 of The TeXbook, is says

Glue will never shrink more than its stated shrinkability. For example, the first glob of glue in our illustration will never be allowed to become narrower than 8 units wide, and TEX will never shrink the given horizontal list to make its total width less than 49 units.

How does the author calculate the shrink limits here?

11
  • 1
    Just the normal width minus the shrink Commented Jan 3, 2024 at 8:28
  • @Stephen How do you know this? Commented Jan 3, 2024 at 8:29
  • I think the statement in the book is clear. Where are you stuck? Commented Jan 3, 2024 at 8:31
  • 1
    This graph is just for illustration. See page 71 on how to specify glue. Commented Jan 3, 2024 at 9:32
  • 2
    You have to understand that some of what is written in the non-dangerous parts is not quite true, and the gory truth is revealed only in the dangerous parts. (There's a reason why one of the exercises at the end is ‘find all of the lies’.) But as long as you keep that in mind, it's usually easier to understand the non-dangerous parts first. You can always go back and read the dangerous parts later. (You do need to read them eventually if you want to really understand everything.) Commented Jan 4, 2024 at 4:20

4 Answers 4

8

shrink is specified in units, if you go \setlength\baselineskip{15pt minus 2pt} then the shrink is 2pt and the minimum size is 13pt It can also be infinite fil, fill or filll units so \vss for example is short for \vskip 0pt plus 1fil minus 1fil

4

Here is an example:

\def\ruleA{\vrule height1pt width45pt depth0pt} \def\ruleB{\vrule height1pt width30pt depth0pt} \noindent \vrule height1pt width100pt depth0pt\par \hbox to 100pt{\ruleA\hskip 20pt plus 4pt minus 15pt\ruleA} % case 1 \hbox to 100pt{\ruleA\hskip 20pt plus 4pt minus 10pt\ruleA} % case 2 \hbox to 100pt{\ruleA\hskip 20pt plus 4pt minus 3pt \ruleA} % case 3 \hbox to 100pt{\ruleB\hskip 20pt plus 4pt minus 3pt \ruleB} % case 4 \bye 

enter image description here

I have defined two rules (one width 45pt and the other 30pt). And I put the rules together with a glue in an horizontal box of width 100pt.

  • In cases 1-3, the total width of two rules is 90pt, so the glue should shrink 10pt since its natural width is 20pt.

    • Case 1 and case 2 can do that because their shrinkability are 15pt, 10pt respectively. But
    • Case 3 not, the minimum width of the glue is 20pt-3pt = 17pt (so an warning Overfull \hbox (7.0pt too wide) detected at line 7 is raised.)
  • In case 4, the glue is 20pt plus 4pt minus 3pt, which does not mean that the maximum width of the glue is 24pt. In fact, glue is allowed to stretch arbitrarily far, whenever it has a positive stretch component. And as you can see in the screenshot, the width of the last glue is 100pt-30pt*2 = 40pt (stretch amount is 20pt > 4pt). And this case gives an Underfull \hbox (badness 10000) warning.

3

The first glob of glue is space 9 stretch 3 shrink 1, so the narrowest that it can get is 9 − 1 = 8. (You might think that the widest is 9 + 3 = 12, but the text on page 70 immediately after the part that you quoted explains that this is not actually true and it can stretch wider.)

Adding up all of the widths and spaces, we get 5 + 9 + 6 + 9 + 3 + 12 + 8 = 52 as the natural width; but if we include the shrinks as well, then we get 5 + (9 − 1) + 6 + (9 − 2) + 3 + (12 − 0) + 8 = 49 as the narrowest that it can get.

So that is how 52, 8, and 49 are calculated. (The other numbers are just pulled out of a hat.)

2

enter image description here

The code below, can give you a visualization of what is happening. It is instructive to think of glue as springs, that can expand or shrink to arrange a set of boxes in other boxes. In the diagram below they are represented by the white spaces. YOu can observe that when the line width is 35mm and TeX is building a paragraph box4 is dropped down onto a second line. At 49mm it just fits. The figure is rendered by inserting the boxes in a tabular. Experiment with changing the values. To calculate manually all the glues add the positive together and the negative together, to obtain the stretchability or shrinkability.

\documentclass{article} \usepackage{array,xcolor} \fboxsep=0pt\fboxrule=0pt \NewDocumentCommand\Fbox{m m} { \colorbox{cyan}{\hbox to#1{box$_#2$\strut}} } \parindent0pt \setlength\arraycolsep{0pt} \long\def\maketable#1{\par\leavevmode \begin{tabular}{l|@{}p{#1}@{}|@{}} #1 &\Fbox{14mm}{1}\hskip\skipa \Fbox{15mm}{2}\hskip\skipb \Fbox{8mm}{3}\hskip \skipc \Fbox{8mm}{4} \end{tabular} \smallskip } % set the skips \newskip \skipa \newskip \skipb \newskip \skipc \skipa=0mm plus 3mm minus 1mm \skipb=0mm plus6mm minus 2mm \skipc=0mm plus0mm minus 0mm \begin{document} %make the tables \maketable{35mm} \maketable{49mm} \maketable{52mm} \maketable{55mm} \end{document} 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.