-
Notifications
You must be signed in to change notification settings - Fork 18
/
chapter08.tex
1595 lines (1476 loc) · 60 KB
/
chapter08.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% -*- coding: utf-8 -*-
\documentclass{book}
\input{preamble}
\setcounter{chapter}{7}
\begin{document}
%\chapter{Dimensions and Glue}\label{glue}
\chapter{Dimensions and Glue}\label{glue}
%In \TeX\ vertical and horizontal white space
%can have a possibility to adjust itself through `stretching' or
%`shrinking'. An~adjustable white space is called \indexterm{glue}.
%This chapter treats all technical concepts related to
%dimensions and glue, and it explains how the badness of stretching or shrinking
%a certain amount is calculated.
In \TeX\ vertical and horizontal white space
can have a possibility to adjust itself through `stretching' or
`shrinking'. An~adjustable white space is called \indexterm{glue}.
This chapter treats all technical concepts related to
dimensions and glue, and it explains how the badness of stretching or shrinking
a certain amount is calculated.
%\label{cschap:dimen}\label{cschap:dimendef}\label{cschap:newdimen}\label{cschap:skip}\label{cschap:skipdef}\label{cschap:newskip}\label{cschap:hskip}\label{cschap:hfil}\label{cschap:hfilneg}\label{cschap:hfill}\label{cschap:hss}\label{cschap:vskip}\label{cschap:vfil}\label{cschap:vfill}\label{cschap:vfilneg}\label{cschap:vss}\label{cschap:kern}\label{cschap:lastkern}\label{cschap:lastskip}\label{cschap:unkern}\label{cschap:unskip}\label{cschap:removelastskip}\label{cschap:advance2}\label{cschap:multiply2}\label{cschap:divide2}
%\begin{inventory}
%\item [\cs{dimen}]
% Dimension register prefix.
\label{cschap:dimen}\label{cschap:dimendef}\label{cschap:newdimen}\label{cschap:skip}\label{cschap:skipdef}\label{cschap:newskip}\label{cschap:hskip}\label{cschap:hfil}\label{cschap:hfilneg}\label{cschap:hfill}\label{cschap:hss}\label{cschap:vskip}\label{cschap:vfil}\label{cschap:vfill}\label{cschap:vfilneg}\label{cschap:vss}\label{cschap:kern}\label{cschap:lastkern}\label{cschap:lastskip}\label{cschap:unkern}\label{cschap:unskip}\label{cschap:removelastskip}\label{cschap:advance2}\label{cschap:multiply2}\label{cschap:divide2}
\begin{inventory}
\item [\cs{dimen}]
Dimension register prefix.
%\item [\cs{dimendef}]
% Define a control sequence to be a synonym for
% a~\cs{dimen} register.
\item [\cs{dimendef}]
Define a control sequence to be a synonym for
a~\cs{dimen} register.
%\item [\cs{newdimen}]
% Allocate an unused dimen register.
\item [\cs{newdimen}]
Allocate an unused dimen register.
%\item [\cs{skip}]
% Skip register prefix.
\item [\cs{skip}]
Skip register prefix.
%\item [\cs{skipdef}]
% Define a control sequence to be a synonym for
% a~\cs{skip} register.
\item [\cs{skipdef}]
Define a control sequence to be a synonym for
a~\cs{skip} register.
%\item [\cs{newskip}]
% Allocate an unused skip register.
\item [\cs{newskip}]
Allocate an unused skip register.
%\item [\cs{ifdim}]
% Compare two dimensions.
\item [\cs{ifdim}]
Compare two dimensions.
%\item [\cs{hskip}]
% Insert in horizontal mode a glue item.
\item [\cs{hskip}]
Insert in horizontal mode a glue item.
%\item [\csidx{hfil}]
% Equivalent to
% \verb-\hskip 0cm plus 1fil-.
\item [\csidx{hfil}]
Equivalent to
\verb-\hskip 0cm plus 1fil-.
%\item [\csidx{hfilneg}]
% Equivalent to
% \verb-\hskip 0cm minus 1fil-.
\item [\csidx{hfilneg}]
Equivalent to
\verb-\hskip 0cm minus 1fil-.
%\item [\csidx{hfill}]
% Equivalent to
% \verb-\hskip 0cm plus 1fill-.
\item [\csidx{hfill}]
Equivalent to
\verb-\hskip 0cm plus 1fill-.
%\item [\csidx{hss}]
% Equivalent to
% \verb-\hskip 0cm plus 1fil minus 1fil-.
\item [\csidx{hss}]
Equivalent to
\verb-\hskip 0cm plus 1fil minus 1fil-.
%\item [\cs{vskip}]
% Insert in vertical mode a glue item.
\item [\cs{vskip}]
Insert in vertical mode a glue item.
%\item [\csidx{vfil}]
% Equivalent to
% \verb-\vskip 0cm plus 1fil-.
\item [\csidx{vfil}]
Equivalent to
\verb-\vskip 0cm plus 1fil-.
%\item [\csidx{vfill}]
% Equivalent to
% \verb-\vskip 0cm plus 1fill-.
\item [\csidx{vfill}]
Equivalent to
\verb-\vskip 0cm plus 1fill-.
%\item [\csidx{vfilneg}]
% Equivalent to
% \verb-\vskip 0cm minus 1fil-.
\item [\csidx{vfilneg}]
Equivalent to
\verb-\vskip 0cm minus 1fil-.
%\item [\csidx{vss}]
% Equivalent to
% \verb-\vskip 0cm plus 1fil minus 1fil-.
\item [\csidx{vss}]
Equivalent to
\verb-\vskip 0cm plus 1fil minus 1fil-.
%\item [\cs{kern}]
% Add a kern item to the current horizontal or vertical list.
\item [\cs{kern}]
Add a kern item to the current horizontal or vertical list.
%\item [\cs{lastkern}]
% If the last item on the current list was a kern, the size of it.
\item [\cs{lastkern}]
If the last item on the current list was a kern, the size of it.
%\item [\cs{lastskip}]
% If the last item on the current list was a~glue, the size of it.
\item [\cs{lastskip}]
If the last item on the current list was a~glue, the size of it.
%\item [\cs{unkern}]
% If the last item of the current list was a~kern, remove it.
\item [\cs{unkern}]
If the last item of the current list was a~kern, remove it.
%\item [\cs{unskip}]
% If the last item of the current list was a~glue, remove it.
\item [\cs{unskip}]
If the last item of the current list was a~glue, remove it.
%\item [\cs{removelastskip}]
% Macro to append the negative of the \cs{lastskip}.
\item [\cs{removelastskip}]
Macro to append the negative of the \cs{lastskip}.
%\item [\cs{advance}]
% Arithmetic command to add to or subtract from
% a~\gr{numeric variable}.
\item [\cs{advance}]
Arithmetic command to add to or subtract from
a~\gr{numeric variable}.
%\item [\cs{multiply}]
% Arithmetic command to multiply a~\gr{numeric variable}.
\item [\cs{multiply}]
Arithmetic command to multiply a~\gr{numeric variable}.
%\item [\cs{divide}]
% Arithmetic command to divide a~\gr{numeric variable}.
\item [\cs{divide}]
Arithmetic command to divide a~\gr{numeric variable}.
%\end{inventory}
\end{inventory}
%%\point Definition of \gr{glue} and \gr{dimen}
%\section{Definition of \gr{glue} and \gr{dimen}}
%\point Definition of \gr{glue} and \gr{dimen}
\section{Definition of \gr{glue} and \gr{dimen}}
%This section gives
%the syntax of the quantities
%\gr{dimen} and \gr{glue}.
%In the next section the practical aspects of glue are treated.
This section gives
the syntax of the quantities
\gr{dimen} and \gr{glue}.
In the next section the practical aspects of glue are treated.
%Unfortunately the terminology for glue is slightly confusing.
%The syntactical quantity~\gr{glue} is a dimension (a distance) with
%\mdqon
%possibly a stretch and/""or shrink component.
%\mdqoff
%In order to add a glob of `glue' (a white space) to a list one has to
%let a \gr{glue} be preceded by commands such as \cs{vskip}.
Unfortunately the terminology for glue is slightly confusing.
The syntactical quantity~\gr{glue} is a dimension (a distance) with
\mdqon
possibly a stretch and/""or shrink component.
\mdqoff
In order to add a glob of `glue' (a white space) to a list one has to
let a \gr{glue} be preceded by commands such as \cs{vskip}.
%%\spoint Definition of dimensions
%\subsection{Definition of dimensions}
%\spoint Definition of dimensions
\subsection{Definition of dimensions}
%A~\gr{dimen} is what \TeX\ expects to see when
%it needs to indicate a dimension; it can be positive or negative.
%\begin{disp}\gr{dimen} $\longrightarrow$ \gr{optional signs}%
% \gr{unsigned dimen}\end{disp}
%The unsigned part of a \gr{dimen} can be
%\begin{disp}\gr{unsigned dimen} $\longrightarrow$ \gr{normal dimen}
% $|$ \gr{coerced dimen}\nl
% \gr{normal dimen} $\longrightarrow$ \gr{internal dimen}
% $|$ \gr{factor}\gr{unit of measure}\nl
% \gr{coerced dimen} $\longrightarrow$ \gr{internal glue}
% \end{disp}
%That is, we have the following three cases:
%\begin{itemize} \item an \gr{internal dimen}; this is
% any register or parameter of \TeX\ that has a \gr{dimen} value:
% \begin{disp}\PopIndentLevel\gr{internal dimen} $\longrightarrow$
% \gr{dimen parameter}\nl
% \indent $|$ \gr{special dimen} $|$ \cs{lastkern}\nl
% \indent $|$ \gr{dimendef token} $|$ \cs{dimen}\gr{8-bit number}\nl
% \indent $|$ \cs{fontdimen}\gr{number}\gr{font}\nl
% \indent $|$ \gr{box dimension}\gr{8-bit number}\nl
% \gr{dimen parameter} $\longrightarrow$ \cs{boxmaxdepth}\nl
% \indent $|$ \cs{delimitershortfall} $|$ \cs{displayindent}\nl
% \indent $|$ \cs{displaywidth} $|$ \cs{hangindent}\nl
% \indent $|$ \cs{hfuzz} $|$ \cs{hoffset} $|$ \cs{hsize}\nl
% \indent $|$ \cs{lineskiplimit} $|$ \cs{mathsurround}\nl
% \indent $|$ \cs{maxdepth} $|$ \cs{nulldelimiterspace}\nl
% \indent $|$ \cs{overfullrule} $|$ \cs{parindent}\nl
% \indent $|$ \cs{predisplaysize} $|$ \cs{scriptspace}\nl
% \indent $|$ \cs{splitmaxdepth} $|$ \cs{vfuzz}\nl
% \indent $|$ \cs{voffset} $|$ \cs{vsize}
% \end{disp}
%\item a dimension denotation,
% consisting of \gr{factor}\gr{unit of measure},
% for example \verb>0.7\vsize>; or
%\item an \gr{internal glue} (see below)
% coerced to a dimension by omitting
% the stretch and shrink components, for example \cs{parfillskip}.
%\end{itemize}
A~\gr{dimen} is what \TeX\ expects to see when
it needs to indicate a dimension; it can be positive or negative.
\begin{disp}\gr{dimen} $\longrightarrow$ \gr{optional signs}%
\gr{unsigned dimen}\end{disp}
The unsigned part of a \gr{dimen} can be
\begin{disp}\gr{unsigned dimen} $\longrightarrow$ \gr{normal dimen}
$|$ \gr{coerced dimen}\nl
\gr{normal dimen} $\longrightarrow$ \gr{internal dimen}
$|$ \gr{factor}\gr{unit of measure}\nl
\gr{coerced dimen} $\longrightarrow$ \gr{internal glue}
\end{disp}
That is, we have the following three cases:
\begin{itemize} \item an \gr{internal dimen}; this is
any register or parameter of \TeX\ that has a \gr{dimen} value:
\begin{disp}\PopIndentLevel\gr{internal dimen} $\longrightarrow$
\gr{dimen parameter}\nl
\indent $|$ \gr{special dimen} $|$ \cs{lastkern}\nl
\indent $|$ \gr{dimendef token} $|$ \cs{dimen}\gr{8-bit number}\nl
\indent $|$ \cs{fontdimen}\gr{number}\gr{font}\nl
\indent $|$ \gr{box dimension}\gr{8-bit number}\nl
\gr{dimen parameter} $\longrightarrow$ \cs{boxmaxdepth}\nl
\indent $|$ \cs{delimitershortfall} $|$ \cs{displayindent}\nl
\indent $|$ \cs{displaywidth} $|$ \cs{hangindent}\nl
\indent $|$ \cs{hfuzz} $|$ \cs{hoffset} $|$ \cs{hsize}\nl
\indent $|$ \cs{lineskiplimit} $|$ \cs{mathsurround}\nl
\indent $|$ \cs{maxdepth} $|$ \cs{nulldelimiterspace}\nl
\indent $|$ \cs{overfullrule} $|$ \cs{parindent}\nl
\indent $|$ \cs{predisplaysize} $|$ \cs{scriptspace}\nl
\indent $|$ \cs{splitmaxdepth} $|$ \cs{vfuzz}\nl
\indent $|$ \cs{voffset} $|$ \cs{vsize}
\end{disp}
\item a dimension denotation,
consisting of \gr{factor}\gr{unit of measure},
for example \verb>0.7\vsize>; or
\item an \gr{internal glue} (see below)
coerced to a dimension by omitting
the stretch and shrink components, for example \cs{parfillskip}.
\end{itemize}
%A dimension denotation is a somewhat complicated entity:
%\begin{itemize} \item a \gr{factor} is an integer denotation,
% a decimal constant denotation (a number with an integral and
% a fractional part),
% or an \gr{internal integer}
% \begin{disp}\PopIndentLevel
% \gr{factor} $\longrightarrow$ \gr{normal integer}
% $|$ \gr{decimal constant}\nl
% \gr{normal integer} $\longrightarrow$ \gr{integer denotation}\nl
% \indent $|$ \gr{internal integer}\nl
% \gr{decimal constant} $\longrightarrow$ \n{.$_{12}$}
% $|$ \n{,$_{12}$}\nl
% \indent $|$ \gr{digit}\gr{decimal constant}\nl
% \indent $|$ \gr{decimal constant}\gr{digit}
% \end{disp}
% An internal integer is a parameter that is `really' an
%\alt
% integer (for instance, \cs{count0}), and not coerced from a dimension or glue.
% See Chapter~\ref{number}
% for the definition of various kinds of integers.
%\item a \gr{unit of measure} can be
% a \gr{physical unit}, that is, an ordinary unit such as~\n{cm}
% (possibly preceded by \n{true}),
% an internal unit such as~\n{em}, but also an \gr{internal integer}
% (by conversion to scaled points),
% an \gr{internal dimen}, or an \gr{internal glue}.
% \begin{disp}\PopIndentLevel
% \gr{unit of measure} $\longrightarrow$
% \gr{optional spaces}\gr{internal unit}\nl
% \indent $|$
% \gr{optional \n{true}}\gr{physical unit}\gr{one optional space}\nl
% \gr{internal unit} $\longrightarrow$
% \n{em}\gr{one optional space}\nl
% \indent $|$ \n{ex}\gr{one optional space}
% $|$ \gr{internal integer}\nl
% \indent $|$ \gr{internal dimen} $|$ \gr{internal glue}
% \end{disp}
%\end{itemize}
A dimension denotation is a somewhat complicated entity:
\begin{itemize} \item a \gr{factor} is an integer denotation,
a decimal constant denotation (a number with an integral and
a fractional part),
or an \gr{internal integer}
\begin{disp}\PopIndentLevel
\gr{factor} $\longrightarrow$ \gr{normal integer}
$|$ \gr{decimal constant}\nl
\gr{normal integer} $\longrightarrow$ \gr{integer denotation}\nl
\indent $|$ \gr{internal integer}\nl
\gr{decimal constant} $\longrightarrow$ \n{.$_{12}$}
$|$ \n{,$_{12}$}\nl
\indent $|$ \gr{digit}\gr{decimal constant}\nl
\indent $|$ \gr{decimal constant}\gr{digit}
\end{disp}
An internal integer is a parameter that is `really' an
\alt
integer (for instance, \cs{count0}), and not coerced from a dimension or glue.
See Chapter~\ref{number}
for the definition of various kinds of integers.
\item a \gr{unit of measure} can be
a \gr{physical unit}, that is, an ordinary unit such as~\n{cm}
(possibly preceded by \n{true}),
an internal unit such as~\n{em}, but also an \gr{internal integer}
(by conversion to scaled points),
an \gr{internal dimen}, or an \gr{internal glue}.
\begin{disp}\PopIndentLevel
\gr{unit of measure} $\longrightarrow$
\gr{optional spaces}\gr{internal unit}\nl
\indent $|$
\gr{optional \n{true}}\gr{physical unit}\gr{one optional space}\nl
\gr{internal unit} $\longrightarrow$
\n{em}\gr{one optional space}\nl
\indent $|$ \n{ex}\gr{one optional space}
$|$ \gr{internal integer}\nl
\indent $|$ \gr{internal dimen} $|$ \gr{internal glue}
\end{disp}
\end{itemize}
%Some \gr{dimen}s are called \gr{special dimen}s:\label{special:dimen:list}
%\begin{disp}\gr{special dimen} $\longrightarrow$ \cs{prevdepth}\nl
% \indent $|$ \cs{pagegoal} $|$ \cs{pagetotal} $|$ \cs{pagestretch}\nl
% \indent $|$ \cs{pagefilstretch} $|$ \cs{pagefillstretch}\nl
% \indent $|$ \cs{pagefilllstretch} $|$ \cs{pageshrink} $|$ \cs{pagedepth}
% \end{disp}
%An assignment to any of these is
%called an \gr{intimate assignment}, and it is automatically
%global (see Chapter~\ref{group}). The meaning of these
%dimensions is explained in Chapter \ref{page:break}, with the
%exception of \cs{prevdepth} which is treated in
%Chapter~\ref{baseline}.
Some \gr{dimen}s are called \gr{special dimen}s:\label{special:dimen:list}
\begin{disp}\gr{special dimen} $\longrightarrow$ \cs{prevdepth}\nl
\indent $|$ \cs{pagegoal} $|$ \cs{pagetotal} $|$ \cs{pagestretch}\nl
\indent $|$ \cs{pagefilstretch} $|$ \cs{pagefillstretch}\nl
\indent $|$ \cs{pagefilllstretch} $|$ \cs{pageshrink} $|$ \cs{pagedepth}
\end{disp}
An assignment to any of these is
called an \gr{intimate assignment}, and it is automatically
global (see Chapter~\ref{group}). The meaning of these
dimensions is explained in Chapter \ref{page:break}, with the
exception of \cs{prevdepth} which is treated in
Chapter~\ref{baseline}.
%%\spoint Definition of glue
%\subsection{Definition of glue}
%\spoint Definition of glue
\subsection{Definition of glue}
%A \gr{glue} is either some form of glue variable, or
%a glue denotation with explicitly indicated stretch and
%shrink. Specifically,
%\begin{disp}\gr{glue} $\longrightarrow$ \gr{optional signs}\gr{internal glue}
% $|$ \gr{dimen}\gr{stretch}\gr{shrink}\nl
% \gr{internal glue} $\longrightarrow$ \gr{glue parameter}
% $|$ \cs{lastskip}\nl
% \indent $|$ \gr{skipdef token} $|$ \cs{skip}\gr{8-bit number}\nl
% \gr{glue parameter} $\longrightarrow$ \cs{abovedisplayshortskip}\nl
% \indent $|$ \cs{abovedisplayskip} $|$ \cs{baselineskip}\nl
% \indent $|$ \cs{belowdisplayshortskip} $|$ \cs{belowdisplayskip}\nl
% \indent $|$ \cs{leftskip} $|$ \cs{lineskip} $|$ \cs{parfillskip}
% $|$ \cs{parskip}\nl
% \indent $|$ \cs{rightskip} $|$ \cs{spaceskip}
% $|$ \cs{splittopskip} $|$ \cs{tabskip}\nl
% \indent $|$ \cs{topskip} $|$ \cs{xspaceskip}
%\end{disp}
%The stretch and shrink components in a glue denotation
%are optional, but when both are specified they have to
%be given in sequence; they are defined as
%\begin{disp}
%\gr{stretch} $\longrightarrow$ \n{plus} \gr{dimen}
% $|$ \n{plus}\gr{fil dimen} $|$ \gr{optional spaces}\nl
%\gr{shrink} $\longrightarrow$ \n{minus} \gr{dimen}
% $|$ \n{minus}\gr{fil dimen} $|$ \gr{optional spaces}\nl
%\gr{fil dimen} $\longrightarrow$ \gr{optional signs}\gr{factor}%
% \gr{fil unit}\gr{optional spaces}\nl
%\gr{fil unit} $\longrightarrow$ \n{ $|$ fil $|$ fill $|$ filll}
%\end{disp}
A \gr{glue} is either some form of glue variable, or
a glue denotation with explicitly indicated stretch and
shrink. Specifically,
\begin{disp}\gr{glue} $\longrightarrow$ \gr{optional signs}\gr{internal glue}
$|$ \gr{dimen}\gr{stretch}\gr{shrink}\nl
\gr{internal glue} $\longrightarrow$ \gr{glue parameter}
$|$ \cs{lastskip}\nl
\indent $|$ \gr{skipdef token} $|$ \cs{skip}\gr{8-bit number}\nl
\gr{glue parameter} $\longrightarrow$ \cs{abovedisplayshortskip}\nl
\indent $|$ \cs{abovedisplayskip} $|$ \cs{baselineskip}\nl
\indent $|$ \cs{belowdisplayshortskip} $|$ \cs{belowdisplayskip}\nl
\indent $|$ \cs{leftskip} $|$ \cs{lineskip} $|$ \cs{parfillskip}
$|$ \cs{parskip}\nl
\indent $|$ \cs{rightskip} $|$ \cs{spaceskip}
$|$ \cs{splittopskip} $|$ \cs{tabskip}\nl
\indent $|$ \cs{topskip} $|$ \cs{xspaceskip}
\end{disp}
The stretch and shrink components in a glue denotation
are optional, but when both are specified they have to
be given in sequence; they are defined as
\begin{disp}
\gr{stretch} $\longrightarrow$ \n{plus} \gr{dimen}
$|$ \n{plus}\gr{fil dimen} $|$ \gr{optional spaces}\nl
\gr{shrink} $\longrightarrow$ \n{minus} \gr{dimen}
$|$ \n{minus}\gr{fil dimen} $|$ \gr{optional spaces}\nl
\gr{fil dimen} $\longrightarrow$ \gr{optional signs}\gr{factor}%
\gr{fil unit}\gr{optional spaces}\nl
\gr{fil unit} $\longrightarrow$ \n{ $|$ fil $|$ fill $|$ filll}
\end{disp}
%The actual definition of \gr{fil unit} is recursive
%(see Chapter~\ref{gramm}), but these are the only valid
%possibilities.
The actual definition of \gr{fil unit} is recursive
(see Chapter~\ref{gramm}), but these are the only valid
possibilities.
%%\spoint Conversion of \gr{glue} to \gr{dimen}
%\subsection{Conversion of \gr{glue} to \gr{dimen}}
%\spoint Conversion of \gr{glue} to \gr{dimen}
\subsection{Conversion of \gr{glue} to \gr{dimen}}
%The grammar rule
%\begin{disp}\gr{dimen} $\longrightarrow$
% \gr{factor}\gr{unit of measure}
%\end{disp}
%has some noteworthy consequences, caused by the fact
%that a \gr{unit of measure} need not look like a `unit of measure'
%at all (see the list above).
The grammar rule
\begin{disp}\gr{dimen} $\longrightarrow$
\gr{factor}\gr{unit of measure}
\end{disp}
has some noteworthy consequences, caused by the fact
that a \gr{unit of measure} need not look like a `unit of measure'
at all (see the list above).
%For instance, from this definition we conclude that the statement
%\begin{verbatim}
%\dimen0=\lastpenalty\lastpenalty
%\end{verbatim}
%is
%syntactically correct because \cs{lastpenalty} can function
%both as an integer and as \gr{unit of measure} by taking
%its value in scaled points.
%After \verb>\penalty8> the \cs{dimen0} thus defined will
%have a size of~\n{64sp}.
For instance, from this definition we conclude that the statement
\begin{verbatim}
\dimen0=\lastpenalty\lastpenalty
\end{verbatim}
is
syntactically correct because \cs{lastpenalty} can function
both as an integer and as \gr{unit of measure} by taking
its value in scaled points.
After \verb>\penalty8> the \cs{dimen0} thus defined will
have a size of~\n{64sp}.
%More importantly, consider the case where the \gr{unit of measure} is
%an \gr{internal glue}, that is, any sort of glue parameter.
%Prefixing such a glue with a number (the \gr{factor})
%makes it a valid \gr{dimen} specification.
%Thus
%\begin{verbatim}
%\skip0=\skip1
%\end{verbatim}
%is very different
%from
%\begin{verbatim}
%\skip0=1\skip1
%\end{verbatim}
%The first statement makes
%\cs{skip0} equal to \cs{skip1}, the second converts
%the \cs{skip1} to a \gr{dimen} before assigning it.
%In other words, the \cs{skip0} defined by the second statement
%has no stretch or shrink.
More importantly, consider the case where the \gr{unit of measure} is
an \gr{internal glue}, that is, any sort of glue parameter.
Prefixing such a glue with a number (the \gr{factor})
makes it a valid \gr{dimen} specification.
Thus
\begin{verbatim}
\skip0=\skip1
\end{verbatim}
is very different
from
\begin{verbatim}
\skip0=1\skip1
\end{verbatim}
The first statement makes
\cs{skip0} equal to \cs{skip1}, the second converts
the \cs{skip1} to a \gr{dimen} before assigning it.
In other words, the \cs{skip0} defined by the second statement
has no stretch or shrink.
%%\spoint Registers for \cs{dimen} and \cs{skip}
%\subsection{Registers for \cs{dimen} and \cs{skip}}
%\spoint Registers for \cs{dimen} and \cs{skip}
\subsection{Registers for \cs{dimen} and \cs{skip}}
%\TeX\ has registers for storing \gr{dimen} and \gr{glue}
%values: the \csidx{dimen} and \csidx{skip} registers
%respectively. These are accessible by the expressions
%\begin{disp}\cs{dimen}\gr{number}\end{disp} and
%\begin{disp}\cs{skip}\gr{number}\end{disp}
%As with all registers of \TeX, these registers are
%numbered~0--255.
\TeX\ has registers for storing \gr{dimen} and \gr{glue}
values: the \csidx{dimen} and \csidx{skip} registers
respectively. These are accessible by the expressions
\begin{disp}\cs{dimen}\gr{number}\end{disp} and
\begin{disp}\cs{skip}\gr{number}\end{disp}
As with all registers of \TeX, these registers are
numbered~0--255.
%Synonyms for registers can be made with the \csidx{dimendef} and
%\csidx{skipdef} commands. Their syntax is
%\begin{Disp}\cs{dimendef}\gr{control sequence}\gr{equals}\gr{8-bit number}
%\end{Disp}
%and
%\begin{Disp}\cs{skipdef}\gr{control sequence}\gr{equals}\gr{8-bit number}\end{Disp}
%For example, after \verb-\skipdef\foo=13- using \cs{foo}
%is equivalent to using \cs{skip13}.
Synonyms for registers can be made with the \csidx{dimendef} and
\csidx{skipdef} commands. Their syntax is
\begin{Disp}\cs{dimendef}\gr{control sequence}\gr{equals}\gr{8-bit number}
\end{Disp}
and
\begin{Disp}\cs{skipdef}\gr{control sequence}\gr{equals}\gr{8-bit number}\end{Disp}
For example, after \verb-\skipdef\foo=13- using \cs{foo}
is equivalent to using \cs{skip13}.
%Macros \csidx{newdimen} and \csidx{newskip} exist in plain \TeX
%for allocating an unused dimen or skip register.
%These macros are defined to be \cs{outer} in the plain format.
Macros \csidx{newdimen} and \csidx{newskip} exist in plain \TeX
for allocating an unused dimen or skip register.
These macros are defined to be \cs{outer} in the plain format.
%\subsection{Arithmetic: addition}
\subsection{Arithmetic: addition}
%As for integer variables, arithmetic operations exist for
%\cstoidx advance\par
%\indextermbus{arithmetic on}{glue}\index{arithmetic! on glue|see{glue, arithmetic on}}:
%dimen, glue, and muglue (mathematical glue; see page~\pageref{muglue})
%variables.
As for integer variables, arithmetic operations exist for
\cstoidx advance\par
\indextermbus{arithmetic on}{glue}\index{arithmetic! on glue|see{glue, arithmetic on}}:
dimen, glue, and muglue (mathematical glue; see page~\pageref{muglue})
variables.
%The expressions
%\begin{Disp}\cs{advance}\gr{dimen variable}\gr{optional \n{by}}%
% \gr{dimen}\nl
% \cs{advance}\gr{glue variable}\gr{optional \n{by}}%
% \gr{glue}\nl
% \cs{advance}\gr{muglue variable}\gr{optional \n{by}}%
% \gr{muglue}\end{Disp}
%add to the size of a dimen, glue, or muglue.
The expressions
\begin{Disp}\cs{advance}\gr{dimen variable}\gr{optional \n{by}}%
\gr{dimen}\nl
\cs{advance}\gr{glue variable}\gr{optional \n{by}}%
\gr{glue}\nl
\cs{advance}\gr{muglue variable}\gr{optional \n{by}}%
\gr{muglue}\end{Disp}
add to the size of a dimen, glue, or muglue.
%Advancing a \gr{glue variable} by \gr{glue} is done by
%adding the natural sizes, and the stretch and shrink components.
%Because \TeX\ converts between \gr{glue} and \gr{dimen},
%it is possible to write for instance
%\begin{verbatim}
%\advance\skip1 by \dimen1
%\end{verbatim}
%or
%\begin{verbatim}
%\advance\dimen1 by \skip1
%\end{verbatim}
%In the first case \cs{dimen1} is coerced to \gr{glue} without
%stretch or shrink; in the second case the \cs{skip1} is coerced
%to a \gr{dimen} by taking its natural size.
Advancing a \gr{glue variable} by \gr{glue} is done by
adding the natural sizes, and the stretch and shrink components.
Because \TeX\ converts between \gr{glue} and \gr{dimen},
it is possible to write for instance
\begin{verbatim}
\advance\skip1 by \dimen1
\end{verbatim}
or
\begin{verbatim}
\advance\dimen1 by \skip1
\end{verbatim}
In the first case \cs{dimen1} is coerced to \gr{glue} without
stretch or shrink; in the second case the \cs{skip1} is coerced
to a \gr{dimen} by taking its natural size.
%%\spoint Arithmetic: multiplication and division
%\subsection{Arithmetic: multiplication and division}
%\spoint Arithmetic: multiplication and division
\subsection{Arithmetic: multiplication and division}
%Multiplication and division operations exist for glue
%\cstoidx multiply\par\cstoidx divide\par
%and dimensions. One may for instance write
%\begin{verbatim}
%\multiply\skip1 by 2
%\end{verbatim}
%which multiplies the natural size, and the stretch and shrink
%components of \cs{skip1} by~2.
Multiplication and division operations exist for glue
\cstoidx multiply\par\cstoidx divide\par
and dimensions. One may for instance write
\begin{verbatim}
\multiply\skip1 by 2
\end{verbatim}
which multiplies the natural size, and the stretch and shrink
components of \cs{skip1} by~2.
%The second operand of a \cs{multiply} or \cs{divide}
%operation can only be a \gr{number}, that is, an integer.
%Introducing the notion of \gr{numeric variable}:
%\begin{disp}\gr{numeric variable} $\longrightarrow$ \gr{integer variable}
% $|$ \gr{dimen variable} \nl
% \indent $|$ \gr{glue variable} $|$ \gr{muglue variable}\end{disp}
%these operations take the form
%\begin{Disp}\cs{multiply}\gr{numeric variable}\gr{optional \n{by}}%
%\gr{number}\end{Disp}
%and
%\begin{Disp}\cs{divide}\gr{numeric variable}\gr{optional \n{by}}%
%\gr{number}\end{Disp}
The second operand of a \cs{multiply} or \cs{divide}
operation can only be a \gr{number}, that is, an integer.
Introducing the notion of \gr{numeric variable}:
\begin{disp}\gr{numeric variable} $\longrightarrow$ \gr{integer variable}
$|$ \gr{dimen variable} \nl
\indent $|$ \gr{glue variable} $|$ \gr{muglue variable}\end{disp}
these operations take the form
\begin{Disp}\cs{multiply}\gr{numeric variable}\gr{optional \n{by}}%
\gr{number}\end{Disp}
and
\begin{Disp}\cs{divide}\gr{numeric variable}\gr{optional \n{by}}%
\gr{number}\end{Disp}
%Glue and dimen can be multiplied by
%non-integer quantities:
%\begin{verbatim}
%\skip1=2.5\skip2
%\dimen1=.78\dimen2
%\end{verbatim}
%However, in the first line the \cs{skip2} is first coerced
%to a \gr{dimen} value by omitting its stretch and shrink.
Glue and dimen can be multiplied by
non-integer quantities:
\begin{verbatim}
\skip1=2.5\skip2
\dimen1=.78\dimen2
\end{verbatim}
However, in the first line the \cs{skip2} is first coerced
to a \gr{dimen} value by omitting its stretch and shrink.
%%\point More about dimensions
%\section{More about dimensions}
%\point More about dimensions
\section{More about dimensions}
%%\spoint Units of measurement
%\subsection{Units of measurement}
%\spoint Units of measurement
\subsection{Units of measurement}
%In \TeX\ dimensions can be indicated in the following
%\indexterm{units of measurement}:
%\begin{description}
%\item [centimetre]
% denoted \n{cm} or
%\item [millimetre]
% denoted \n{mm}; these are SI~units ({\italic Syst\`eme International
% d'Unit\'es}, the
% international system of standard units of measurements).
%\item [inch]
%\n{in}; more common in the Anglo-American world.
%One inch is 2.54~centimetres.
%\item [pica]
% denoted \n{pc}; one pica is 12~points.
%\item [point]
% denoted \n{pt}; the common system
%for Anglo-American printers. One inch is 72.27 points.
%\item [didot point]
% denoted \n{dd}; the common system for continental European printers.
% Furthermore, 1157 didot points are 1238~points.
%\item [cicero]
% denoted \n{cc}; one cicero is 12~didot points.
%\item [big point]
% denoted \n{bp}; one inch is 72 big points.
%\item [scaled point]
% denoted \n{sp}; this is the smallest unit in \TeX, and all measurements
% are integral multiples of one scaled point.
% There are $65\,536$ scaled points in a~point.
%\end{description}
In \TeX\ dimensions can be indicated in the following
\indexterm{units of measurement}:
\begin{description}
\item [centimetre]
denoted \n{cm} or
\item [millimetre]
denoted \n{mm}; these are SI~units ({\italic Syst\`eme International
d'Unit\'es}, the
international system of standard units of measurements).
\item [inch]
\n{in}; more common in the Anglo-American world.
One inch is 2.54~centimetres.
\item [pica]
denoted \n{pc}; one pica is 12~points.
\item [point]
denoted \n{pt}; the common system
for Anglo-American printers. One inch is 72.27 points.
\item [didot point]
denoted \n{dd}; the common system for continental European printers.
Furthermore, 1157 didot points are 1238~points.
\item [cicero]
denoted \n{cc}; one cicero is 12~didot points.
\item [big point]
denoted \n{bp}; one inch is 72 big points.
\item [scaled point]
denoted \n{sp}; this is the smallest unit in \TeX, and all measurements
are integral multiples of one scaled point.
There are $65\,536$ scaled points in a~point.
\end{description}
%Decimal fractions can be written using both the
%Anglo-American system with the decimal point
%(for example, \n{1in}=\n{72.27pt})
%and the continental European system with a decimal
%comma; \n{1in}=\n{72,27pt}.
Decimal fractions can be written using both the
Anglo-American system with the decimal point
(for example, \n{1in}=\n{72.27pt})
and the continental European system with a decimal
comma; \n{1in}=\n{72,27pt}.
%Internally \TeX\ works with multiples of a smallest
%dimension: the scaled point.
%Dimensions larger (in absolute value) than $2^{30}-1$\n{sp},
%which is about 5.75~metres or 18.9~feet, are illegal.
Internally \TeX\ works with multiples of a smallest
dimension: the scaled point.
Dimensions larger (in absolute value) than $2^{30}-1$\n{sp},
which is about 5.75~metres or 18.9~feet, are illegal.
%Both the pica system and the didot system are of French
%origin: in 1737 the type founder Pierre Simon Fournier
%introduced typographical points based on the French foot.
%Although at first he introduced a system based on lines and
%points, he later took the point as unit:
%there are 72 points in an inch,
%which is one-twelfth of a foot.
%About 1770 another founder, Fran\c{c}ois Ambroise Didot, introduced
%points based on the more common, and slightly longer,
%`pied du roi'.
Both the pica system and the didot system are of French
origin: in 1737 the type founder Pierre Simon Fournier
introduced typographical points based on the French foot.
Although at first he introduced a system based on lines and
points, he later took the point as unit:
there are 72 points in an inch,
which is one-twelfth of a foot.
About 1770 another founder, Fran\c{c}ois Ambroise Didot, introduced
points based on the more common, and slightly longer,
`pied du roi'.
%%\spoint Dimension testing
%\subsection{Dimension testing}
%\spoint Dimension testing
\subsection{Dimension testing}
%Dimensions and natural sizes of glue can be compared with
%the \cs{ifdim} test. This takes the form
%\begin{disp}\cs{ifdim}\gr{dimen$_1$}\gr{relation}\gr{dimen$_2$}\end{disp}
%where the relation can be an \n>, \n<, or~\n= token,
%all of category~12\index{category!12}.
Dimensions and natural sizes of glue can be compared with
the \cs{ifdim} test. This takes the form
\begin{disp}\cs{ifdim}\gr{dimen$_1$}\gr{relation}\gr{dimen$_2$}\end{disp}
where the relation can be an \n>, \n<, or~\n= token,
all of category~12\index{category!12}.
%%\spoint Defined dimensions
%\subsection{Defined dimensions}
%\spoint Defined dimensions
\subsection{Defined dimensions}
%\begin{inventory}
%\item [\cs{z@}]
% \n{0pt}
\begin{inventory}
\item [\cs{z@}]
\n{0pt}
%\item [\cs{maxdimen}]
% \n{16383.99999pt}; the largest legal dimension.
%\end{inventory}
\item [\cs{maxdimen}]
\n{16383.99999pt}; the largest legal dimension.
\end{inventory}
%These \gr{dimen}s are predefined in the plain format;
%for instance
%\begin{verbatim}
%\newdimen\z@ \z@=0pt
%\end{verbatim}
%Using such abbreviations for commonly used dimensions
%has at least two advantages. First of all it saves main memory
%if such a dimension occurs in a macro: a control sequence
%is one token, whereas a string such as \n{0pt} takes three.
%Secondly, it saves time in processing, as \TeX\ does not need
%to perform conversions to arrive at the correct type of
%object.
These \gr{dimen}s are predefined in the plain format;
for instance
\begin{verbatim}
\newdimen\z@ \z@=0pt
\end{verbatim}
Using such abbreviations for commonly used dimensions
has at least two advantages. First of all it saves main memory
if such a dimension occurs in a macro: a control sequence
is one token, whereas a string such as \n{0pt} takes three.
Secondly, it saves time in processing, as \TeX\ does not need
to perform conversions to arrive at the correct type of
object.
%Control sequences such as \cs{z@}
%are only available to a user who changes the
%category code of the `at' sign. Ordinarily, these control sequences
%appear only in the macros defined in packages such as the
%plain format.
Control sequences such as \cs{z@}
are only available to a user who changes the
category code of the `at' sign. Ordinarily, these control sequences
appear only in the macros defined in packages such as the
plain format.
%%\point More about glue
%\section{More about glue}
%\point More about glue
\section{More about glue}
%Glue items can be added to a vertical list with one of the
%\alt
%commands \csidx{vskip}\gr{glue}, \cs{vfil}, \cs{vfill}, \cs{vss} or
%\cs{vfilneg};
%glue items can be added to a horizontal list with one of the
%commands \csidx{hskip}\gr{glue}, \cs{hfil}, \cs{hfill}, \cs{hss} or
%\cs{hfilneg}. We will now treat the properties of glue.
Glue items can be added to a vertical list with one of the
\alt
commands \csidx{vskip}\gr{glue}, \cs{vfil}, \cs{vfill}, \cs{vss} or
\cs{vfilneg};
glue items can be added to a horizontal list with one of the
commands \csidx{hskip}\gr{glue}, \cs{hfil}, \cs{hfill}, \cs{hss} or
\cs{hfilneg}. We will now treat the properties of glue.
%%\spoint Stretch and shrink
%\subsection{Stretch and shrink}
%\spoint Stretch and shrink
\subsection{Stretch and shrink}
%In the syntax given above, \gr{glue} was defined as having
%\begin{itemize}
%\item a `natural size', which is a \gr{dimen}, and optionally
%\item a \indexterm{stretch} and \indexterm{shrink}
% component\indexterm{stretch}\indexterm{shrink}
% \index{glue!stretch component of}\index{glue!shrink
% component of} built out of a \gr{fil dimen}.
%\end{itemize}
In the syntax given above, \gr{glue} was defined as having
\begin{itemize}
\item a `natural size', which is a \gr{dimen}, and optionally
\item a \indexterm{stretch} and \indexterm{shrink}
component\indexterm{stretch}\indexterm{shrink}
\index{glue!stretch component of}\index{glue!shrink
component of} built out of a \gr{fil dimen}.
\end{itemize}
%Each list that \TeX\ builds has amounts of stretch and shrink
%(possibly zero),
%which are the sum of the
%stretch and shrink components of individual pieces of glue in the list.
%Stretch and shrink are used if the context in which the list
%appears requires it to assume a size that is different from
%its natural size.
Each list that \TeX\ builds has amounts of stretch and shrink
(possibly zero),
which are the sum of the
stretch and shrink components of individual pieces of glue in the list.
Stretch and shrink are used if the context in which the list
appears requires it to assume a size that is different from
its natural size.
%There is an important difference in behaviour between stretch
%and shrink components when they are finite \ldash that is,
%when the \gr{fildimen} is not \n{fil}(\n{l}(\n{l})).
%A~finite amount of shrink is indeed the maximum shrink
%that \TeX\ will take: the amount of glue specified
%as
%\begin{verbatim}
%5pt minus 3pt
%\end{verbatim}
%can shrink to \n{2pt}, but not further.
%In contrast to this, a finite amount of stretch
%can be stretched arbitrarily far.
%Such arbitrary stretching
%has a large `badness', however.
%Badness calculation is treated below.
There is an important difference in behaviour between stretch
and shrink components when they are finite \ldash that is,
when the \gr{fildimen} is not \n{fil}(\n{l}(\n{l})).
A~finite amount of shrink is indeed the maximum shrink
that \TeX\ will take: the amount of glue specified
as
\begin{verbatim}
5pt minus 3pt
\end{verbatim}
can shrink to \n{2pt}, but not further.
In contrast to this, a finite amount of stretch
can be stretched arbitrarily far.
Such arbitrary stretching
has a large `badness', however.
Badness calculation is treated below.
%\begin{example}
%The sequence with natural size \n{20pt}
%\begin{verbatim}
%\hskip 10pt plus 2pt \hskip 10pt plus 3pt
%\end{verbatim}
%has \n{5pt} of stretch, but it has no shrink. In
%\begin{verbatim}
%\hskip 10pt minus 2pt \hskip 10pt plus 3pt
%\end{verbatim}
%there is \n{3pt} of stretch, and \n{2pt} of shrink,
%so its minimal size is~\n{18pt}.
\begin{example}
The sequence with natural size \n{20pt}
\begin{verbatim}