forked from JohnWall2016/the-texbook-cn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchapter19.tex
executable file
·1509 lines (1441 loc) · 78.5 KB
/
chapter19.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 19. Displayed Equations
\beginchapter Chapter 19. 陈列公式
\origpageno=185
%By now you know how to type mathematical formulas so that \TeX\ will handle
%them with supreme elegance; your knowledge of math typing is nearly complete.
%But there is one more part to the story, and the purpose of this chapter
%is to present the happy ending. We have discussed how to deal with individual
%formulas; but ^{displays} often involve a whole bunch of different formulas,
%or different pieces of a huge formula, and it's a bit of a problem to
%lay them out so that they line up properly with each other. Fortunately,
%large displays generally fall into a few simple patterns.
\1现在你已经知道怎样输入数学公式以得到漂亮的排版了;
数学排版方面的知识基本差不多了。%
但是还有部分内容,本章将要讨论它。%
我们已经讨论过怎样排版单个公式;
但是陈列公式常常包括一整组不同的公式,
或者一个大公式的不同片段,
并且在把它们正确地对齐时会出现一点问题。%
幸运的是,大量陈列公式一般可以分为几个简单的类型。
%\subsection One-line displays. Before plunging into the general question
%of display layout, let's recapitulate what we have already covered. If
%you type `|$$|\<formula>|$$|', \TeX\ will display the formula
%^^{dollardollar} in flamboyant display style, centering it on a line by
%itself. We have also noted in Chapter~18 that it's possible to display two
%short formulas at once, by typing
%`|$$|\<formula$_1$>^|\qquad|\<formula$_2$>|$$|'; this reduces the
%two-formula problem to a one-formula problem. You get the two formulas
%separated by two quads of space, the whole being centered on a line.
\subsection 单行陈列公式.
在讨论陈列公式排版的一般问题前,我们先简要地复习一下。%
如果输入`|$$|\<formula>|$$|', 那么 \TeX\ 将把公式用精美的陈列样式显示出来,
自己单独占一行,并且居中。%
我们还注意到,在第十八章,可以同时显示两个短公式,只要输入%
`|$$|\<formula$_1$>|\qquad|\<formula$_2$>|$$|'即可;
它把两个公式的问题简化为一个公式的问题。%
你所得到的两个公式用两个 quad 的间距隔开,而它们整体行居中。
%Displayed equations often involve ordinary text. Chapter~18 explains
%how to get roman type into formulas without leaving math mode, but the
%best way to get text into a display is to put it into an ^|\hbox|.
%There needn't even be any math at all; to typeset
%$$\hbox{Displayed Text}$$
%you can simply say `|$$\hbox{Displayed Text}$$|'. But here's a more interesting
%example:
%$$X_n=X_k \qquad\hbox{if and only if}\qquad
% Y_n=Y_k \quad\hbox{and}\quad Z_n=Z_k.$$
%Formulas and text were combined in this case by typing
%\begintt
%$$X_n=X_k \qquad\hbox{if and only if}\qquad
% Y_n=Y_k \quad\hbox{and}\quad Z_n=Z_k.$$
%\endtt
%Notice that |\qquad| appears around `if and only if', but a single ^|\quad|
%surrounds `and'; this helps to indicate that the $Y$ and~$Z$ parts of the
%display are related more closely to each other than to the $X$~part.
陈列公式常常包含普通文本。%
第十八章讨论了怎样在不离开数学模式的情况下在公式中输入 roman 字体,
但是在陈列公式中排版文本的最好方法是把它放在 |\hbox| 中。%
这样甚至不需要任何数学内容;
为了得到
$$\hbox{要显示的文本}$$
可以只输入`|$$\hbox{要显示的文本}$$|'。%
但是更好的例子在下面:
$$X_n=X_k \qquad\hbox{if and only if}\qquad
Y_n=Y_k \quad\hbox{and}\quad Z_n=Z_k.$$
在这种情况下,公式和文本都被组合起来,只要输入
\begintt
$$X_n=X_k \qquad\hbox{if and only if}\qquad
Y_n=Y_k \quad\hbox{and}\quad Z_n=Z_k.$$
\endtt
注意,|\qquad| 出现在`if and only if'两边,但是在`and'两边只有一个 |\quad|;
这清楚地表明了陈列公式的 $Y$ 和 $Z$ 的关系比它们与 $X$ 的关系更近。
%Consider now the display
%$$Y_n=X_n\bmod p \quad\hbox{and}\quad Z_n=X_n\bmod q
% \qquad\hbox{for all }n\ge0.$$
%Can you figure out how to type this? One solution is
%\begintt
%$$Y_n=X_n\bmod p \quad\hbox{and}\quad Z_n=X_n\bmod q
% \qquad\hbox{for all }n\ge0.$$
%\endtt
%Notice that a space has been left after `|all|' in the hbox here, since spaces
%disappear when they are out in formula-land. But there's a simpler and more
%logical way to proceed, once you get used to \TeX's idea of modes: You can type
%\begintt
%... \qquad\hbox{for all $n\ge0$.}$$
%\endtt
%Wow---that's math mode inside of horizontal mode inside of display
%math mode. But in this way your manuscript mirrors what you are trying to
%accomplish, while the previous solution (with the space after `|all|')
%looks somewhat forced.
现在看看陈列公式
$$Y_n=X_n\bmod p \quad\hbox{and}\quad Z_n=X_n\bmod q
\qquad\hbox{for all }n\ge0.$$
你知道怎样输入吗?一种方法是
\begintt
$$Y_n=X_n\bmod p \quad\hbox{and}\quad Z_n=X_n\bmod q
\qquad\hbox{for all }n\ge0.$$
\endtt
注意,这里 hbox 中的`|all|'后面有一个空格,
因为当空格出现在公式区时会去掉。%
但是一旦你理解了 \TeX\ 的模式思想,就有更好和更合理的方法:
可以输入
\begintt
... \qquad\hbox{for all $n\ge0$.}$$
\endtt
\1噢——是陈列数学模式中的水平模式中的数学模式。%
但是用这种方法,文稿正好反映出你要表达的意思,
而前一种方法(`|all|'后面加空格)看起来有点不得已。
%\exercise Typeset the following four displays (one at a time):
%$$\openup1\jot\displaylines{
%\sum_{n=0}^\infty a_nz^n\qquad\hbox{converges if}\qquad
% \vert z\vert<\Bigl(\limsup_{n\to\infty}
% \root n\!\of{\vert a_n\vert}\,\Bigr)^{-1}.\cr
%{f(x+\Delta x)-f(x)\over\Delta x}\to f'(x)\qquad\hbox{as $\Delta x\to0$.}\cr
%\noalign{\vskip2pt}
%\Vert u_i\Vert=1,\qquad u_i\cdot u_j=0\quad\hbox{if $i\ne j$.}\cr
%\it\hbox{The confluent image of}\quad\left\{
% \matrix{\hbox{an arc}\hfill\cr\hbox{a circle}\hfill\cr
% \hbox{a fan}\hfill\cr}
% \right\}\quad\hbox{is}\quad\left\{
% \matrix{\hbox{an arc}\hfill\cr\hbox{an arc or a circle}\hfill\cr
% \hbox{a fan or an arc}\hfill\cr}\right\}.\cr
%\noalign{\vskip-8pt}}$$
%^^|\Delta| ^^|\Vert|
%% the last example comes from Proc AMS 55 (1976), 410, with typos corrected
%\answer |$$\sum_{n=0}^\infty a_nz^n\qquad\hbox{converges if}\qquad|\parbreak
%| |\||z|\||<\Bigl(\limsup_{n\to\infty}\root n\!\of{|\||a_n|\|^^|\root|
% |}\,\Bigr)^{-1}.$$|\kern-.33pt\par
%\smallskip
%|$${f(x+\Delta x)-f(x)\over\Delta x}\to f'(x)|\parbreak
%| \qquad\hbox{as $\Delta x\to0$.}$$|\par
%\smallskip
%|$$\|\||u_i\|\||=1,\qquad u_i\cdot u_j=0\quad\hbox{if $i\ne j$.}$$|\par
%\smallskip
%|$$\it\hbox{The confluent image of}\quad\left\{|\parbreak
%| \matrix{\hbox{an arc}\hfill\cr\hbox{a circle}\hfill\cr|\parbreak
%| \hbox{a fan}\hfill\cr}|\parbreak
%| \right\}\quad\hbox{is}\quad\left\{|\parbreak
%| \matrix{\hbox{an arc}\hfill\cr|\parbreak
%| \hbox{an arc or a circle}\hfill\cr|\parbreak
%| \hbox{a fan or an arc}\hfill\cr}\right\}.$$|\par
%\smallskip\noindent
%The first example includes |\!| and |\,| to give slightly refined spacing;
%but the point of the problem was to illustrate the hbox, not to fuss over
%such extra details.
%The last example can be done much more simply using the ideas of
%Chapter~22, if you don't mind descending to the level of \TeX\ primitives;
%for example, the first matrix could be replaced by ^^|\halign|
%\begintt
%\,\vcenter{\halign{#\hfil\cr an arc\cr a circle\cr a fan\cr}}\,
%\endtt
%and the second is similar.
\exercise 输入下列四个陈列公式(一次一个):
$$\openup1\jot\displaylines{
\sum_{n=0}^\infty a_nz^n\qquad\hbox{converges if}\qquad
\vert z\vert<\Bigl(\limsup_{n\to\infty}
\root n\!\of{\vert a_n\vert}\,\Bigr)^{-1}.\cr
{f(x+\Delta x)-f(x)\over\Delta x}\to f'(x)\qquad\hbox{as $\Delta x\to0$.}\cr
\noalign{\vskip2pt}
\Vert u_i\Vert=1,\qquad u_i\cdot u_j=0\quad\hbox{if $i\ne j$.}\cr
\it\hbox{The confluent image of}\quad\left\{
\matrix{\hbox{an arc}\hfill\cr\hbox{a circle}\hfill\cr
\hbox{a fan}\hfill\cr}
\right\}\quad\hbox{is}\quad\left\{
\matrix{\hbox{an arc}\hfill\cr\hbox{an arc or a circle}\hfill\cr
\hbox{a fan or an arc}\hfill\cr}\right\}.\cr
\noalign{\vskip-8pt}}$$
\answer |$$\sum_{n=0}^\infty a_nz^n\qquad\hbox{converges if}\qquad|\parbreak
| |\||z|\||<\Bigl(\limsup_{n\to\infty}\root n\!\of{|\||a_n|\|^^|\root|
|}\,\Bigr)^{-1}.$$|\kern-.33pt\par
\smallskip
|$${f(x+\Delta x)-f(x)\over\Delta x}\to f'(x)|\parbreak
| \qquad\hbox{as $\Delta x\to0$.}$$|\par
\smallskip
|$$\|\||u_i\|\||=1,\qquad u_i\cdot u_j=0\quad\hbox{if $i\ne j$.}$$|\par
\smallskip
|$$\it\hbox{The confluent image of}\quad\left\{|\parbreak
| \matrix{\hbox{an arc}\hfill\cr\hbox{a circle}\hfill\cr|\parbreak
| \hbox{a fan}\hfill\cr}|\parbreak
| \right\}\quad\hbox{is}\quad\left\{|\parbreak
| \matrix{\hbox{an arc}\hfill\cr|\parbreak
| \hbox{an arc or a circle}\hfill\cr|\parbreak
| \hbox{a fan or an arc}\hfill\cr}\right\}.$$|\par
\smallskip\noindent
第一个例子用 |\!| 和 |\,| 给出精细点的间距;
但此问题的要点是要说明 hbox,而非关注太多细节。
如果不\1介意用 \TeX\ 原始命令,
利用第 22 章的想法你可以大大简化最后一个例子;
比如第一个矩阵可以改写为^^|\halign|
\begintt
\,\vcenter{\halign{#\hfil\cr an arc\cr a circle\cr a fan\cr}}\,
\endtt
而第二个矩阵类似。
%\dangerexercise Sometimes display style is too grandiose, when the formula
%being displayed is
%$$y={1\over2}x$$
%or something equally simple. One day B. L. ^{User} tried to remedy this by
%typing it as `|$$y={\scriptstyle1\over\scriptstyle2}x$$|', but the
%resulting formula
%$$y={\scriptstyle1\over\scriptstyle2}x$$
%wasn't at all what he had in mind. What's the right way to get ^^{one half}
%^^{1/2--unslashed form} simply `$y={1\over2}x$' when you don't want big
%^{fractions in displays}?
%\answer |$$\textstyle y={1\over2}x$$|. \ (Switching to text style is
%especially common in multiline formulas. For example, you will probably
%find occasions to use ^|\textstyle| on both sides of the |&|'s within
%an ^|\eqalign|.)
\dangerexercise 当要排版的公式为
$$y={1\over2}x$$
或者类似这样的简单东西时,有时候陈列样式太大了。
有一天^{用户笨笨}希望通过输入
`|$$y={\scriptstyle1|\allowbreak|\over\scriptstyle2}x$$|'
来弥补一下,结果得到的
$$y={\scriptstyle1\over\scriptstyle2}x$$
根本不是他想要的。在不想要陈列公式中的大分式,
而仅仅得到 `$y={1\over2}x$' 时,正确的方法是什么?
\answer |$$\textstyle y={1\over2}x$$|。%
(切换到文本样式是多行公式中相当常见的用法。例如,
你将发现在 ^|\eqalign| 的 |&| 的两边有时会用到 ^|\textstyle|。)
%\dangerexercise What difference, if any, is there between the result of
%typing `|$$|\<formula>|$$|' and the result of typing
%`|$$\hbox{$|\<formula>|$}$$|'\thinspace?
%\answer The latter formula will be in text style, not display style.
%And even if you do type `|$$\hbox{$\displaystyle{|\<formula>|}$}$$|', the
%results are not quite the same, as we will see later: \TeX\ will compress
%the glue in `|$$|\<formula>|$$|' if the formula is too wide to fit on
%a line at its natural width, but the glue inside |\hbox{...}| is frozen
%at its natural width. The |\hbox| version also invokes |\everymath|.
\dangerexercise 输入 `|$$|\<formula>|$$|' 和 `|$$\hbox{$|\<formula>|$}$$|'
所得到的结果之间有什么差别么?
\answer 后一个公式将用文本样式,而不是陈列样式显示。
而且即使你确实输入了 `|$$\hbox{$\displaystyle{|\<formula>|}$}$$|',
结果也不会完全一样,这是我们稍后会看到的:
当公式太宽而无法以自然宽度放在一行时,
\TeX\ 将会压缩 `|$$|\<formula>|$$|' 的粘连,
但|\hbox{...}| 内的粘连总是固定为它的自然宽度。
|\hbox| 版本还调用了 |\everymath|。
%\dangerexercise You may have noticed that most of the displays in this
%manual are not centered; displayed material is usually aligned at the
%left with the paragraph indentation, as part of the book design, because
%this is an unusual book. Explain how you could typeset a formula like
%$$\leftline{\indent$\displaystyle
% 1-{1\over2}+{1\over3}-{1\over4}+\cdots=\ln2$}$$
%^^{displays, non-centered}
%that is off-center in this way.
%\answer One solution is to put the formula in an hbox that occupies a full line:
%\begintt
%$$\leftline{\indent$\displaystyle
% 1-{1\over2}+{1\over3}-{1\over4}+\cdots=\ln2$}$$
%\endtt
%But this takes a bit of typing. If you make the definitions
%\begintt
%\def\leftdisplay#1$${\leftline{\indent$\displaystyle{#1}$}$$}
%\everydisplay{\leftdisplay}
%\endtt
%you can type `|$$|\<formula>|$$|' as usual, and the formatting will be
%inserted automatically. \ (This doesn't work with equation numbers;
%Appendix~D illustrates how to handle them as well.)
\dangerexercise 你可能已经注意到了,本手册的大部分陈列公式都不是居中的;
因为本书不是一般的书,作为书籍设计的一部分,陈列公式一般与段落左边的缩进对齐。
看看怎样排版出下面这样不居中的公式:
$$\leftline{\indent$\displaystyle
1-{1\over2}+{1\over3}-{1\over4}+\cdots=\ln2$}$$
\answer 其中一种解法是将公式放在一个占用整行的 hbox 中:
\begintt
$$\leftline{\indent$\displaystyle
1-{1\over2}+{1\over3}-{1\over4}+\cdots=\ln2$}$$
\endtt
但这将需要多键入一些字符。如果你使用下面的定义
\begintt
\def\leftdisplay#1$${\leftline{\indent$\displaystyle{#1}$}$$}
\everydisplay{\leftdisplay}
\endtt
你就可以像往常一样键入 `|$$|\<formula>|$$|',而公式的格式化将被自动插入。%
(这不能用于编号公式;附录 D 说明如何同时处理这种公式。)
%If you've had previous experience typing mathematical papers, you probably
%have been thinking, ``What about ^{equation numbers}? When is this book
%going to talk about them?'' Ah yes, now is the time to discuss those sneaky
%little labels that appear off to the side of displays. If you type
%\begindisplay
%|$$|\<formula>|\eqno|\<formula>|$$|
%\enddisplay
%\TeX\ will display the first formula and it will also put an equation number
%(the second formula) at the right-hand margin. For example,
%\begintt
%$$x^2-y^2 = (x+y)(x-y).\eqno(15)$$
%\endtt
%^^|\eqno|
%will produce this:
%$$x^2-y^2 = (x+y)(x-y).\eqno(15)$$
%You can also get equation numbers at the left-hand margin, with ^|\leqno|.
%For example,
%\begintt
%$$x^2-y^2 = (x+y)(x-y).\leqno(16)$$
%\endtt
%will produce this:
%$$x^2-y^2 = (x+y)(x-y).\leqno(16)$$
%Notice that you always give the equation number second, even when it is going
%to appear at the left. Everything from the |\eqno| or |\leqno| command to
%the |$$| that ends the display is the equation number. Thus, you're not
%allowed to have two equation numbers in the same display; but there's a
%way to get around that restriction, as we'll see later.
如果你有以前排版数学文章的经验,可能会想,
``方程编号放在哪里?
本书什么时候讨论它?''
的确,现在是该讨论在陈列公式外边好远才偷偷摸摸出现的小标记了。%
如果输入
\begindisplay
|$$|\<formula>|\eqno|\<formula>|$$|
\enddisplay
\1\TeX\ 就陈列显示出第一个公式,并且还把方程编号(第二个公式)放在右页边处。%
例如,
\begintt
$$x^2-y^2 = (x+y)(x-y).\eqno(15)$$
\endtt
得到的是:
$$x^2-y^2 = (x+y)(x-y).\eqno(15)$$
也可以把方程编号放在左页边处,用的是 |\leqno|。%
例如,
\begintt
$$x^2-y^2 = (x+y)(x-y).\leqno(16)$$
\endtt
得到的是:
$$x^2-y^2 = (x+y)(x-y).\leqno(16)$$
注意,方程编号总是放在第二位,即使要出现在左边。%
从 |\eqno| 到 |\leqno| 命令到结束陈列公式的 |$$| 的所有东西都是方程编号。%
因此,不允许在同一陈列公式中出现两个方程编号;
但是有一种方法可以绕过这个限制,我们后面要讨论它。
%\danger Nowadays people are using right-hand equation numbers more and more,
%because a display most often comes at the end of a sentence or clause, and
%the right-hand convention keeps the number from intruding into the clause.
%Furthermore, it's often possible to save space when a displayed equation
%follows a short text line, since less space is needed above the display;
%such savings are not possible with |\leqno|, because there's no room for
%overlap. For example, there is less space above display~(15) than there is
%above~(16) in our illustrations of\/ |\eqno| and |\leqno|, although the
%formulas and text are otherwise identical.
\danger 现在,人们越来越多地使用方程的右边编号,
因为陈列公式常常出现在句子或条款的结尾处,
右边约定使得编号与条款不混淆。%
还有,当陈列公式跟在一个短行后面时,还常常可以节约空间,
因为在陈列公式上面需要的间距更少;
用 |\leqno| 时就不能这样节约空间,
因为没有可以叠起来的空白。%
例如,在我们关于 |\eqno| 和 |\leqno| 的示例中,公式 (15) 上面的空间比公式 (16)~%
要少,虽然公式和文本这些其它东西都是一样的。
%\danger If you look closely at (15) and (16) above, you can see that the
%displayed formulas have been centered without regard to the presence of
%the equation numbers. But when a formula is large, \TeX\ makes sure that
%it does not interfere with its number; the equation number may even be
%placed on a line by itself.
\danger 如果你仔细观察上面的 (15) 和 (16), 就会发现陈列公式已经居中了,
而没有计及方程编号的出现。%
但是当公式很大时,
\TeX\ 要确保方程与编号之间互不干扰;
方程编号甚至可以单独放一行。
%\exercise How would you produce the following display?
%$$\prod_{k\ge0}{1\over(1-q^kz)}=
% \sum_{n\ge0}z^n\bigg/\!\!\prod_{1\le k\le n}(1-q^k).\eqno(16')$$
%\answer |$$\prod_{k\ge0}{1\over(1-q^kz)}=|\parbreak
% | \sum_{n\ge0}z^n\bigg/\!\!\prod_{1\le k\le n}(1-q^k).\eqno(16')$$|
\exercise 怎样单独下列陈列公式?
$$\prod_{k\ge0}{1\over(1-q^kz)}=
\sum_{n\ge0}z^n\bigg/\!\!\prod_{1\le k\le n}(1-q^k).\eqno(16')$$
\answer |$$\prod_{k\ge0}{1\over(1-q^kz)}=|\parbreak
| \sum_{n\ge0}z^n\bigg/\!\!\prod_{1\le k\le n}(1-q^k).\eqno(16')$$|
%\dangerexercise Equation numbers are math formulas, typeset in text style.
%So how can you get an equation number like `\hbox{(3--1)}'
%(with an ^{en-dash})?
%\answer |\eqno\hbox{(3--1)}|.
\dangerexercise 公式编号是用文本样式排版的数学公式。
因此,怎样才能得到象`\hbox{(3--1)}'(有一个连接号)这样的公式编号?
\answer |\eqno\hbox{(3--1)}|。
%\ddangerexercise B. L. ^{User} tried typing `|\eqno(*)|' and `|\eqno(**)|',
%and he was pleased to discover that this produced the equation numbers
%`$(*)$' and `$(**)$'. \ [He had been a bit worried that they would come out
%`(*)' and `(**)' instead.] \ But then a few months later he tried
%`|\eqno(***)|' and got a surprise. What was it?
%\answer When you type an ^{asterisk} in math mode, plain \TeX\ considers
%|*| to be a binary operation. In the cases `|(*)|' and `|(**)|', the
%binary operations are converted to type~Ord, because they don't appear in
%a binary context; but the middle asterisk in `|(***)|' remains of type~Bin.
%So the result was `$(***)$'. To avoid the extra medium spaces, you can
%type `|\eqno(*{*}*)|'; or you can change ^|\mathcode||`*|, if you never use
%|*| as a binary operation.
\ddangerexercise ^{用户笨笨}试着输入了`|\eqno(*)|' 和 `|\eqno(**)|',
他高兴地发现,得到的方程编号是`$(*)$'和`$(**)$'。%
[ 他为结果不是 `(*)' 和 `(**)' 而感到有点困惑。]
但是,几个月后,他输入 `|\eqno(***)|' 却得到意想不到的结果。这个结果是什么?
\answer 当你在数学模式中输入^{星号}时,plain \TeX\ 将 |*| 视为二元运算符。
在 `|(*)|' 和 `|(**)|' 的情形,因为它们没出现在二元运算环境中,
二元运算符被转换为 Ord 类型;但 `|(***)|' 中间的星号将保留为 Bin 类型。
所以结果将为 `$(***)$'。为避免多余的空白,你可以输入 `|\eqno(*{*}*)|';
如果你从不将 |*| 用作二元运算符,你也可以改变 ^|\mathcode||`*|。
%\ddanger Somewhere in this manual there ought to be a description of exactly
%how \TeX\ displays formulas; i.e., how it centers them, how it places the
%equation numbers, how it inserts extra space above and below, and so on.
%Well, now is the time for those rules to be stated. They are somewhat
%complex, because they interact with things like |\parshape|, and because
%they involve several parameters that haven't been discussed yet. The purpose
%of the rules is to explain exactly what sorts of boxes, glue, and
%penalties are placed onto the current ^{vertical list} when a display occurs.
\ddanger \1应该在本手册的某些地方讨论一下 \TeX\ 到底是怎样排版陈列公式的:
即,怎样把它们居中,怎样放方程编号,怎样在上下插入额外间距等等。%
嗯,现在该讨论它们了。%
它们是有些复杂,因为它们与象 |\parshape| 这样的东西互相影响,
并且包括了几个还未讨论的参数。%
这些规则的目的就是当出现陈列公式时,要把什么样的盒子,粘连和惩罚%
放在当前垂直列中。
%\ddanger If a display occurs after, say, four lines of a paragraph, \TeX's
%internal register called ^|\prevgraf| will be equal to~4 when the display
%starts. The display will be assumed to take three lines, so |\prevgraf|
%will become~7 when the paragraph is resumed at the end of the display
%(unless you have changed |\prevgraf| in the meantime). \TeX\ assigns
%special values to three \<dimen> parameters immediately after the opening
%|$$| is sensed: ^|\displaywidth| and ^|\displayindent| are set to the
%line width~$z$ and the shift amount~$s$ for line number |\prevgraf|${}+2$,
%based on the current paragraph shape or hanging indentation. \ (Usually
%|\displaywidth| is the same as ^|\hsize|, and |\displayindent| is zero,
%but the paragraph shape can vary as described in Chapter~14.) \ Furthermore,
%^|\predisplaysize| is set to the effective width~$p$ of the line preceding
%the display, as follows: If there was no previous line (e.g., if the |$$|
%was preceded by ^|\noindent| or by the closing |$$| of another display),
%$p$~is set to $-16383.99999\pt$ (i.e., to the smallest legal dimension,
%$-$^|\maxdimen|). Otherwise \TeX\ looks inside the hbox that was formed
%by the previous line, and sets $p$ to the position of the right edge of
%the rightmost box inside that hbox, plus the indentation by which the
%enclosing hbox has been moved right, plus two ems in the current font.
%However, if this value of~$p$ depends on the fact that glue in that hbox
%was stretching or shrinking---for example, if the ^|\parfillskip| glue is
%finite, so that the material preceding it has not been set at its natural
%width---then $p$~is set to |\maxdimen|. \ (This doesn't happen
%often, but it keeps \TeX\ machine independent, since $p$~never depends on
%quantities that may be rounded differently on different computers.) \
%Notice that |\displaywidth| and |\displayindent| are not
%affected by |\leftskip| and |\rightskip|, but
%|\predisplaysize| is. The values of\/ |\displaywidth|,
%|\displayindent|, and |\predisplaysize|
%will be used by \TeX\ after the displayed formula has been
%read, as explained below; your program can examine them and/or change
%them, if you want the typesetting to be done differently.
\ddanger 如果陈列公式出现在段落的第 4 行后面,
在陈列公式开始时, \TeX\ 的内部寄存器 |\prevgraf| 就等于 4。%
陈列公式设置的行数为 3, 因此当在陈列公式结束处恢复到段落时,
~|\prevgraf| 就变成 7~(除非在其间你改动过 |\prevgraf|)。%
在读入开符号 |$$| 后, \TeX\ 紧接着就指定了三个 \<dimen> 参数的特殊值:
|\displaywidth| 设定的是行的宽度 $z$, |\displayindent| 按照当前段落的形状%
和悬挂缩进设定了第 |\prevgraf|${}+2$ 行的偏移量 $s$。%
(一般情况下,|\displaywidth| 与 |\hsize| 是一样的,
而 |\displayindent| 等于零,
但是段落形状可以象第十四章讨论的那样变化。)
还有,|\predisplaysize| 设定了陈列公式前面行的有效宽度 $p$, 如下:
如果前面没有行(比如,如果 |$$| 前面是 |\noindent| 或者是另一个陈列公式的闭符号 |$$|),
~$p$ 就设定为 $-16383.99999\pt$(即,可用的最小尺寸,$-$|\maxdimen|)。%
否则, \TeX\ 要根据前面的行所形成的 hbox 把 $p$ 设定为此 hbox 中最右边%
盒子的右边界的位置,加上把封装盒子向右移的缩进,再加上当前字体的 2 em。%
但是,如果 $p$ 的这个值由此盒子中粘连的伸缩所确定——例如,
如果 |\parfillskip| 粘连是有限的,使得在其前面的内容不是其自然宽度——%
那么 $p$ 就设定为 |\maxdimen|。%
(这不是常常出现,但是它保持了 \TeX\ 系统的独立性,
因为 $p$ 不依赖于不同计算机的四舍五入得到的量。)
注意,|\displaywidth| 和 |\displayindent| 不受 |\leftskip| 和 |\rightskip| 影响,
但是 |\predisplaysize| 却受其影响。%
在陈列公式读入后, \TeX\ 才用到 |\displaywidth|, %
|\displayindent| 和 |\predisplaysize| 的值,其讨论见下面;
如果要得到不同的排版,可用检验和/或改变它们。
%\ddanger After a display has been read, \TeX\ converts it from a math list
%to a horizontal list~$h$ in display style, as explained in
%Appendix~G\null. An equation number, if present, is processed in text
%style and put into an hbox~$a$ with its natural width. Now the fussy
%processing begins: Let $z$, $s$, and~$p$ be the current values of\/\
%|\displaywidth|, |\displayindent|, and
%|\predisplaysize|. Let $q$ and~$e$ be zero if there is no equation
%number; otherwise let~$e$ be the width of the equation number, and let~$q$
%be equal to $e$~plus one quad in the symbols font (i.e., in
%^|\textfont||2|). Let $w_0$ be the natural width of the displayed
%formula~$h$. If $w_0+q\le z$, list~$h$~is packaged in an hbox~$b$ having
%its natural width~$w_0$. But if $w_0+q>z$ (i.e., if the display is too
%wide to fit at its natural width), \TeX\ performs the following ``^{squeeze
%routine}'': If $e\ne0$ and if there is enough shrinkability in the
%displayed formula~$h$ to reduce its width to $z-q$, then list $h$ is
%packaged in an hbox~$b$ of width~$z-q$. Otherwise $e$ is set to zero, and
%list~$h$ is packaged in a (possibly overfull) hbox~$b$ of width $\min(w_0,z)$.
\ddanger 在读入陈列公式后, \TeX\ 把它从数学列转换到陈列样式的水平列 $h$,
就象在附录 G 中讨论的那样。%
如果出现方程编号,就把它按文本样式处理,并且放在宽度为自然宽度的 hbox 中。%
现在进行烦琐的处理:
设 $z$, ~$s$ 和 $p$ 是 |\displaywidth|, |\displayindent| 和 |\predisplaysize|~%
的当前值。%
如果没有方程编号,就设 $q$ 和 $e$ 为零;
否则,设 $e$ 为方程编号的宽度,
并且设 $q$ 等于 $e$ 加上符号字体(即,|\textfont||2|)的一个 quad。%
设 $w_0$ 是陈列公式 $h$ 的自然宽度。%
如果 $w_0+q\le z$, 就把列 $h$ 包装进宽度为自然宽度 $w_0$ 的 hbox~~$b$ 中。%
但是如果 $w_0+q>z$~(即,如果陈列公式太宽按照自然宽度放不下),
那么 \TeX\ 执行下列``挤压程序'':
如果 $e\ne0$ 并且在陈列公式 $h$ 中有足够的收缩性把其宽度减小到 $z-q$,
那么列 $h$ 就包装进宽度为 $z-q$ 的 hbox~~$b$ 中。%
否则,把 $e$ 设为零,并且把列 $h$ 包装进宽度为 $\min(w_0,z)$ 的 hbox~~$b$ 中%
(可能溢出)。
%\ddanger (Continuation.) \ \TeX\ tries now to center the display without
%regard to the equation number. But if such centering would make it too close
%to that number (where ``too close'' means that the space between them is less
%than the width~$e$), the equation is either centered in the remaining space
%or placed as far from the equation number as possible. The latter alternative
%is chosen only if the first item on list~$h$ is glue, since \TeX\ assumes that
%such glue was placed there in order to control the spacing precisely.
%But let's state the rules more formally: Let~$w$ be the width of box~$b$.
%\TeX\ computes a displacement~$d$, to be used later when positioning box~$b$,
%by first setting $d={1\over2}(z-w)$. If $e>0$ and if $d<2e$, then $d$~is
%reset to ${1\over2}(z-w-e)$ or to zero, where zero is chosen if list~$h$
%begins with a glue item.
\ddanger (续) 现在 \TeX\ 试着把陈列公式居中,而不管方程编号。%
但是如果这样的居中使得它与此编号太近(``太近''就是它们之间的间距小于宽度 $e$),
\1那么方程在剩下的间距上居中,或者放在离方程编号尽可能远的地方。%
只有当列 $h$ 上的第一个项目是粘连时,才选择后一种方法,
因为 \TeX\ 假定这样的粘连放在那里是为了精确地控制间距。%
但是我们要正式给出规则:
设 $w$ 是盒子 $b$ 的宽度。%
通过首先设 $d={1\over2}(z-w)$ 来计算位移量 $d$——当放置盒子 $b$ 时要用到它。%
如果 $e>0$ 并且 $d<2e$, 那么 $d$ 被重新设定为 ${1\over2}(z-w-e)$ 或者零,
其中只有列 $h$ 的开头为一个粘连项目时才选择零。
%\ddanger (Continuation.) \ \TeX\ is now ready to put things onto the current
%vertical list, just after the material previously constructed for the
%paragraph-so-far. First comes a ^{penalty} item, whose cost is an integer
%parameter called ^|\predisplaypenalty|. Then comes glue. If $d+s\le p$,
%or if there was a left equation number (|\leqno|), \TeX\ sets $g_a$ and
%$g_b$ to glue items specified by the parameters ^|\abovedisplayskip|
%and ^|\belowdisplayskip|, respectively; otherwise $g_a$ and $g_b$ become
%glue items corresponding to ^|\abovedisplayshortskip| and
%^|\belowdisplayshortskip|. \ [Translation: If the predisplaysize is short
%enough so that it doesn't overlap the displayed formula, the glue above and
%below the display will be ``short'' by comparison with the glue that is
%used when there is an overlap.] \ If $e=0$ and if there is an |\leqno|,
%the equation number is appended as an hbox by itself, shifted right~$s$ and
%preceded by interline glue as usual; an infinite penalty is also appended,
%to prevent a page break between this number and the display. Otherwise
%a glue item~$g_a$ is placed on the vertical list.
\ddanger (续) 现在 \TeX\ 要把这些东西放在当前垂直列,紧接在前面段落所%
构造的内容后面。%
首先出现的是一个惩罚项目,它的成本是整数参数 |\predisplaypenalty|。%
接着出现的是粘连。%
如果 $d+s\le p$, 或者如果方程编号在左边(|\leqno|), 那么 \TeX\ 分别把 $g_a$~%
和 $g_b$ 设置为给定的粘连项目参数 |\abovedisplayskip| 和 |\belowdisplayskip|;
否则 $g_a$ 和 $g_b$ 就变成对应于 |\abovedisplayshortskip| 和%
~|\belowdisplayshortskip| 的粘连项目。%
[转换:如果 predisplaysize 足够小,使得它与陈列公式不重叠,
那么陈列公式上下的粘连就比有重叠时的粘连要``小''。]
如果 $e=0$ 并且如果有 |\leqno|, 那么方程编号就就象一个 hbox 一样追加在自己后面,
向右平移 $s$ 并且在前面象通常那样放上行间粘连;
还要追加一个无限大惩罚,来防止这个编号与陈列公式之间断行。%
否则,就把粘连项目 $g_a$ 放在垂直列中。
%\ddanger (Continuation.) \ Now comes the displayed equation itself. If
%$e\ne0$, the equation number box~$a$ is combined with the formula box~$b$ as
%follows: Let~$k$ be a kern of width $z-w-e-d$. In the |\eqno| case, box~$b$
%is replaced by an hbox containing $(b,k,a)$; in the |\leqno| case, box~$b$
%is replaced by an hbox containing $(a,k,b)$, and $d$~is set to zero. In all
%cases, box~$b$ is then appended to the vertical list, shifted right by~$s+d$.
\ddanger (续) 现在出现的是陈列公式自己了。%
如果 $e\ne 0$, 那么方程编号的盒子 $a$ 就与公式的盒子 $b$ 如下组合起来:
设 $k$ 为宽度为 $z-w-e-d$ 的紧排。%
在 |\eqno| 的情况下,盒子 $b$ 由包含 $(b,k,a)$ 的 hbox 代替;
在 |\leqno| 的情况下,盒子 $b$ 由包含 $(a,k,b)$ 的 hbox 代替,
并且把 $d$ 设为零。%
在所有情形下,接下来都把盒子 $b$ 追加到垂直列中,向右平移 $s+d$。
%\ddanger (Continuation.) \ The final task is to append the glue or the
%equation number that follows the display. If there was an |\eqno| and if
%$e=0$, an infinite penalty is placed on the vertical list, followed by the
%equation number box~$a$ shifted right by $s+z$ minus its width, followed
%by a penalty item whose cost is the value of\/ ^|\postdisplaypenalty|.
%Otherwise a penalty item for the |\postdisplaypenalty| is appended
%first, followed by a glue item for~$g_b$ as specified above. \TeX\ now
%adds~3 to |\prevgraf| and returns to horizontal mode, ready to resume the
%paragraph.
\ddanger (续) 最后一个任务就是追加上粘连或跟在陈列公式下面的方程编号。%
如果有一个 |\eqno| 并且 $e=0$, 就在垂直列中放一个无限大惩罚;
后面是方程编号的盒子 $a$, 它向右平移 $s+z$ 减掉其宽度的距离;
再接下来是成本为 |\postdisplaypenalty| 的值的惩罚项目。%
否则,首先追加的是 |\postdisplaypenalty| 的惩罚项目,
接着是由上面给出的 $g_b$ 的粘连项目。%
现在, \TeX\ 把 |\prevgraf| 增加 3 并且返回水平模式,
就回复到段落。
%\ddanger One consequence of these rules is that you can force an equation
%number to appear on a line by itself by making its width zero, i.e.,
%by saying either `|\eqno|^|\llap||{$|\<formula>|$}|' or
%`|\leqno|^|\rlap||{$|\<formula>|$}|'. This makes $e=0$, and
%the condition $e=0$ controls \TeX's positioning logic, as explained
%in the rules just given.
\ddanger 这些规则的一个结果就是通过把方程编号盒子的宽度变成零,
即,使用`|\eqno||\llap||{$|\<formula>|$}|'%
或者`|\leqno||\rlap||{$|\<formula>|$}|', 你可以把它单独放在一行上。%
它使得 $e=0$, 并且条件 $e=0$ 在逻辑上控制着 \TeX\ 的放置方法,
就象刚刚讨论的规则那样。
%\ddanger Plain \TeX\ sets |\predisplaypenalty=10000|, because fine
%printers traditionally shun displayed formulas at the very top of a page.
%You can change |\predisplaypenalty| and
%|\postdisplaypenalty| if you want to encourage or discourage
%page breaks just before or just after a display. For example,
%`\hbox{|$$\postdisplaypenalty=|}\allowbreak\hbox{|-10000|\<formula>|$$|}'
%will force a page break, putting the formula at the bottom line. It is better
%to force a ^{page break} this way than to say ^|\eject| right after |$$...$$|;
%such an eject (which follows the |\belowdisplayskip| glue below the
%display) causes the page to be short, because it leaves unwanted glue at
%the bottom.
\ddanger Plain \TeX\ 设置 |\predisplaypenalty=10000|,
因为按照惯例,好的排版应该避免把陈列公式放在页面紧顶部的地方。%
如果你希望或者不希望正好在陈列公式前或后分页,
就可以改变 |\predisplaypenalty| 和 |\postdisplaypenalty|。%
例如,`\hbox{|$$\postdisplaypenalty=|}\allowbreak\hbox{|-10000|\<formula>|$$|}'
就强制分页,把公式放在最底的一行了。%
这种强制分页的方法比在 |$$...$$| 输入 |\eject| 要好;
这样的 eject~(它跟在陈列公式下面的 |\belowdisplayskip| 粘连后)%
得到一个短页面,因为它在底部留下了不想要的粘连。
%\ddangerexercise Read the rules carefully and deduce the final position
%of `$x=y$' in the formula
%\begintt
%$$\quad x=y \hskip10000pt minus 1fil \eqno(5)$$
%\endtt
%assuming that there is no hanging indentation. Also consider |\leqno|
%instead of\/ |\eqno|.
%\answer Assuming that |\hsize| is less than $10000\pt$, the natural width of
%this equation will be too large to fit on a line; also, |\quad| specifies
%glue at the left. Therefore `$x=y$' will appear exactly $1\em$ from
%the left, and `(5)' will appear flush right. \ (The widths will satisfy
%^^{displays, non-centered} $w=z-q$, $d=0$, $k=q-e=18\rm\,mu$.) \
%In the case of\/ |\leqno|, `(5)' will appear flush left, followed by
%one quad of space in |\textfont2|, followed by one quad of space in the
%current text font, followed by `$x=y$'.
\ddangerexercise \1详细阅读上面的规则,假定没有悬挂缩进,推导出公式
\begintt
$$\quad x=y \hskip10000pt minus 1fil \eqno(5)$$
\endtt
中`$x=y$'的最后位置。要是将 |\eqno| 改为 |\leqno| 呢?
\answer 假设 |\hsize| 小于 $10000\pt$,公式的自然宽度将太大而无法放在一行;
另外,|\quad| 在左边指定了一个粘连。
因此 `$x=y$' 将出现在离左侧 $1\em$ 的位置,而 `(5)' 将靠右对齐。%
(各宽度将满足 ^^{displays, non-centered}$w=z-q$,$d=0$,$k=q-e=18\rm\,mu$。)
改为 |\leqno| 以后,`(5)' 将靠左对齐,
后面跟着 |\textfont2| 字体的 1 quad 的空白,
后面跟着当前文本字体的 1 quad 空白,后面跟着 `$x=y$'。
%\ddanger \TeX\ also allows ``^{alignment displays},'' which are not
%processed in math mode because they contain no formulas at the outer
%level. An alignment display is created by commands of the general form
%\begindisplay
%|$$|\<assignments>|\halign{|\<alignment>|}|\<assignments>|$$|
%\enddisplay
%where the \<assignments> are optional things like parameter changes that do not
%produce any math lists. In such displays, the |\halign| is processed exactly
%as if it had appeared in vertical mode, and it will construct a vertical
%list~$v$ as usual, except that each row of the alignment will be shifted
%right by the ^|\displayindent|. After the alignment and the closing
%assignments have been processed, \TeX\ will put a ^|\predisplaypenalty|
%item and some ^|\abovedisplayskip| glue on the main vertical list, followed
%by~$v$, followed by a ^|\postdisplaypenalty| item and ^|\belowdisplayskip|
%glue. Thus, alignment displays are essentially like ordinary alignments,
%except that they can interrupt paragraphs; furthermore, they are embedded in
%glue and penalties just like other displays. The ^|\displaywidth| and
%^|\predisplaysize| do not affect the result, although you could use
%those parameters in your ^|\halign|. An entire alignment display is considered
%to be only three lines long, as far as ^|\prevgraf| is concerned.
\ddanger \TeX\ 还允许``对齐的陈列公式'',
它们不在数学模式下处理,因为在外层没有包含公式。%
对齐的陈列公式由一般形式为
\begindisplay
|$$|\<assignments>|\halign{|\<alignment>|}|\<assignments>|$$|
\enddisplay
的命令生成,其中 \<assignments> 是象参数那样的可选内容,它不输出任何数学列。%
在这样的陈列公式中,|\halign| 就象它出现在垂直模式中那样处理,
并且构造出象通常那样的垂直列 $v$, 只是对齐的每行后向右平移了 |\displayindent|。%
在对齐和闭对齐都处理完后, \TeX\ 将把一个 |\predisplaypenalty| 项目%
和一些 |\abovedisplayskip| 粘连放在主垂直列,
接着是 $v$, 再接下来是一个 |\postdisplaypenalty| 项目和 |\belowdisplayskip| 粘连。%
这样,对齐的陈列公式本质上就象普通的对齐一样了,
只是它们可以插在段落中间;
还有,它们就象其它陈列公式那样嵌入在粘连和惩罚中。%
|\displaywidth| 和 |\predisplaysize| 不会影响结果,
虽然你可以在 |\halign| 使用它们。%
至于 |\prevgraf|, 这个对齐列表只看作三行长。
%\subsection Multi-line displays. OK, the use of displayed formulas is
%very nice. But when you try typing a lot of manuscripts you will run into
%some displays that don't fit the simple pattern of a one-line formula with
%or without an equation number. Plain \TeX\ provides special control
%sequences that will cover most of the remaining cases.
\subsection 多行陈列公式.
好,陈列公式非常有用。%
但是当你要排版许多文稿时,就会发现有些陈列公式只用有无编号的单行方程这种%
简单式样不合适。%
Plain \TeX\ 提供了特殊控制系列来解决大多数剩下的问题。
%Multi-line displays usually consist of several equations that should be
%lined up by their `$=$'~signs, as in
%$$\eqalign{X_1+\cdots+X_p&=m,\cr
% Y_1+\cdots+Y_q&=n.\cr}$$
%The recommended procedure for such a display is to use ^|\eqalign|,
%which works with special markers |&| ^^{ampersand} and ^|\cr| that we
%have already encountered in connection with |\cases| and |\matrix|
%in Chapter~18. Here's how to type this particular one:
%\begintt
%$$\eqalign{X_1+\cdots+X_p&=m,\cr
% Y_1+\cdots+Y_q&=n.\cr}$$
%\endtt
%There can be any number of equations in an |\eqalign|; the general pattern is
%$$\halign{\indent#&#\hfil\cr
%|\eqalign{|&\<left-hand side$_1$>|&|\<right-hand side$_1$>|\cr|\cr
% &\<left-hand side$_2$>|&|\<right-hand side$_2$>|\cr|\cr
%\noalign{\vskip-2pt}
% &\qquad\vdots\cr
% &\<left-hand side$_n$>|&|\<right-hand side$_n$>|\cr}|\cr}$$
%where each \<right-hand side> starts with the symbol on which you want
%alignment to occur. For example, every right-hand side often begins
%with an $=$~sign. The equations will be typeset in display style.
多行陈列公式通常由几个方程组成,它们的`$=$'应当对齐,就象下面这样:
$$\eqalign{X_1+\cdots+X_p&=m,\cr
Y_1+\cdots+Y_q&=n.\cr}$$
这样的陈列公式建议使用的命令是 |\eqalign|,
它用到特殊标记 |&| 和 |\cr|, 这些我们在第十八章中与 |\cases| 和 |\matrix|~%
有关的地方已经见过。%
下面就是上面公式的输入方法:
\begintt
$$\eqalign{X_1+\cdots+X_p&=m,\cr
Y_1+\cdots+Y_q&=n.\cr}$$
\endtt
在 |\eqalign| 中可以有任意个方程;
一般样式为
$$\halign{\indent#&#\hfil\cr
|\eqalign{|&\<left-hand side$_1$>|&|\<right-hand side$_1$>|\cr|\cr
&\<left-hand side$_2$>|&|\<right-hand side$_2$>|\cr|\cr
\noalign{\vskip-2pt}
&\qquad\vdots\cr
&\<left-hand side$_n$>|&|\<right-hand side$_n$>|\cr}|\cr}$$
其中每个 \<right-hand side> 以要对齐的符号开头。%
\1例如,每个右边都常常以 $=$ 开头。%
方程用陈列样式排版。
%\exercise In practice, the left-hand sides of aligned formulas are often
%blank, and the alignment is often done with respect to other symbols
%as well as~$=$. For example, the following display is typical; see if you
%can guess how the author typed it:
%$$\eqalign{T(n)\le T(2^{\lceil\lg n\rceil})
% &\le c(3^{\lceil\lg n\rceil}-2^{\lceil\lg n\rceil})\cr
% &<3c\cdot3^{\lg n}\cr
% &=3c\,n^{\lg3}.\cr}$$ % from v2 p279
%\answer (Note in particular that the final `|.|'\ comes {\sl before\/} the
%final `|\cr|'.)
%\begintt
%$$\eqalign{T(n)\le T(2^{\lceil\lg n\rceil})
% &\le c(3^{\lceil\lg n\rceil}-2^{\lceil\lg n\rceil})\cr
% &<3c\cdot3^{\lg n}\cr
% &=3c\,n^{\lg3}.\cr}$$
%\endtt
\exercise 在实践中,要对齐的公式的左边常常是空的,
对齐经常出现在其它符号以及 $=$ 上。
例如,下列陈列公式就比较典型;看看你是否知道作者是怎样输入的:
$$\eqalign{T(n)\le T(2^{\lceil\lg n\rceil})
&\le c(3^{\lceil\lg n\rceil}-2^{\lceil\lg n\rceil})\cr
&<3c\cdot3^{\lg n}\cr
&=3c\,n^{\lg3}.\cr}$$ % from v2 p279
\answer (特别要注意最后的 `|.|' 要放在最后一个 `|\cr|' {\sl 之前\/}。)
\begintt
$$\eqalign{T(n)\le T(2^{\lceil\lg n\rceil})
&\le c(3^{\lceil\lg n\rceil}-2^{\lceil\lg n\rceil})\cr
&<3c\cdot3^{\lg n}\cr
&=3c\,n^{\lg3}.\cr}$$
\endtt
%The result of\/ |\eqalign| is a vertically centered box. This makes it easy to
%get a formula like
%$$\left\{
%\eqalign{\alpha&=f(z)\cr \beta&=f(z^2)\cr \gamma&=f(z^3)\cr}
%\right\}\qquad\left\{
%\eqalign{x&=\alpha^2-\beta\cr y&=2\gamma\cr}\right\}.$$ % meaningless
%You simply use |\eqalign| twice in the same line:
%\begintt
%$$\left\{
%\eqalign{\alpha&=f(z)\cr \beta&=f(z^2)\cr \gamma&=f(z^3)\cr}
%\right\}\qquad\left\{
%\eqalign{x&=\alpha^2-\beta\cr y&=2\gamma\cr}\right\}.$$
%\endtt
|\eqalign| 得到的结果是一个垂直居中的盒子。%
这使得很容易得到象下面这样的公式:
$$\left\{
\eqalign{\alpha&=f(z)\cr \beta&=f(z^2)\cr \gamma&=f(z^3)\cr}
\right\}\qquad\left\{
\eqalign{x&=\alpha^2-\beta\cr y&=2\gamma\cr}\right\}.$$ % meaningless
可以直接在同一行中使用 |\eqalign| 两次:
\begintt
$$\left\{
\eqalign{\alpha&=f(z)\cr \beta&=f(z^2)\cr \gamma&=f(z^3)\cr}
\right\}\qquad\left\{
\eqalign{x&=\alpha^2-\beta\cr y&=2\gamma\cr}\right\}.$$
\endtt
%\exercise Try your hand at the numbered two-line display % Polya/Szego V.29
%$$\eqalign{P(x)&=a_0+a_1x+a_2x^2+\cdots+a_nx^n,\cr
% P(-x)&=a_0-a_1x+a_2x^2-\cdots+(-1)^na_nx^n.\cr}\eqno(30)$$
%[{\sl Hint:\/} Use the fact that |\eqalign| produces a vertically centered
%box; the equation number `(30)' is supposed to appear halfway between
%the two lines.]
%\answer |$$\eqalign{P(x)&=a_0+a_1x+a_2x^2+\cdots+a_nx^n,\cr|\parbreak
% | P(-x)&=a_0-a_1x+a_2x^2-\cdots+(-1)^na_nx^n.\cr}\eqno(30)$$|\par
\exercise 练练手,看看怎样得到带编号的双行陈列公式:
$$\eqalign{P(x)&=a_0+a_1x+a_2x^2+\cdots+a_nx^n,\cr
P(-x)&=a_0-a_1x+a_2x^2-\cdots+(-1)^na_nx^n.\cr}\eqno(30)$$
[~{\KT{10}提示}:利用 |\eqalign| 得到垂直居中的盒子;
假定方程编号 `(30)' 出现在两行中间。]
\answer \1|$$\eqalign{P(x)&=a_0+a_1x+a_2x^2+\cdots+a_nx^n,\cr|\parbreak
| P(-x)&=a_0-a_1x+a_2x^2-\cdots+(-1)^na_nx^n.\cr}\eqno(30)$$|\par
%\exercise What happens if you forget the |&| in one equation of an |\eqalign|?
%\answer Both sides of that equation are considered to be on the left, so
%you get results that look like this:
%$$\openup-\jot
%\left\{\eqalign{\alpha&=f(z)\cr \beta&=f(z^2)\cr \gamma=f(z^3)\cr}
% \right\}.$$
\exercise 如果在 |\eqalign| 的一个方程中你忘记输入 |&|,会出现什么情况?
\answer 方程两边的内容都被放在左边,因此你将得到类似下面的结果:
$$\openup-\jot
\left\{\eqalign{\alpha&=f(z)\cr \beta&=f(z^2)\cr \gamma=f(z^3)\cr}
\right\}.$$
%\danger Multi-line formulas sometimes fit together in odd ways, and you'll
%find that every once in a~while you will want to move certain lines farther
%apart or closer together. If you type `^|\noalign||{|^|\vskip|\<glue>|}|'
%after any |\cr|, \TeX\ will insert the given amount of extra glue just
%after that particular line. For example,
%\begintt
%\noalign{\vskip3pt}
%\endtt
%will put $3\pt$ of additional space between lines. You can also change the
%amount of space before the first line, in the same way.
\danger 多行公式有时候用奇怪的方法放在一起,
并且偶尔你希望把行发散或紧凑一些。%
如果在任意 |\cr| 输入`|\noalign||{||\vskip|\<glue>|}|', 那么 \TeX\ 将%
在规定的行后面插入给定量的额外粘连。%
例如,
\begintt
\noalign{\vskip3pt}
\endtt
将把 $3\pt$ 的额外间距放在行之间。%
用同样的方法也可以改变第一行前面的间距。
%The next level of complexity occurs when you have several aligned
%equations with several equation numbers. Or perhaps some of the
%lines are numbered and others are not:
%$$\eqalignno{(x+y)(x-y)&=x^2-xy+yx-y^2\cr
% &=x^2-y^2;&(4)\cr
% (x+y)^2&=x^2+2xy+y^2.&(5)\cr}$$
%For this situation plain \TeX\ provides ^|\eqalignno|; you use it like
%|\eqalign|, but on each line that you want an equation number you add
%`|&|\<equation number>' just before the |\cr|. The example above was
%generated by
%\begintt
%$$\eqalignno{(x+y)(x-y)&=x^2-xy+yx-y^2\cr
% &=x^2-y^2;&(4)\cr
% (x+y)^2&=x^2+2xy+y^2.&(5)\cr}$$
%\endtt
%Notice that the second |&| is omitted unless there's an equation number.
\1当你有几个要对齐的方程和几个方程编号时,就出现更复杂的情况了。%
或许有些行有编号,有些又没有编号:
$$\eqalignno{(x+y)(x-y)&=x^2-xy+yx-y^2\cr
&=x^2-y^2;&(4)\cr
(x+y)^2&=x^2+2xy+y^2.&(5)\cr}$$
为此 plain \TeX\ 提供了 |\eqalignno|;
你可以象 |\eqalign| 那样使用它,但是在每个有方程编号的行上,只需要%
在 |\cr| 前面添加`|&|\<equation number>'即可。%
上面的例子由下面得到:
\begintt
$$\eqalignno{(x+y)(x-y)&=x^2-xy+yx-y^2\cr
&=x^2-y^2;&(4)\cr
(x+y)^2&=x^2+2xy+y^2.&(5)\cr}$$
\endtt
注意,如果没有方程编号,那么第二个 |&| 就可以省略。
%And there's also ^|\leqalignno|, which puts equation numbers at the left.
%In this case it is appropriate to move the `(4)' to the beginning
%of its equation:
%$$\leqalignno{(x+y)(x-y)&=x^2-xy+yx-y^2&(4)\cr
% &=x^2-y^2;\cr
% (x+y)^2&=x^2+2xy+y^2.&(5)\cr}$$
%Although the equation numbers appear at the left, you are still supposed to
%input them at the right, just as you do with |\leqno|; in other words,
%you should type
%`|$$\leqalignno{(x+y)(x-y)&...&(4)\cr...}$$|' to get the previous display.
还有一个 |\leqalignno|, 它把方程编号放在左边。%
在这种情况下,输出结果中`(4)'就相应地出现在方程前面:
$$\leqalignno{(x+y)(x-y)&=x^2-xy+yx-y^2&(4)\cr
&=x^2-y^2;\cr
(x+y)^2&=x^2+2xy+y^2.&(5)\cr}$$
虽然方程编号出现在左边,你却仍然要把它们输入在右边,就像 |\leqno| 那样;
换句话说,要得到前面的陈列公式,应该输入的是:
\begintt
$$\leqalignno{(x+y)(x-y)&...&(4)\cr...}$$
\endtt
%Caution: |\eqalignno| and |\leqalignno| both center the set of equations
%without regard to the widths of the equation numbers. If the equations or
%their numbers get too wide, they might overlap, yet no error message will
%be given.
注意:|\eqalignno| 和 |\leqalignno| 都把方程组居中,而不管方程编号的宽度。%
如果方程或它们的编号太宽,可能会重叠,但是却不给出错误信息。
%\exercise Typeset the following display: ^^|\gcd|
%$$\leqalignno{\gcd(u,v)&=\gcd(v,u);&(9)\cr
% \gcd(u,v)&=\gcd(-u,v).&(10)\cr}$$ % v2 p316
%\answer |$$\leqalignno{\gcd(u,v)&=\gcd(v,u);&(9)\cr|\parbreak
% | \gcd(u,v)&=\gcd(-u,v).&(10)\cr}$$|
\exercise 排版下列陈列公式:
$$\leqalignno{\gcd(u,v)&=\gcd(v,u);&(9)\cr
\gcd(u,v)&=\gcd(-u,v).&(10)\cr}$$ % v2 p316
\answer |$$\leqalignno{\gcd(u,v)&=\gcd(v,u);&(9)\cr|\parbreak
| \gcd(u,v)&=\gcd(-u,v).&(10)\cr}$$|
%\exercise And here's another one to try, just to keep in practice: ^^|\int|
%$$\vbox{
%\eqalignno{\biggl(\int_{-\infty}^\infty e^{-x^2}\,dx\biggr)^2
% &=\int_{-\infty}^\infty\int_{-\infty}^\infty
% e^{-(x^2+y^2)}\,dx\,dy\cr
% &=\int_0^{2\pi}\int_0^\infty e^{-r^2}r\,dr\,d\theta\cr
% &=\int_0^{2\pi}\biggl(-{e^{-r^2}\over2}
% \bigg\vert_{r=0}^{r=\infty}\,\biggr)\,d\theta\cr
% &=\pi.&(11)\cr}
%}$$ % cf Joy of TeX
%\answer %
%|$$\eqalignno{\biggl(\int_{-\infty}^\infty e^{-x^2}\,dx\biggr)^2|\parbreak
% | &=\int_{-\infty}^\infty\int_{-\infty}^\infty|\parbreak
% | e^{-(x^2+y^2)}\,dx\,dy\cr|\parbreak
% | &=\int_0^{2\pi}\int_0^\infty e^{-r^2}r\,dr\,d\theta\cr|\parbreak
% | &=\int_0^{2\pi}\biggl(-{e^{-r^2}\over2}|\parbreak
% | \bigg|\||_{r=0}^{r=\infty}\,\biggr)\,d\theta\cr|\parbreak
% | &=\pi.&(11)\cr}$$| ^^|\bigg|
\exercise 试试另一个,只是为了经常练习:^^|\int|
$$\vbox{
\eqalignno{\biggl(\int_{-\infty}^\infty e^{-x^2}\,dx\biggr)^2
&=\int_{-\infty}^\infty\int_{-\infty}^\infty
e^{-(x^2+y^2)}\,dx\,dy\cr
&=\int_0^{2\pi}\int_0^\infty e^{-r^2}r\,dr\,d\theta\cr
&=\int_0^{2\pi}\biggl(-{e^{-r^2}\over2}
\bigg\vert_{r=0}^{r=\infty}\,\biggr)\,d\theta\cr
&=\pi.&(11)\cr}
}$$ % cf Joy of TeX
\answer %
|$$\eqalignno{\biggl(\int_{-\infty}^\infty e^{-x^2}\,dx\biggr)^2|\parbreak
| &=\int_{-\infty}^\infty\int_{-\infty}^\infty|\parbreak
| e^{-(x^2+y^2)}\,dx\,dy\cr|\parbreak
| &=\int_0^{2\pi}\int_0^\infty e^{-r^2}r\,dr\,d\theta\cr|\parbreak
| &=\int_0^{2\pi}\biggl(-{e^{-r^2}\over2}|\parbreak
| \bigg|\||_{r=0}^{r=\infty}\,\biggr)\,d\theta\cr|\parbreak
| &=\pi.&(11)\cr}$$| ^^|\bigg|
%\danger Although |\eqalign| and |\eqalignno| look nearly the same, there's
%really a fundamental distinction between them: |\eqalign| makes a single,
%vertically centered box, which is no wider than it needs to be; but
%|\eqalignno| generates a set of lines that have the full display width
%(reaching all the way to both margins). Thus, for example, you can use
%|\eqalign| several times in a display, but |\eqalignno| can appear only
%once. If you try to use ^|\eqno| in conjunction with |\eqalign|,
%you get a decent result, but if you try to use |\eqno| in connection
%with |\eqalignno| you'll get some sort of weird error message(s).
\danger \1虽然 |\eqalign| 和 |\eqalignno| 看起来几乎一样,
但是它们之间有一个根本的不同:
|\eqalign| 得到的是一个垂直居中的盒子,宽度不会超过所需要的宽度;
但是 |\eqalignno| 生成了一组行,宽度为整个陈列公式的宽度(每行都延伸到两个边界)。%
因此,例如,可以在一个陈列公式中使用几次 |\eqalign|,
但是只能用一次 |\eqalignno|。%
如果把 |\eqno| 与 |\eqalign| 联合起来用,得到的结果还可以,
但是如果把 |\eqno| 与 |\eqalignno| 联合起来用,就会得到某些奇怪的错误信息。
%\ddanger The definitions in Appendix~B reveal why |\eqalign| and |\eqalignno|
%behave differently: |\eqalign| is an
%abbreviation for ^|\vcenter||{|^|\halign||{...}}|, while
%|\eqalignno| is an abbreviation for |\halign to\displaywidth{...}|;