-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathchapter15.tex
executable file
·2026 lines (1922 loc) · 117 KB
/
chapter15.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 -*-
\input macros
%\beginchapter Chapter 15. How \TeX\ Makes\\Lines into Pages
\beginchapter Chapter 15. 组行为页
\origpageno=109
%\tracingpages=1
%\TeX\ attempts to choose desirable places to divide your document into
%individual pages, and its technique for doing this usually works pretty
%well. But the problem of ^{page make-up} is considerably more difficult
%than the problem of line breaking that we considered in the previous chapter,
%because pages often have much less flexibility than lines do. If the
%vertical glue on a page has little or no ability to stretch or to shrink,
%\TeX\ usually has no choice about where to start a new page; conversely, if
%there is too much variability in the glue, the result will look bad because
%different pages will be too irregular. Therefore if you are fussy about the
%appearance of pages, you can expect to do some rewriting of the manuscript
%until you achieve an appropriate balance, or you might need to fiddle
%with the ^|\looseness| as described in Chapter~14; no automated system will
%be able to do this as well as you.
\tracingpages=1
\1\TeX\ 尝试着在适当的位置把文档分为各个页面,
并且其此项技术一般效果很好。%
但是,构建页面的问题比我们前一章讨论的断行问题更难,
因为页面一般比行的伸缩性更小。%
如果一个页面的垂直粘连只有很少或没有伸缩性,
那么 \TeX\ 一般只能按部就班地换页;
反过来,如果粘连上有很多变化,又会因为不同页面之间不一致而使得结果很糟糕。%
因此,如果你对页面的外观比较挑剔,就要做一些修改,直到得到满意的效果为止,
或者可能要用到第十四章讨论过的 |\looseness|;
没有比你更自动的方法来完成此任务了。
%Mathematical papers that contain a lot of displayed equations have an
%advantage in this regard, because the glue that surrounds a display tends to
%be quite flexible. \TeX\ also gets valuable room to maneuver when you
%have occasion to use ^|\smallskip| or ^|\medskip| or ^|\bigskip| spacing
%between certain paragraphs. For example, consider a page that contains
%a dozen or so exercises, and suppose that there is $3\pt$ of additional
%space between exercises, where this space can stretch to $4\pt$ or
%shrink to $2\pt$. Then there is a chance to squeeze an extra line on the page,
%or to open up the page by removing one line, in order to avoid splitting
%an exercise between pages. Similarly, it is possible to use flexible
%glue in special publications like membership rosters or company telephone
%directories, so that individual entries need not be split between columns
%or pages, yet every column appears to be the same height.
有很多陈列公式的数学文章在这方面有优势,
因为陈列公式周围的粘连比较灵活。%
当在某些段落之间使用 |\smallskip|, |\medskip| 或 |\bigskip| 间距时,
\TeX\ 还得到可机动的宝贵空间。%
例如,看看包含大约一打练习的页面,
并且设定练习之间有 $3\pt$ 的额外间距,
其中此间距可伸长 $4\pt$ 或收缩 $2\pt$。%
那么,为了避免把一个练习分在两个页面上,就可以在一个页面上挤出一行或去掉一行。%
类似地,在会员花名册或公司电话簿等特殊出版物中,可以灵活使用粘连,
使得各个单个单位不需要分在两栏或两页上,而且每栏的高度还一致。
%For ordinary purposes you will probably find that \TeX's automatic method
%of page breaking is satisfactory. And when it occasionally gives
%unpleasant results, you can force the machine to break at your favorite
%place by typing `^|\eject|'. But be careful: |\eject| will cause \TeX\ to
%stretch the page out, if necessary, so that the top and bottom baselines
%agree with those on other pages. If you want to eject a short page,
%filling it with blank space at the bottom, type `|\vfill\eject|' instead.
对普通用户而言, \TeX\ 的自动分页方法就满足了。%
并且当所得到的是不好的结果时,可以通过`|\eject|'强制 \TeX\ 在所要求的地方分页。%
但是要注意,如果需要的话,|\eject| 将使 \TeX\ 伸长以充满页\hbox{面,}
使得此页面的底部和顶部基线与其它页面一致。%
如果要 eject 得到一个短的页面,在底部用空白把它充满,就要用`|\vfill\eject|'。
%\danger If you say `|\eject|' in the middle of a paragraph, the paragraph
%will end first, as if you typed `|\par\eject|'. But Chapter~14 mentions
%that you can say `^|\vadjust||{\eject}|' in mid-paragraph, if you want to
%force a page break after whatever line contains your current position
%when the full paragraph is eventually broken up into lines; the rest of the
%paragraph will go on the following page.
\danger 如果在段落中间给出`|\eject|', 段落将首先被结束,就象键入`|\par\eject|'一样。%
但在第十四章提\hbox{到,} 如果要在整个段落断行完毕后在包含当前位置的行后面强制分页,
可以在段落中间使用`|\vadjust||{\eject}|';
此段剩下的行将放在下一页。
%\danger To prevent a page break, you can say `^|\nobreak|' in vertical
%mode, just as |\nobreak| in horizontal mode prevents breaks between lines.
%For example, it is wise to say |\nobreak| between the title of a subsection
%and the first line of text in that subsection. But |\nobreak| does not
%cancel the effect of other commands like |\eject| that tell \TeX\ to
%break; it only inhibits a break at glue that immediately follows. You
%should become familiar with \TeX's rules for line breaks and page breaks
%if you want to maintain fine control over everything. The remainder of
%this chapter is devoted to the intimate details of page breaking.
\danger 为了禁止分页,可以在垂直模式下输入`|\nobreak|',
就象在水平模式下用 |\nobreak| 禁止断行一样。%
例如,在小节的题目和它的第一行文本之间加上 |\nobreak| 是明智之举。%
但是 |\nobreak| 不能抵消掉象 |\eject| 这样的其它分页命令;
它只禁止在后面紧跟的粘连处分页。%
如果要有效地控制所有东西,就必须熟悉 \TeX\ 的断行和分页规则。%
本章剩下的内容就来讨论分页的细节。
%\ninepoint
%\danger \TeX\ breaks lists of lines into pages by computing badness ratings
%and penalties, more or less as it does when breaking paragraphs into lines.
%But pages are made up one at a time and removed from \TeX's memory; there is
%no looking ahead to see how one page break will affect the next one.
%In other words, \TeX\ uses a special method to find the optimum
%breakpoints for the lines in an entire paragraph, but it doesn't attempt
%to find the optimum breakpoints for the pages in an entire document. The
%computer doesn't have enough high-speed memory capacity to remember the
%contents of several pages, so \TeX\ simply chooses each page break as best
%it can, by a process of ``local'' rather than ``global'' optimization.
\ninepoint
\danger \1\TeX\ 通过计算丑度和惩罚把行的列表分页,
这或多或少类似于分段成行。%
但是一次只生成一个页面,并且完成后从 \TeX\ 的内存中要清除掉;
不能往前看看本分页怎样影响前一个页面。%
换句话说, \TeX\ 用一种特殊的方法在一整段中找出行的最佳断点,
但是不能在整个文档中找到页面的最佳断点。%
计算机没有足够的高速内存来存储好几页的内容,
所有 \TeX\ 直接通过一种``局部''方法来尽力选择每个页面得到,
而不是用``整体''优化方法。
%\tracingpages=0
%\danger Let's look now at the details of \TeX's page-making process.
%Everything you contribute to the pages of your document is placed on
%the {\sl ^{main vertical list}}, which is the sequence of items that
%\TeX\ has accumulated while in vertical mode. Each item in a ^{vertical
%list} is one of the following types of things:\enddanger
\tracingpages=0
\danger 现在来看看 \TeX\ 构建页面的细节。%
所有输入到文档页面东西都放在{\KT{10}主垂直列}中,
它是 \TeX\ 在垂直模式下积累起来的项目序列。%
在垂直列中的每个项目是下列某种东西:
\enddanger
%\smallskip
%\item\bull a box (an hbox or vbox or rule);
\smallskip
\item\bull 一个盒子(一个 hbox 或 vbox 或标尺);
%\item\bull a ``^{whatsit}'' (something special to be explained later);
\item\bull 一个``无名''(后面要解释的特殊东西);
%\item\bull a ^{mark} (another thing that will be explained later);
\item\bull 一个标记(后面要解释的另一种东西);
%\item\bull an ^{insertion} (yet another thing that we will get to);
\item\bull 一个插入(仍然是我们将得到的另一种东西);
%\item\bull a glob of ^{glue} (or ^|\leaders|, as we will see later);
\item\bull 一个粘连团(或者 |\leaders|, 我们后面将会看到);
%\item\bull a ^{kern} (something like glue that doesn't stretch or shrink);
\item\bull 一个紧排(象粘连,但不能伸缩);
%\item\bull a ^{penalty} (representing the undesirability of breaking here).
\item\bull 一个惩罚(表示此处分页的不良度)
%\smallskip\noindent
%The last three types (glue, kern, and penalty items) are called ^{discardable},
%for the same reason that we called them discardable in horizontal lists.
%You might want to compare these specifications with the analogous rules
%for the horizontal case, found in Chapter~14; it turns out that vertical
%lists are just like horizontal ones except that character boxes, discretionary
%breaks, ^|\vadjust| items, and math shifts cannot appear in vertical lists.
%Chapter~12 exhibits a typical vertical list in \TeX's internal box-and-glue
%representation.
\smallskip\noindent
最后三种(粘连,紧排和惩罚项)称为可弃的,理由与水平列中的可弃性一样。
如果要把这些说明与第十四章中水平情况下类似的规则作比较;
就发现垂直列很象水平列,除了字符盒子,任意可断点,
|\vadjust| 项和数学转换不能出现在垂直列之外。
第十二章列出了用 \TeX\ 的内部盒子和粘连表示的一个典型垂直列。
%\danger Page breaks can occur only at certain places within a vertical list.
%The permissible breakpoints are exactly the same as in the horizontal case,
%namely\enddanger
\danger 分页只能出现在垂直列中的某个地方。合法的断点与水平情况下正好一样,即:
\enddanger
%\smallskip
%\item{a)} at glue, provided that this glue is immediately preceded by a
%non-discardable item (i.e., by a box, whatsit, mark, or insertion);
\smallskip
\item{a)} 在粘连处,如果在此粘连前面是一个非可弃项目(即盒子、无名、标记或者插入项);
%\smallskip
%\item{b)} at a kern, provided that this kern is immediately followed by glue;
\smallskip
\item{b)} 在紧排处,如果此紧排后面直接跟着粘连;
%\smallskip
%\item{c)} at a penalty (which might have been inserted automatically in a
%paragraph).
\smallskip
\item{c)} 在惩罚处(它可能已经直接被插入到段落中了)。
%\smallskip\noindent
%Interline glue is usually inserted automatically between the boxes of a
%vertical list, as explained in Chapter~12, so there is usually a valid
%breakpoint between boxes.
\smallskip\noindent
就像第~12~章中讨论的那样,行间粘连一般自动插入到垂直列的盒子之间,
所以在盒子之间一般有一个可用的断点。
%\danger As in horizontal lists, each potential breakpoint has an
%associated penalty, which is high for undesirable breakpoints and negative
%for desirable ones. The penalty is zero at glue and kern breaks, so it is
%nonzero only at explicit penalty breaks. If you say `^|\penalty||-100|'
%between two paragraphs, you are indicating that \TeX\ should try to break
%here because the penalty is negative; a bonus of 100 points for breaking
%at this place will essentially cancel up to 100 units of badness that
%might be necessary to achieve such a break. A penalty of 10000 or more is
%so large that it inhibits breaking; a penalty of $-10000$ or less is so
%small that it forces breaking.
\danger 就象在水平列中一样,某个可能的断点有一个相应的惩罚,
对不好的断点它的值就高,对好的断点就是负的。%
在粘连和紧排处的断点的惩罚是零,
所以只有在明确的惩罚处的断点是非零的。%
如果在两个段落之间给出`|\penalty-100|', 就告诉了 \TeX\ 应该在此处分页,
因为惩罚是负值;
此处断点的 100 点积分本质上可以抵消必须在此处分页时的 100 单位的丑度。%
10000 以上的惩罚大得足以禁止分页;
小于 -10000 的惩罚小到足以强制分页。
%\danger Plain \TeX\ provides several control sequences that help to
%control page breaks. For example, ^|\smallbreak|, ^|\medbreak|, and
%^|\bigbreak| specify increasingly desirable places to break, having
%respective penalties of $-50$, $-100$, and~$-200$; furthermore, they will
%insert a ^|\smallskip|, ^|\medskip|, or ^|\bigskip| of space,
%respectively, if a break is not taken. However, |\smallbreak|,
%|\medbreak|, and |\bigbreak| do not increase existing glue unnecessarily;
%for example, if you say |\smallbreak| just after a displayed
%equation, you won't get a |\smallskip| of space in addition to the glue that
%already follows a display. Therefore these commands can conveniently
%be used before and after the statements of ^{theorems}, in a format for
%mathematical papers. In the present manual the author has used a macro
%that puts |\medbreak| before and after every dangerous-bend paragraph;
%|\medbreak\medbreak| is equivalent to a single |\medbreak|, so you don't
%see two medskips when one such paragraph ends and another one~begins.
\danger \1Plain \TeX\ 提供了几个控制分页的控制系列。%
例如,|\smallbreak|, |\medbreak| 和 |\bigbreak| 给出了越来越强的分页倾向,
其惩罚分别为 $-50$, ~$-100$, ~$-200$;
还有,如果它没有导致分页,就分别插入 |\smallskip|, |\medskip| 或 |\bigskip|的行间距。%
但是,|\smallbreak|, |\medbreak| 和 |\bigbreak| 不在原有的粘连上添加不必要的粘连;
例如,如果在陈列方程后面添加 |\samllbreak|, 那么除了来自陈列方程的粘连外,
不会得到 |\smallskip| 的行间距。%
因此,在数学论文中,这些命令可以很方便地在定理的陈述前后使用。%
在本手册中,作者在每个危险标识段落前后都放了 |\medbreak|;
|\medbreak\medbreak| 等价于一个 |\medbreak|,
所以当这样的段落在一个结束而另一个接着开始时不会得到两个 medskip。
%\danger The ^|\goodbreak| macro is an abbreviation for `|\par\penalty-500|'.
%This is a good thing to insert in your manuscript when proofreading, if
%you are willing to stretch some page a little bit extra in order to improve the
%following one. Later on if you make another change so that this |\goodbreak|
%command does not appear near the bottom of a page, it will have no effect;
%thus it is not as drastic as |\eject|.
\danger 宏 |\goodbreak| 的定义为`|\par\penalty-500|'。%
在校对时,如果希望把某些页面略微伸长一点来改善其后的页面排版,
把它插入到文稿中就可以了。%
稍后,如果改变后这个 |\goodbreak| 命令并不出现在页面底部,
那么它就不起作用了;
因此它不如 |eject| 强制性大。
%\danger The most interesting macro that plain \TeX\ provides for page make-up
%is called ^|\filbreak|. It means, roughly, ``Break the page here and fill the
%bottom with blank space, unless there is room for more
%copy that is itself followed by |\filbreak|.'' Thus if you put |\filbreak|
%at the end of every paragraph, and if your paragraphs aren't too long,
%every page break will occur between paragraphs, and \TeX\ will fit as many
%paragraphs as possible on each page. The precise meaning of\/ |\filbreak|~is
%\begintt
%\vfil\penalty-200\vfilneg
%\endtt
%according to Appendix B\null; and this simple combination of \TeX's primitives
%produces the desired result: If a break is taken at the |\penalty-200|,
%the preceding |\vfil| will fill the bottom of the page with blank space,
%and the ^|\vfilneg| will be discarded after the break; but if no break
%is taken at the penalty, the |\vfil| and |\vfilneg| will cancel each other
%and have no effect.
\danger Plain \TeX\ 提供的构建页面的最有效的宏叫做 |\filbreak|。%
严格讲,它的意思是,``在此处分页,并且用空白填满到底部,
除非下面还可以再放下带 |\filbreak| 的下一个对象''。%
因此,如果在每个段落的结尾都放上 |\filbreak|,
并且你的段落不是太长,那么分页正好出现在段落之间,
并且 \TeX\ 在每个页面放尽可能多的段落。%
按照附录 B, |\filbreak| 的确切意思是:
\begintt
\vfil\penalty-200\vfilneg
\endtt
并且这个 \TeX\ 原始控制系列的简单组合得到了所要的结果:
如果在 |\penalty-200| 处取了断点,那么前面的 |\vfil| 就用空白填满到底部,
并且断点后的 |\vfilneg| 将被忽略;
但是如果没有在惩罚处取断点,那么 |\vfil| 和 |\vfilneg| 将互相抵消而%
没有任何影响。
%\danger Plain \TeX\ also provides a ^|\raggedbottom| command, which is a
%vertical analog of\/ ^|\raggedright|: It tells \TeX\ to permit a small
%amount of variability in the bottom margins on different pages, in order
%to make the other spacing uniform.
\danger Plain \TeX\ 还提供了一个命令叫 |\raggedbottom|,
它类似于 |\raggedright|:
允许 \TeX\ 在不同页面留不同的小空白,以保证其它的行间距是一致的。
%\ddanger We saw in Chapter 14 that breakpoints for paragraphs are chosen
%by computing ``demerits'' for each line and summing them over all lines.
%The situation for pages is simpler because each page is considered separately.
%\TeX\ figures the ``^{cost}'' of a page break by using the following formula:
%\begindisplay
%$\displaystyle{c=\cases{
% p,&if $b<\infty$ and $p\le-10000$ and $q<10000$;\cr
% b+p+q,&if $b<10000$ and $-10000<p<10000$ and $q<10000$;\cr
% 100000,&if $b=10000$ and $-10000<p<10000$ and $q<10000$;\cr
% \infty,&if ($b=\infty$ or $q\ge10000$) and $p<10000$.\cr}}$
%\enddisplay
%Here $b$ is the ^{badness} of the page that would be formed if a break
%were chosen here; $p$~is the penalty associated with the current
%breakpoint; and $q$~is `^|\insertpenalties|', the sum of all penalties for
%split insertions on the page, as explained below. Vertical badness is
%computed by the same rules as horizontal badness; it is an integer between
%0 and~10000, inclusive, except when the box is overfull, when it
%is~$\infty$ (infinity).
%^^{infinite badness}
\ddanger 在第十四章我们看到,段落的断点是通过计算每行的``缺陷''并把所有%
行的缺陷加起来而确定的。%
页面的方法更简单,因为每个页面单独来考虑。%
通过下列公式 \TeX\ 计算出分页的``成本'':
\begindisplay
$\displaystyle{c=\cases{
p,&if $b<\infty$ and $p\le-10000$ and $q<10000$;\cr
b+p+q,&if $b<10000$ and $-10000<p<10000$ and $q<10000$;\cr
100000,&if $b=10000$ and $-10000<p<10000$ and $q<10000$;\cr
\infty,&if ($b=\infty$ or $q\ge10000$) and $p<10000$.\cr}}$
\enddisplay
其中,$b$ 是在此处分页所生成页面的丑度;$p$ 是当前断点的相应惩罚;
而 $q$ 是 `|\insertpenalties|',即页面上把插入盒子分开时的所有惩罚的和,
其解释在后面。垂直丑度的计算规则与水平丑度一样;
它是 $0$ 和 $10000$ 这个范围的整数,但是当盒子溢出时它是 $\infty$(无限大)。
%\ddanger When a page is completed, it is removed from the main vertical
%list and passed to an ``^{output routine},'' as we will see later; so its
%boxes and glue eventually disappear from \TeX's memory. The remainder of
%the main vertical list exists in two parts: First comes the ``^{current
%page},'' which contains all the material that \TeX\ has considered so far
%as a candidate for the next page to be broken off; then there are
%``^{recent contributions},'' i.e., items that will be moved to the current
%page as soon as \TeX\ finds it convenient to do so. If you say
%^|\showlists|, \TeX\ will display the contents of the current page and the
%recent contributions, if any, on your log file. \ (The example in
%Chapter~13 doesn't show any such lists because they were both empty in
%that case. Chapter~24 explains more about \TeX's timing.)
\ddanger \1当完成一个页面时,把它从主垂直列中清除并且送到``输出例行程序'',
这个我们将在后面看到;
所以其盒子和粘连最后都从 \TeX\ 的内存中清除了。%
主垂直列剩下的东西存在在两个部分中:
首先是来自``当前页面'', 它包含迄今为止 \TeX\ 为分出下一页所考虑的所有内容;
接着是``备选内容'', 即一旦 \TeX\ 发现可行就放入当前页面的那些项目。%
如果使用 |\showlists|, \TeX\ 将显示当前页面的内容和备选内容,
或者放在 log 文件中。%
(第十三章的例子没有给出这些列表,因为在那种情况下填满都是空的。%
第二十四章更多地讨论了 \TeX\ 的时机选择。)
%\ddanger Whenever \TeX\ is moving an item from the top of the ``recent
%contributions'' to the bottom of the ``current page,'' it discards a
%^{discardable item} (glue, kern, or penalty) if the current page does not
%contain any boxes. This is how glue disappears at a page break. Otherwise
%if a discardable item is a legitimate breakpoint, \TeX\ calculates the
%cost~$c$ of breaking at this point, using the formula that we have just
%discussed. If the resulting~$c$ is less than or equal to the smallest cost
%seen so far on the current page, \TeX\ remembers the current
%breakpoint as the best so far. And if $c=\infty$ or if $p\le-10000$, \TeX\
%seizes the initiative and breaks the page at the best remembered
%breakpoint. Any material on the current page following that best
%breakpoint is moved back onto the list of recent contributions, where it
%will be considered again; thus the ``current page'' typically gets more
%than one page's worth of material before the breakpoint is chosen.
\ddanger 只要 \TeX\ 把一个项目从``备选内容''的顶部移到``当前页面''的底部,
那么如果当前页面不包含任何盒子,那么它就忽略掉可弃项目(粘连,紧排或惩罚)。%
这就是粘连在分页处消失的方法。%
否则,如果可弃项目是一个合理断点,那么 \TeX\ 就用前面上面给出的公式计算在此断点%
的成本 $c$。%
如果所得到的 $c$ 小于等于迄今为止当前页面的其它成本,那么 \TeX\ 就把当前断点%
记为迄今为止最佳断点。%
并且如果 $c=\infty$ 或者 $p\le-10000$, \TeX\ 就主动出击,在所记住的最佳断点处分页。%
当前页面上最佳断点后面的任何东西都移回备选内容列,
它们会被再次处理;
因此,在断点选定前``当前页面''一般得到比一个页面更多的内容。
%\ddanger This procedure may seem mysterious until you see it in action.
%Fortunately, there is a convenient way to watch it;
%you can set ^|\tracingpages||=1|, thereby instructing \TeX\ to put its
%page-cost calculations into your log file. For example, here is what
%appeared on the log file when the author used |\tracingpages=1| at the
%beginning of the present chapter:
%\begintt
%%% goal height=528.0, max depth=2.2
%% t=10.0 g=528.0 b=10000 p=150 c=100000#
%% t=22.0 g=528.0 b=10000 p=0 c=100000#
%% t=34.0 g=528.0 b=10000 p=0 c=100000#
%|kern-3pt
%|qquad|hbox|bgroup|rm|vdots|quad(25 similar lines are being omitted here)|egroup
%% t=346.0 plus 2.0 g=528.0 b=10000 p=0 c=100000#
%% t=358.0 plus 2.0 g=528.0 b=10000 p=150 c=100000#
%% t=370.02223 plus 2.0 g=528.0 b=10000 p=-100 c=100000#
%% t=398.0 plus 5.0 minus 2.0 g=528.0 b=10000 p=0 c=100000#
%% t=409.0 plus 5.0 minus 2.0 g=528.0 b=10000 p=0 c=100000#
%% t=420.0 plus 5.0 minus 2.0 g=528.0 b=10000 p=150 c=100000#
%% t=431.0 plus 5.0 minus 2.0 g=528.0 b=10000 p=-100 c=100000#
%% t=459.0 plus 8.0 minus 4.0 g=528.0 b=10000 p=0 c=100000#
%% t=470.0 plus 8.0 minus 4.0 g=528.0 b=10000 p=0 c=100000#
%% t=481.0 plus 8.0 minus 4.0 g=528.0 b=10000 p=0 c=100000#
%% t=492.0 plus 8.0 minus 4.0 g=528.0 b=10000 p=0 c=100000#
%% t=503.0 plus 8.0 minus 4.0 g=528.0 b=3049 p=0 c=3049#
%% t=514.0 plus 8.0 minus 4.0 g=528.0 b=533 p=150 c=683#
%% t=525.0 plus 8.0 minus 4.0 g=528.0 b=5 p=-100 c=-95#
%% t=553.0 plus 11.0 minus 6.0 g=528.0 b=* p=0 c=*
%\endtt
%This trace output is admittedly not ``user-friendly'' in appearance, but
%after all it comes from deep inside \TeX's bowels where things have been
%reduced to numeric calculations. You can learn to read it with a little
%practice, but you won't need to do so very often unless you need to
%plunge into page-breaking for special applications. Here's what it
%means: The first line, which starts with `|%%|', ^^{percent percent}
%is written when the first box or insertion enters the current page list;
%it shows the ``^{goal height}'' and the ``^{max depth}'' that will be
%used for that page (namely, the current values of\/ ^|\vsize| and
%^|\maxdepth|). In the present manual we have |\vsize=44pc| and
%|\maxdepth=2.2pt|; dimensions in the log file are always displayed in
%points. The subsequent lines, which start with a single `|%|', ^^{percent}
%are written whenever a legal breakpoint is being moved from the list of
%recent contributions to the current page list. Every |%|~line shows $t$,
%which is the total height so far if a page break were to occur,
%and $g$, which is the goal height; in this example $g$~stays fixed at
%$528\pt$, but $g$ would have decreased if insertions such as footnotes had
%occurred on the page. The values of~$t$ are steadily increasing from 10 to
%22 to~34, etc.; baselines are $12\pt$ apart at the top of the page and
%$11\pt$ apart at the bottom (where material is set in nine-point type).
%We are essentially seeing one |%|~line per hbox of text being placed on
%the current page. However, the |%|~lines are generated by the penalty or
%glue items that follow the hboxes, not by the boxes themselves. Each
%|%|~line shows also the badness~$b$, the penalty~$p$, and the cost~$c$
%associated with a breakpoint; if this cost is the best so far, it is
%marked with a `|#|' sign, ^^{sharp} meaning that ``this breakpoint will be
%used for the current page if nothing better comes along.'' Notice that the
%first 40 or so breaks all have $b=10000$, since they are so bad that \TeX\
%considers them indistinguishable; in such cases $c=100000$, so \TeX\ simply
%accumulates material until the page is full enough to
%have $b<10000$. A penalty of 150 reflects the ^|\clubpenalty| or the
%^|\widowpenalty| that was inserted as described in Chapter~14. The three
%lines that say |p=-100| are the breakpoints between ``dangerous bend''
%paragraphs; these came from ^|\medbreak| commands. The notation |b=|^|*| and
%|c=*| on the final line means that $b$ and~$c$ are infinite; the total
%height of $553\pt$ cannot be reduced to $528\pt$ by shrinking the
%available glue. Therefore the page is ejected at the best previous place,
%which turns out to be a pretty good break: |b=5| and |p=-100| yield a
%net cost of $-95$.
\ddanger 在你看到这个程序运转前,可能比较神秘。
幸运的是,有一个便利的方法来观察它;
你可以使用 |\tracingpages||=1|,从而告诉 \TeX\ 把页面成本的计算输出到日志文件中。
例如,当在本章的开头使用 |\tracingpages=1| 时,下面的内容就出现在日志文件中:
\begintt
%% goal height=528.0, max depth=2.2
% t=10.0 g=528.0 b=10000 p=150 c=100000#
% t=22.0 g=528.0 b=10000 p=0 c=100000#
% t=34.0 g=528.0 b=10000 p=0 c=100000#
|kern-3pt
|qquad|hbox|bgroup|rm|vdots|quad(25 similar lines are being omitted here)|egroup
% t=346.0 plus 2.0 g=528.0 b=10000 p=0 c=100000#
% t=358.0 plus 2.0 g=528.0 b=10000 p=150 c=100000#
% t=370.02223 plus 2.0 g=528.0 b=10000 p=-100 c=100000#
% t=398.0 plus 5.0 minus 2.0 g=528.0 b=10000 p=0 c=100000#
% t=409.0 plus 5.0 minus 2.0 g=528.0 b=10000 p=0 c=100000#
% t=420.0 plus 5.0 minus 2.0 g=528.0 b=10000 p=150 c=100000#
% t=431.0 plus 5.0 minus 2.0 g=528.0 b=10000 p=-100 c=100000#
% t=459.0 plus 8.0 minus 4.0 g=528.0 b=10000 p=0 c=100000#
% t=470.0 plus 8.0 minus 4.0 g=528.0 b=10000 p=0 c=100000#
% t=481.0 plus 8.0 minus 4.0 g=528.0 b=10000 p=0 c=100000#
% t=492.0 plus 8.0 minus 4.0 g=528.0 b=10000 p=0 c=100000#
% t=503.0 plus 8.0 minus 4.0 g=528.0 b=3049 p=0 c=3049#
% t=514.0 plus 8.0 minus 4.0 g=528.0 b=533 p=150 c=683#
% t=525.0 plus 8.0 minus 4.0 g=528.0 b=5 p=-100 c=-95#
% t=553.0 plus 11.0 minus 6.0 g=528.0 b=* p=0 c=*
\endtt
\1这个跟踪输出不可否认在外观上不那么``友好'',
但是毕竟它来自 \TeX\ 的内脏中,所做的事情已经简化为数字计算了。%
经过一些训练就可以读懂它们,
不过你不必经常这样做,除非要做特殊的分页。%
其意思如下:
第一行以`|%%|'开头,
当第一个盒子或插入进入当前页面列时写入;
它显示了此页面将要使用的``目标高度''和``最大深度''(即 |\vsize| 和%
~|\maxdepth| 的当前值)。%
在本手册中,|\vsize=44pc| 和 |\maxdepth=2.2pt|;
log 文件中尺寸的单位是 point。%
随后的行以单个`|%|'开头,
只要从备选内容向当前页面列移入合理的断点,就写入。%
每个 |%| 行显示 $t$~(如果在此分页,它就是迄今为止的总高度)和 $g$~(它是目标高度);
在本例中,~$g$ 保持固定,为 $528\pt$,
但是如果诸如脚注这样的插入出现在页面上,~$g$ 应该减小。%
~$t$ 的值稳定增大,从 $10$ 到 $22$ 到 $34$ 等等;
在页面顶部基线的间隔为 $12\pt$, 在底部为 $11\pt$(因为文本是 9 point 的字体)。%
只要一个文本盒子放在当前页面上,就看到一个 |%| 行。%
但是,|%| 行也可以由 hbox 后的惩罚或粘连项目生成,而不是盒子自身。%
每个 |%| 行还显示了与断点相应的丑度 $b$, 惩罚 $p$, 和成本 $c$;
如果这个成本是迄今为止最好的,就用`|#|'来标记,意思是,
``如果后面没有更好的就把此断点应用于当前页面''。%
注意,大约前 40 个断点都是 $b=10000$, 这是因为它们糟糕得 \TeX\ 认为无法区分;
在这种情况下 $c=100000$,
所以 \TeX\ 直接积累材料,直到页面满到 $b<10000$。%
惩罚为 150 反映了 |\clubpenalty| 或 |\widowpenalty| 被插入,
就象第十四章中讨论的那样。%
含有 |p=-100| 的三个行是``危险''标识段落之间的断点;
它们来自命令 |\medbreak|。%
在最后一行的符号 |b=*| 和 |c=*| 意味着 $b$ 和 $c$ 是无限大;
总高度 $553\pt$ 不能通过收缩可用的粘连而减小到 $528\pt$。%
因此,页面在最佳的前一个位置结束,
这就是一个机动好断点:|b=5| 和 |p=-100| 断点净成本为 $-95$。
%\ddangerexercise Suppose the paragraph at the bottom of the example page
%had been one line shorter; what page break would have been chosen?
%\answer The last three page-break calculations would have been
%\begintt
%% t=503.0 plus 8.0 minus 4.0 g=528.0 b=3049 p=150 c=3199#
%% t=514.0 plus 8.0 minus 4.0 g=528.0 b=533 p=-100 c=433#
%% t=542.0 plus 11.0 minus 6.0 g=528.0 b=* p=0 c=*
%\endtt
%so the break would have occurred at the same place. The badness would have
%been~533, but the page would still have looked tolerable. \ (On the other
%hand if that paragraph had been two lines shorter instead of one,
%the first two lines of the next ``dangerous bend'' paragraph
%would have appeared on that page; the natural height $t=531\pt$ would have
%been able to shrink to $g=528\pt$ because the three ``medskips'' on
%the page would have had a total shrinkability of $6\pt$. This would certainly
%have been preferable to a stretched-out page whose badness was~3049; but the
%author might have seen it and written another sentence or two, so that
%the paragraph would not have been broken up. After all, this manual is supposed
%to be an example of good practice.)
\ddangerexercise 假定例子页面底部的段落减少一行;分页会怎样选定呢?
\answer 最后三个分页计算将变成
\begintt
% t=503.0 plus 8.0 minus 4.0 g=528.0 b=3049 p=150 c=3199#
% t=514.0 plus 8.0 minus 4.0 g=528.0 b=533 p=-100 c=433#
% t=542.0 plus 11.0 minus 6.0 g=528.0 b=* p=0 c=*
\endtt
因此分页将出现在相同位置。劣度将是 533,但页面看来还是过得去的。%
(另一方面,如果该段落减少两行而非一行,下一个``险弯''段落的前两行将出现在该页;
因为页面上三个 ``medskip'' 总共有 $6\pt$ 的可收缩量,
自然高度 $t=531\pt$ 将可以收缩到 $g=528\pt$。
这肯定将比伸开的页面略胜一筹,因为那样劣度将为 ~3049;
但作者也许已经发现这点,并且多写了一两行句子,使得段落不会被一分为二。
毕竟此手册是希望作为良好实践的示例的。)
%\ddangerexercise The last two ``\kern.5pt|%| lines'' of this example show
%the natural height of~$t$ jumping by $28\pt$, from 525.0 to~553.0. Explain
%why there was such a big jump.
%\answer The next legal break after the beginning of a dangerous bend
%paragraph occurs $28\pt$ later, because there is $6\pt$ additional space for
%a |\medskip|, followed by two lines of $11\pt$ each. \TeX\ does not
%allow breaking between those two lines; the ^|\clubpenalty| is set briefly
%to 10000 in Appendix~E\null, since the dangerous bend symbol is two lines tall.
\ddangerexercise 本例子的最后两个``|%| 行''显示自然高度跳过了 $28\pt$,
从 525.0 到 553.0。看看为什么有这么大的跳跃?
\answer 下个合法分页点出现在险弯段落开始后的 $28\pt$ 之后,
因为其中有 $6\pt$ 的 |\medskip| 间距,以及各占 $11\pt$ 的两行。
\TeX\ 不被允许在这两行间分页;因为险弯符号有两行高,
在附录 E 中 ^|\clubpenalty| 被直接设定为 10000。
%\ddanger The ^|\maxdepth| parameter tells \TeX\ to raise the bottom box
%on the page if that box has too much depth, so that the depth of the
%constructed page will not exceed a specified value. \ (See the discussion of
%^|\boxmaxdepth| in Chapter~12.) \ In our example |\maxdepth=2.2pt|, and
%the influence of this parameter can be seen in the line that says
%`|% t=370.02223|'. Ordinarily $t$~would have been 370.0 at that breakpoint;
%but the hbox preceding it was unusual because it contained the letter
%|j| in ^|\tt|, and a 10-point typewriter-style |j| descends $2.22223\pt$
%below the baseline. Therefore \TeX\ figured badness as if the hbox were
%$.02223\pt$ higher and only $2.2\pt$ deep.
\ddanger 如果页面底部盒子深度过大,参数 |\maxdepth| 告诉 \TeX\ 升高此盒子,
使得所构建页面的深度不超出所给值。(参见第十二章中 |\boxmaxdepth| 的讨论。)
在我们的例子中,|\maxdepth=2.2pt|,此参数的影响可以在 `|% t=370.02223|' 行看到。
一般地,在此断点 $t$ 应该是 370.0;
但是在它前面的盒子是不寻常的,因为它包含了 |\tt| 字体的字母 |j|,
而 10 点打字机字体的 |j| 比基线低 $2.22223\pt$。
因此,\TeX\ 计算丑度时假定该 hbox 的高度多了 $.02223\pt$ 而深度仅为 $2.2\pt$。
%\ddanger Notice that the first ``\kern.5pt|%| line'' of our example says
%|t=10.0|; this is a consequence of another parameter, called ^|\topskip|.
%Glue disappears at a page break, but it is desirable to produce pages
%whose top and bottom baselines occur in predetermined positions, whenever
%possible; therefore \TeX\ inserts special glue just before the first box
%on each page. This special glue is equal to |\topskip|, except that the
%natural space has been decreased by the height of the first box, or it has
%been set to zero in lieu of a negative value. For example, if\/
%|\topskip=20pt plus2pt|, and if the first box on the current page is
%$13\pt$ tall, \TeX\ inserts `|\vskip7pt plus2pt|' just above that box.
%Furthermore, if the first box is more than $20\pt$ tall, `|\vskip0pt
%plus2pt|' is inserted. But this example is atypical, since the |\topskip|
%glue usually has no stretchability or shrinkability; plain \TeX\ sets
%|\topskip=10pt|.
\ddanger 注意,例子中的第一个 |%| 行给出了 |t=10.0|;
这是另一个参数的结果,它叫做 |\topskip|。粘连在分页时消失了,
但是只要可以,就希望所得页面的顶基线和底基线出现在预先确定的位置上;
\1因此 \TeX\ 在每页的第一个盒子前面插入特殊粘连。
这个特殊粘连等于 |\topskip| ,再减去第一个盒子的高度;
若所得的自然间距为零时,设定自然间距为零。
例如,如果 |\topskip=20pt plus2pt|,并且当前页面上第一个盒子的高度为 $13\pt$,
那么 \TeX\ 仅在盒子上方插入`|\vskip7pt plus2pt|'。
还有,如果第一个盒子的高度超过 $20\pt$,那么插入`|\vskip0pt plus2pt|'。
但是这个例子不是典型的,因为一般 |\topskip| 没有伸缩性;
plain \TeX\ 设置 |\topskip=10pt|。
%\ddangerexercise Assume that |\vsize=528pt|, |\maxdepth=2.2pt|,
%|\topskip=10pt|, and that no |\insert| commands are being used. \TeX\ will
%make pages that are $528\pt$ high, and the following two statements will
%normally be true: (a)~The baseline of the topmost box on the page will be
%$10\pt$ from the top, i.e., $518\pt$ above the baseline of the page itself.
%(b)~The baseline of the bottommost box on the page will coincide with the
%baseline of the page itself. Explain under what circumstances (a) and~(b)
%will fail.
%\answer A page always contains at least one box, if there are no
%insertions, since the legal breakpoints are discarded otherwise.
%Statement~(a) fails if the height of the topmost box exceeds $10\pt$.
%Statement~(b) fails if the depth of the bottommost box exceeds $2.2\pt$, or
%if some glue or kern comes between the bottommost box and the page break
%(unless that glue or kern exactly cancels the depth of the box).
\ddangerexercise 假定 |\vsize=528pt|、|\maxdepth=2.2pt|、|\topskip=10pt|,
且不使用 |\insert| 命令。\TeX\ 将构建高度为 $528\pt$ 的页面,
并且下列两个陈述一般是正确的:
(a) 页面最顶部盒子的基线距离顶部 $10\pt$,即比页面本身的基线高 $518\pt$。%
(b) 页面最底部盒子的基线与页面本身的基线重合。%
看看在什么情况下 (a) 和 (b) 失效。
\answer 如果没有插入项,页面总是至少包含一个盒子,因为否则的话合法分页点就会被丢弃。
陈述 (a) 在最顶部盒子的高度超过 $10\pt$ 时失效。
陈述 (b) 在最底部盒子的深度超过 $2.2\pt$ 时失效,
在最底部盒子与分页点之间存在粘连或紧排时也失效%
(除非该粘连或紧排正好和该盒子的深度抵消)。
%\ddanger Since |\vsize|, |\maxdepth|, and |\topskip| are
%parameters, you can change them at any time; what happens if you do?
%Well, \TeX\ salts away the values of\/ |\vsize| and |\maxdepth| when
%it prints the ``\kern.5pt|%%|~line,'' i.e., when the first box or insertion
%occurs on the current page; subsequent changes to those two parameters
%have no effect until the next current page is started. On the other hand,
%\TeX\ looks at |\topskip| only when the first box is being contributed
%to the current page. If insertions occur before the first box, the
%|\topskip| glue before that box is considered to be a valid breakpoint;
%this is the only case in which a completed page might not contain a box.
\ddanger 因为 |\vsize|, |\maxdepth| 和 |\topskip| 是参数,
所以可以在任何时候改变它们;
如果这样会出现什么结果?
嗯,当 \TeX\ 输出``|%%| 行''时,即当第一个盒子或插入出现在当前页面时,
它会记住 |\vsize| 和 |\maxdepth| 的值;
直到下一页开始对这两个参数的改变才起作用。%
另一方面,只有当第一个盒子送到当前页面时 \TeX\ 才查看 |\topskip| 的值。%
如果插入出现在盒子前面,那么此盒子之前的 |\topskip| 粘连就被看作一个可用断点;
这是整个页面不可能包含盒子的唯一情形。
%\ddanger You can look at the $t$ and $g$ values that are used in page
%breaking by referring to the \<dimen> values `^|\pagetotal|' and
%`^|\pagegoal|', respectively. You can even change them (but let's hope
%that you know what you are doing). For example, the command
%|\pagegoal=500pt| overrides the previously saved value of\/ |\vsize|.
%Besides |\pagetotal|, which represents the accumulated natural height,
%\TeX\ maintains the quantities ^|\pagestretch|, ^|\pagefilstretch|,
%^|\pagefillstretch|, ^|\pagefilllstretch|, ^|\pageshrink|, and
%^|\pagedepth|. When the current page contains no boxes, |\pagetotal| and
%its relatives are zero and |\pagegoal| is $16383.99998\pt$ (\TeX's largest
%\<dimen>); changing their values has no effect at such times. The integer
%$q$ in the formula for page costs is also available for inspection and
%change; it is called ^|\insertpenalties|.
\ddanger 在分页中所看到的 $t$ 和 $g$ 的值分别指 \<dimen> 值
`|\pagetotal|' 和 `|\pagegoal|'。你也可以改变它们(但愿你知道你在做什么)。
例如,命令 |\pagegoal=500pt| 将取代前面保存的 |\vsize| 的值。
|\pagetotal| 表示累计的自然高度,除此之外, \TeX\ 还有其它量 |\pagestretch|、
|\pagefilstretch|、|\pagefillstretch|、|\pagefilllstretch|、|\pageshrink| 和
|\pagedepth|。如果当前页不包含盒子,那么 |\pagetotal| 及与其相关的量等于零,
并且 |\pagegoal| 为 $16383.99998\pt$(\TeX\ 的最大尺寸);
在这种情况下改变它们的值没有影响。式子中表示页面成本的整数 $q$ 也可用在检验中,
并且是可改变的;它的名称为 |\insertpenalties|。
%\ddanger Page breaking differs from line breaking in one small respect
%that deserves mention here: If you say |\eject\eject|, the second |\eject|
%is ignored, because it is equivalent to |\penalty-10000| and penalties are
%discarded after a page break. But if you say |\break\break| in a
%paragraph, the second ^|\break| causes an empty line, because penalties
%are discarded after a break in a paragraph only if they do not belong to
%the final sequence of breakpoints. This technicality is unimportant in
%practice, because |\break\break| isn't a good way to make an empty line;
%that line will usually be an underfull hbox, since it has only the
%|\leftskip| and |\rightskip| glue in it. Similarly, `|\eject\eject|'
%would not be a good way to make an empty page, even if \TeX\ were to
%change its rules somehow so that an |\eject| would never be ignored. The
%best way to eject an ^{empty page} is to say `|\eject\line{}\vfil\eject|',
%and the best way to create an ^{empty line} is
%`|\break\hbox{}\hfil\break|'. Both of these avoid underfull boxes.
\ddanger 值得一提的是,分页与断行在一个小的方面是不同的:
如果使用 |\eject\eject|, 那么第二个 |\eject| 将被忽略,
因为它等价于 |\penalty-10000|, 而分页后的惩罚是可弃的。%
但是如果在段落中使用 |\break\break|, 那么第二个 |\break| 产生一个空行,
因为只有当惩罚不属于最后的断点序列时,段落中断点后的惩罚才是可弃的。%
实际上这个技术要点并不重要,因为 |\break\break| 不是产生空行的好办法;
因为它只包含 |\leftskip| 和 |\rightskip| 这两个粘连,所以得到的是松散的 hbox。%
类似地,`|\eject\eject|'不是一个生成空页的好方法,
即使 \TeX\ 改变一下规则使得 |\eject| 不被忽略掉。%
得到空页的最好方法是`|\eject\line{}\vfil\eject|',
而生成空行的最好方法是`|\break\hbox{}\hfil\break|'。%
这两种方法都避免出现松散的盒子。
%\danger You are probably wondering how page numbers and such things
%get attached to pages. The answer is that \TeX\ allows you to do further
%processing after each page break has been chosen; a special ``output
%routine'' goes into action before pages actually receive their final
%form. Chapter~23 explains how to construct output routines and how to
%modify the output routine of plain~\TeX.
\danger \1可能你想知道页码和此类内容是怎样添加到页面上的。%
答案是,在每个分页选定之后, \TeX\ 允许你做进一步处理;
在页面得到它们的最终格式前,进入一个特殊的``输出例行程序''。%
第二十三章讨论了怎样构建输出例行程序以及怎样修改 plain \TeX\ 的输出例行程序。
%\danger Every once in a~while, \TeX\ will produce a really awful-looking
%page and you will wonder what happened. For example, you might get just
%one paragraph and a lot of white space, when some of the text on the
%following page would easily fit into the white space. The reason for such
%apparently anomalous behavior is almost always that no good page break
%is possible; even the alternative that looks better to you is quite terrible
%as far as \TeX\ is concerned! \TeX\ does not distinguish between two
%choices that both have 10000 units of badness or more, even though some bad
%breaks do look much worse than others. The solution in such cases is to
%insert |\eject| or |\vfill\eject| in some acceptable spot, or to
%revise the manuscript. If this problem arises frequently, however,
%you probably are using a format that sets overly strict limitations
%on page format; try looking at the output of\/ |\tracingpages| and
%modifying some of \TeX's parameters, until you have better luck.
\danger \TeX\ 偶尔会生成一个难看的页面,想知道出现什么问题吗?
例如,你得到的可能只是一个段落和很多空白,而下一页的文本空页却明显能放在这些空白处。%
这样明显反常的原因几乎都是无法找到好的断点;
即使对你而言另一种方法很好,而对 \TeX\ 而言却很糟!
因为 \TeX\ 无法区分两个大于等于 10000 的丑度,即使一个看起来比另一个很糟。%
在此情况下,解决的方法是在某些可接受的地方插入 |\eject| 或者 |\vfill\eject|,
或者修订你的文稿。%
但是如果这个问题经常出现,那么说明你使用的页面格式限制得太严格;
试着看看 |\tracingpages| 的输出信息,并且修改一些 \TeX\ 的参数,
这样就可以感觉好一些了。
%\danger The remainder of this chapter is about insertions: things like
%footnotes and ^{illustrations}, and how they interact with page breaks.
%Before we discuss the primitive operations by which \TeX\ deals with
%insertions, we will take a look at the facilities that plain \TeX\ provides
%at a higher level.
\danger 本章剩下的内容将讨论插入对象:
就象脚注和图例这些东西,以及它们与分页之间的互相影响。%
在我们讨论 \TeX\ 处理插入对象的原始命令之前,先看看 plain \TeX\ 提供的高级工具。
%\danger Illustrations can be inserted in several ways using plain \TeX.
%The simplest of these is called a ``^{floating topinsert}''; you say
%\begindisplay
%^|\topinsert|\<vertical mode material>^|\endinsert|
%\enddisplay
%and \TeX\ will attempt to put the vertical mode material at the top of the
%current page. If there's no room for such an insertion on this page, \TeX\
%will insert it at the top of the next page. The \<vertical mode material>
%can contain embedded paragraphs that temporarily interrupt vertical mode
%in the usual way; for example:
%\begintt
%\topinsert \vskip 2in
%\hsize=3in \raggedright
%\noindent{\bf Figure 3.} This is the caption to the
%third illustration of my paper. I have left two inches
%of space above the caption so that there will be room
%to introduce special artwork. \endinsert
%\endtt
%The ^{caption} in this example will be set ^{ragged-right} in a 3-inch
%column at the left of the page. Plain \TeX\ automatically adds a
%``^{bigskip}'' below each topinsert; this will separate the caption from
%the text. The effects of\/ |\hsize=3in| and |\raggedright| do not extend
%past the |\endinsert|, since ^{grouping} is implied.
\danger 在 plain \TeX\ 中有几种方法可以插入图例。%
最简单的叫做``顶部浮动插入'';
命令是
\begindisplay
|\topinsert|\<vertical mode material>|\endinsert|
\enddisplay
并且 \TeX\ 试着把垂直模式的内容放在当前页面顶部。%
如果在某个页面顶部没有空间了,
\TeX\ 将把它插入到下一个页面顶部。%
\<vertical mode material> 可包含嵌入的段落(它按通常的方法临时中断垂直模式而得到);
例如:
\begintt
\topinsert \vskip 2in
\hsize=3in \raggedright
\noindent{\bf Figure 3.} This is the caption to the
third illustration of my paper. I have left two inches
of space above the caption so that there will be room
to introduce special artwork. \endinsert
\endtt
本例的 caption 设置放在页面左边,栏宽为 3 inch, 左对齐。%
Plain \TeX\ 自动在每个顶部插入下面添加一个``bigskip'';
它就把标题和文字分开。%
因为暗含了编组命令,所以 |\hsize=3in| 和 |\raggedright| 的作用不会超出 |\endinsert|。
%\dangerexercise Modify this example so that the caption is moved over next to
%the right margin, instead of appearing at the left.
%\answer |\topinsert\vskip2in\rightline{\vbox{\hsize|\stretch|...|\stretch
%|artwork.}}\endinsert|
%does the job. But it's slightly more efficient to avoid ^|\rightline| by
%changing ^|\leftskip| as follows:
%`|\leftskip=\hsize \advance\leftskip by-3in|'.
%Then \TeX\ doesn't have to read the text of the caption twice.
\dangerexercise 修改此例子,使得下一个标题出现在右页边,而不是左页边。
\answer |\topinsert\vskip2in\rightline{\vbox{\hsize|\stretch|...|\stretch
|artwork.}}\endinsert| 即可完成任务。
但如果不用 ^|\rightline|,而是将 ^|\leftskip| 改为
`|\leftskip=\hsize \advance\leftskip by-3in|' 效率更高。
这样 \TeX\ 不必两次读取标题文本。
%\danger Similarly, if you say `^|\pageinsert|\stretch\<vertical mode
%material>\stretch |\endinsert|', the vertical mode material will be
%justified to the size of a full page (without a bigskip below it);
%the result will appear on the following page.
\danger 类似地,如果使用`|\pageinsert|\stretch\<vertical mode
material>\stretch |\endinsert|', 那么垂直模式的内容将被调整为整个页面的大小%
(它下面没有 bigskip 了);
所得到的内容将放在下一页上。
%\danger There's also `^|\midinsert|\stretch\<vertical mode material>\stretch
%|\endinsert|', which tries first to insert the material in place, wherever
%you happen to be, in the middle of the current page. If there is enough
%room, you get the effect of^^|\bigskip|^^|\bigbreak|
%\begindisplay
%|\bigskip\vbox{|\<vertical mode material>|}\bigbreak|
%\enddisplay
%otherwise the |\midinsert| is effectively converted to a |\topinsert|.
%There is a slight probability that |\midinsert| will not find the
%best placement, because \TeX\ is sometimes processing text ahead of the
%current page. You may want to say `^|\goodbreak|' just before |\midinsert|.
\danger \1还有`|\midinsert|\stretch\<vertical mode material>\stretch
|\endinsert|', 它首先把此内容插入其所在的位置,在当前页面中间。%
如果没有足够的空间,就得到了
\begindisplay
|\bigskip\vbox{|\<vertical mode material>|}\bigbreak|
\enddisplay
否则,~|\midinsert| 就转换为 |\topinsert|。%
偶尔 |\midinsert| 无法找到最佳位置,因为 \TeX\ 有时候先于当前页面来处理文本。%
可能要在 |\midinsert| 前加上`|\goodbreak|'。
%\danger You should use the commands |\topinsert|, |\pageinsert|,
%|\midinsert| in vertical mode (i.e., between paragraphs), not inside of
%boxes or other insertions.
\danger 应该在垂直模式下(即段落之间)使用命令 |\topinsert|、|\pageinsert|、
|\midinsert|,而不能在盒子或其它插入项中。
%\danger If you have two or more |\topinsert| or |\pageinsert| commands in
%quick succession, \TeX\ may need to carry them over to several subsequent
%pages; but they will retain their relative order when they are
%carried over. For example, suppose you have pages that are nine inches
%tall, and suppose you have already specified 4~inches of text for some
%page, say page~25. Then suppose you make seven topinserts in a row, of
%respective sizes $1,2,3,9,3,2,1$ inches; the 9-inch one is actually a
%|\pageinsert|. What happens? Well, the first and second will appear at
%the top of page 25, followed by the 4~inches of copy you have already
%typed; that copy will immediately be followed by two more inches that you
%type after the seven inserts. The third topinsert will appear at the top
%of page~26, followed by six more inches of text; the fourth will fill
%page~27; and the remaining three will appear at the top of page~28.
\danger 如果紧接着有两个或多个 |\topinsert| 或 |\pageinsert| 命令,
那么 \TeX\ 可能需要把它们顺次放在几个连续的页面上;
但是当转移时要保留其相对顺序。例如,假定页面的高度为 9 英寸,
而且在某些页面上已经放了 4 英寸的文本。比如第 25 页。%
那么,如果一行中有 7 个顶部插入项,大小分别为 $1,2,3,9,3,2,1$ 英寸;
9 英寸的其实就是 |\pageinsert|。会出现什么情况?
嗯,第一,第二个出现在第 25 页顶部,接下来是已经输入的 4 英寸文本;
再接下来是你在 7 个插入项后面输入的文本,有 2 英寸。%
第三个顶部插入出现在第 26 页顶部,接下来是 6 英寸文本;
第四个满满地放在第 27 页;剩下的三个放在第 28 页。
%\dangerexercise What would happen in the example just discussed if the final
%1-inch insertion were a |\midinsert| instead of a |\topinsert|?
%\answer It would appear on page~25, since it does fit there. A |\midinsert|
%will jump ahead of other insertions only if it is not carried over to another
%page; for example, if the second 3-inch insertion were a |\midinsert|, it would
%not appear on page~26, because it is converted to a |\topinsert| as soon as the
%|\midinsert| macro notices that the insertion is too big for page~25.
\dangerexercise 在上面讨论的例子中,如果最后一个 1 英寸的插入项是中间插入项,
而不是顶部插入项会出现什么结果?
\answer 它将出现在第 25 页,因为在这里确实能放得下它。
|\midinsert| 仅在不会转移到另一页时才能跳过其他插入项;
举个例子,如果第二个 3 英寸的插入项为 |\midinsert|,它将不会出现在第 26 页,
这是因为,一旦 |\midinsert| 发现此插入项在第 25 页放不下,
就将它转换为 |\topinsert|。
%\danger At the end of a paper, you probably want to make sure that no
%insertions are lost; and at the end of a chapter, you probably want to make
%sure that no insertions float into the following chapter. Plain \TeX\ will
%flush out all remaining insertions, with blank space filling the bottom of
%incomplete pages, if you say `|\vfill|^|\supereject|'.
\danger 在论文的结尾,可能希望确保没有把插入对象丢失掉;
在章的结尾,可能要确保插入对象不要浮动到下一章。%
如果使用`|\vfill\supereject|', 那么 plain \TeX\ 将把所有剩下的插入对象%
排版,用空白把未填满的页面充满。
%\danger Besides illustrations that are inserted at the top of a page,
%plain \TeX\ will also insert ^{footnotes} at the bottom of a page. The
%^|\footnote| macro is provided for use within paragraphs;\footnote*{Like
%this.} for example, the footnote in the present sentence was typed
%in the following way:
%\begintt
%... paragraphs;\footnote*{Like this.} for example, ...
%\endtt
%There are two parameters to a |\footnote|; first comes the ^{reference mark},
%which will appear both in the paragraph\footnote{**}{The author typed
%`|paragraph\footnote{**}{The author ...}|' here.} and in the footnote itself,
%and then comes the text of the footnote.\footnote{$^{45}$}{And
%`|footnote.\footnote{$^{45}$}{And ...}|' here. The footnotes in this manual
%appear in smaller type, and they are set with hanging indentation;
%furthermore a smallskip occurs between footnotes on the same page. But
%in plain \TeX, footnotes are typeset with the normal size of type, with
%|\textindent| used for the reference mark, and without extra smallskips.
%The |\textindent| macro is like |\item|, but it omits hanging
%indentation.}
%The latter text may be several paragraphs long, and it may contain
%displayed equations and such things, but it should not involve other
%^^|\textindent| ^^|\item| % these are in a split footnote, after the split!
%insertions. \TeX\ will ensure that each footnote occurs at the bottom of
%the same page as its reference.\footnote\dag{Printers often use the
%symbols |\dag| (\dag), |\ddag| (\ddag), |\S|~(\S), and |\P|~(\P) as
%reference marks; sometimes also |$\|\||$| ($\Vert$).
%You can say, e.g., `|\footnote\dag{...}|'.} A long
%footnote will be split, if necessary, and continued at the bottom of the
%following page, as you can see in the ^^|\dag|^^|\ddag|^^|\S|^^|\P|^^|\Vert|
%somewhat contrived example that appears here. Authors who are interested
%in good exposition should avoid footnotes whenever possible, since
%footnotes tend to be ^^{Gibbon} distracting.\footnote\ddag{Yet Gibbon's
%{\sl Decline and Fall\/} would not have been the same without footnotes.}
\danger 除了在页面顶部插入图例外,plain \TeX\ 还在页面底部插入脚注。%
在段落中提供了 |\footnote| 宏来完成任务;\footnote*{Like
this.}
例如,在本句中的脚注是如下输入的:
\begintt
... paragraphs;\footnote*{Like this.} for example, ...
\endtt
一个 |\footnote| 有两个参数;
第一个是参照标记,它既出现在段落中\footnote{**}{The author typed
`|paragraph\footnote{**}{The author ...}|' here.}, 也出现在脚注自身中,
接下来是脚注文字。\footnote{$^{45}$}{And
`|footnote.\footnote{$^{45}$}{And ...}|' here. The footnotes in this manual
appear in smaller type, and they are set with hanging indentation;
furthermore a smallskip occurs between footnotes on the same page. But
in plain \TeX, footnotes are typeset with the normal size of type, with
|\textindent| used for the reference mark, and without extra smallskips.
The |\textindent| macro is like |\item|, but it omits hanging
indentation.}
后面的文本可以有几段长,
并且可以包含陈列方程和此类对象,
但是不应包含其它插入对象。%
\1\TeX\ 会确保每个脚注出现在其参照标记所在页面的底部。\footnote\dag{Printers
often use the
symbols |\dag| (\dag), |\ddag| (\ddag), |\S|~(\S), and |\P|~(\P) as
reference marks; sometimes also |$\|\||$| ($\Vert$).
You can say, e.g., `|\footnote\dag{...}|'.}
在必要时,长的脚注会被分成两部分,并且续在下一页底部,就象你看到的下面的人为%
的例子一样。%
要思路流畅的话应尽可能避免使用脚注,因为脚注会分散注意力。\footnote\ddag{Yet Gibbon's
{\sl Decline and Fall\/} would not have been the same without footnotes.}
%\danger The |\footnote| macro should be used only in paragraphs or hboxes
%that are contributed to \TeX's main vertical list; insertions will be lost
%if they occur inside of boxes that are inside of boxes. Thus, for example,
%you should not try to put a |\footnote| into a subformula of a math formula.
%But it's OK to use footnotes within ^|\centerline|, e.g., ^^{Thor}
%\begintt
%\centerline{A paper by A. U. Thor%
% \footnote*{Supported by NSF.}}
%\endtt
%or even on the outer level of a table entry inside an ^|\halign|.
\danger 宏 |\footnote| 应该只在段落或出现在 \TeX\ 主垂直列的 hbox 中使用;
如果它们出现在盒子中的盒子中,那么插入对象将丢失。%
因此,例如,不要把 |\footnote| 放在数学公式的子式中。%
但是,在 |\centerline| 中使用脚注是可以的,比如,
\begintt
\centerline{A paper by A. U. Thor%
\footnote*{Supported by NSF.}}
\endtt
或者甚至在 |\halign| 中表格单元的外层使用。
%\ddanger Topinserts work fine by themselves, and footnotes work fine by
%themselves, but complications can arise when you try to mix them in
%devious ways. For example, if a |\pageinsert| floats to the page that
%follows a long footnote that had to be broken, both of the held-over
%insertions may try to force themselves onto the same page, and an overfull
%vbox may result. Furthermore, insertions cannot appear within insertions,
%so you can't use |\footnote| within a |\topinsert|. If you really need a
%footnote in some caption, there's a ^|\vfootnote| macro that can be used
%in vertical mode. To use it, you put a reference mark like~`|*|' in the
%caption, and then you say `|\vfootnote*{The footnote}|' somewhere on the
%page where you guess that the caption will finally fall. In such complex
%circumstances you might want to rethink whether or not you are really
%using the most appropriate format for the exposition of your ideas.
\ddanger 只有顶部插入的话可以顺利处理,只有脚注的话也行,
但是如果用不常用的方法把它们混合起来就复杂了。%