-
Notifications
You must be signed in to change notification settings - Fork 18
/
chapter06.tex
781 lines (710 loc) · 30.8 KB
/
chapter06.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
% -*- coding: utf-8 -*-
% Translated by inkydragon@github
% Date of translated: 2018-05-16
\documentclass{book}
\input{preamble}
\setcounter{chapter}{5}
\begin{document}
%\chapter{Horizontal and Vertical Mode}\label{hvmode}
%\label{chap:hvmode}
\chapter{水平模式和竖直模式}\label{hvmode}
\label{chap:hvmode}
%At any point in its processing \TeX\ is in some \indexterm{mode}.
%There are six modes, divided in three categories:
%\begin{enumerate}
%\item horizontal mode and restricted horizontal mode,
%\item vertical mode and internal vertical mode, and
%\item math mode and display math mode.
%\end{enumerate}
%The math modes will be treated elsewhere (see page~\pageref{math:modes}).
%Here we shall look
%at the horizontal and vertical modes, the kinds of objects
%that can occur in the corresponding lists, and the
%commands that are exclusive for one mode or the other.
在处理文件时,\TeX\ 总处于某种\indexterm{模式}。
一共有六种模式,可划分为三类:
\begin{enumerate}
\item 水平模式和受限水平模式,
\item 竖直模式和内部竖直模式,
\item 数学模式和数学显示模式。
\end{enumerate}
数学模式将会在其他章节详细介绍(见 \pageref{math:modes} 页)。
这里我们首先关注水平和竖直模式,对象的类型会在相应的列表中出现,
并且每个模式的命令都是专用的。
%\label{cschap:vadjust}\label{cschap:showlists}
%\begin{inventory}
%\item [\cs{ifhmode}]
% Test whether the current mode is (possibly restricted) horizontal mode.
\label{cschap:vadjust}\label{cschap:showlists}
\begin{inventory}
\item [\cs{ifhmode}]
用于测试当前模式是否为(受限)水平模式。
%\item [\cs{ifvmode}]
% Test whether the current mode is (possibly internal) vertical mode.
\item [\cs{ifvmode}]
用于测试当前模式是否为(内部)竖直模式。
%\item [\cs{ifinner}]
% Test whether the current mode is an internal mode.
\item [\cs{ifinner}]
用于测试当前模式是否为内部模式。
%\item [\cs{vadjust}]
% Specify vertical material for the enclosing vertical list
% while in horizontal mode.
\item [\cs{vadjust}]
指定用于在水平模式中闭合竖直列表的指定竖直符号。
%\item [\cs{showlists}]
% Write to the log file the contents of the partial lists
% currently being built in all modes.
%\end{inventory}
\item [\cs{showlists}]
将目前所有模式正在构建的部分列表的内容写入日志。
\end{inventory}
%%\point Horizontal and vertical mode
%\section{Horizontal and vertical mode}
%\point Horizontal and vertical mode
\section{水平模式和竖直模式}
%When not typesetting mathematics, \TeX\ is in horizontal
%or vertical mode, building horizontal or vertical lists
%respectively. Horizontal mode is typically used to
%make lines of text; vertical mode is typically used
%to stack the lines of a paragraph on top of each other.
%Note that
%these modes
%are different from the internal states of \TeX's input processor
%(see page~\pageref{input:states}).
当不需要处理数学排版时,\TeX\ 处于水平模式或竖直模式中,
分别构建水平列表或竖直列表。
水平模式一般用来生成一行行的文字;
竖直模式则用来将一行行文字组成的段落堆到其他段落上。
注意!这些模式和 \TeX\ 输入处理器的内部状态
(见 \pageref{input:states} 页)并不相同。
%%\spoint Horizontal mode
%\subsection{Horizontal mode}
%\spoint Horizontal mode
\subsection{水平模式}
%The main activity in \indextermbus{horizontal}{mode} is building lines of text.
%Text on the page and text in a \cs{vbox} or \cs{vtop} is built in
%horizontal mode (this might be called `paragraph mode');
%if the text is in an \cs{hbox} there is only one line
%of text, and the corresponding mode is the restricted
%horizontal mode.
\cindextermbus{水平}{模式}的主要用来构建一行行的文字。
页面上的文字和 \cs{vbox} 或 \cs{vtop} 中的文字在水平模式中构建
(这也许叫做“段落模式”);
如果 \cs{hbox} 中仅仅有一行文字,则对应的模式为受限水平模式。
%In horizontal mode all material is added to a horizontal list.
%If this list is built in unrestricted horizontal mode, it
%will later be broken into lines and added to the surrounding vertical list.
在水平模式中,所有的材料都添加进了水平列表。
如果列表在非受限水平模式下构建,稍后它会被分解成行,
然后添加进周围的竖直列表中。
%Each element of a \indextermbus{horizontal}{list} is one of the following:
%\begin{itemize} \item a box (a character, ligature, \cs{vrule},
%or a \gr{box}),
%\item a discretionary break,
%\item a whatsit (see Chapter~\ref{io}),
%\item vertical material enclosed in \cs{mark},
%\cs{vadjust}, or \cs{insert},
%\item
%\mdqon
%glue or leaders, a kern, a penalty, or a math-on/""off item.
%\mdqoff
%\end{itemize}
%The items in the last point are all discardable.
%\emph{Discardable items}\index{discardable items}
%are called that, because they disappear in
%a break. Breaking of horizontal
%lists is discussed in Chapter~\ref{line:break}.
\cindextermbus{水平}{列表}的每一个元素都是以下各项之一:
\begin{itemize}
\item 一个盒子(一个字符、合字、\cs{vrule} 或一个 \gr{box}),
\item 一个软换行
\item 一个延迟操作(见第 \ref{io} 章)
\item 由 \cs{mark}, \cs{vadjust} 或 \cs{insert} 闭合的竖直材料,
\item
\mdqon
活动铅空或目录连接符、铅空、断行惩罚或数学模式开/""关符号
\mdqoff
\end{itemize}
最后一点的项目都是可丢弃的。
之所以称之为可丢弃项目
(\emph{Discardable items}\index{discardable items/可丢弃项目}),
是因为在列表分解之后它们就消失了。
水平列表的分解会在 \ref{line:break} 章讨论。
%\subsection{Vertical mode}
\subsection{竖直模式}
%\emph{Vertical mode}\index{mode!vertical}
%can be used to stack items on top of one another.
%Most of the time, these items are boxes
%containing the lines of paragraphs.
\cindextermbus{竖直}{模式}(\emph{Vertical mode})
用于将一个项目堆到另一个上。
大多数时候,这些项目是包含段落行的盒子。
%Stacking material can take place inside a
%vertical box, but the
%items that are stacked can also
%appear by themselves on the page. In the latter case
%\TeX\ is in vertical mode; in the former case, inside a
%vertical box, \TeX\ operates in internal vertical mode.
堆叠材料可以在竖直盒子内部进行,但这些堆起来的项目也可以在页面上单独出现。
前一种情况位于一个竖直盒子内部,
\TeX\ 会在内部竖直模式下操作;而后一种情况下 \TeX\ 将处于竖直模式中。
%In vertical mode all material is added to a vertical list.
%If this list is built in external vertical mode, it
%will later be broken when pages are formed.
在竖直模式中所有的材料都会加进竖直列表里。
如果这个列表在内部竖直模式中构建,在页面生成时,它会被分解。
%Each element of a \indextermbus{vertical}{list} is one of the following:
%\begin{itemize}
%\item a box (a horizontal or vertical box or an \cs{hrule}),
%\item a whatsit,
%\item a mark,
%\item glue or leaders, a kern, or a penalty.
%\end{itemize}
%The items in the last point are all discardable.
%Breaking of vertical lists
%is discussed in Chapter~\ref{page:break}.
\cindextermbus{竖直}{列表}的每一个元素都是以下各项之一:
\begin{itemize}
\item 一个盒子(水平或竖直盒子或一个 \cs{hrule})
\item 一个延迟操作,
\item 一个标记,
\item 活动铅空或目录连接符、铅空或断行惩罚。
\end{itemize}
列表最后一点中的项目都是可丢弃的。
竖直列表的断行将在第 \ref{page:break} 章讨论。
%There are a few exceptional conditions at the beginning
%of a vertical list: the value of \cs{prevdepth} is set
%to \n{-1000pt}. Furthermore, no \cs{parskip} glue is added
%at the top of an internal vertical list;
%at the top of the main vertical list (the top of the
%`current page') no glue or other discardable items
%are added, and \cs{topskip} glue is added when the
%first box is placed on this list
%(see Chapters \ref{page:shape} and~\ref{page:break}).
在竖直列表的开始处有一些特殊条件需要注意:
\cs{prevdepth} 的值被设为 \n{-1000pt}。
此外,在内部竖直列表的顶端没有附加 \cs{parskip} 的可变铅空。
在主竖直列表的顶端(即“当前页”的顶端)没有附加可变铅空或其他可丢弃的项目,
\cs{topskip} 的可变铅空会在第一个盒子加入列表时加入
(见第 \ref{page:shape} 和 \ref{page:break} 章)。
%%\point Horizontal and vertical commands
%\section{Horizontal and vertical commands}
%\point Horizontal and vertical commands
\section{水平和竖直命令}
%Some commands are so intrinsically horizontal or vertical
%in nature that they force \TeX\ to go into that mode, if
%possible. A~command that forces \TeX\ into horizontal mode
%is called a \gr{horizontal command}; similarly a command that
%forces \TeX\ into vertical mode is called a
%\gr{vertical command}.
有些命令本质上是“内在”水平或竖直的,如果有可能,它们会强制 \TeX\ 进入该模式。
能强制 \TeX\ 进入水平模式的命令称为水平命令 \gr{horizontal command};
类似的能强制 \TeX\ 进入竖直模式的命令称作竖直命令 \gr{vertical command}。
%However, not all transitions are possible:
%\TeX\ can switch from both vertical modes to
%(unrestricted) horizontal mode and back
%through horizontal and vertical commands, but no transitions
%to or from restricted horizontal mode are possible
%(other than by enclosing horizontal boxes in vertical boxes or
%the other way around).
%A~vertical command in restricted horizontal mode thus gives
%an error; the \cs{par} command in restricted horizontal mode
%has no effect.
但是,并非所有的模式转换都是可行的:
\TeX\ 能从两种竖直模式切换到(无限制的)水平模式,并可以通过水平和竖直命令切换回去。
但转入或转出受限水平模式的转换均是不可行的(除了在竖直盒子内闭合水平盒子或使用其他的方式)。
在受限水平模式内使用竖直命令会导致错误;
受限水平模式内,\cs{par} 命令没有效果。
%The \indextermbus{horizontal}{commands} are the following:
%\label{h:com:list}
%\begin{itemize}
%\item any \gr{letter}, \gr{otherchar}, \cs{char},
%a control sequence defined by \cs{chardef}, or \cs{noboundary};
%\item \cs{accent}, \cs{discretionary}, the discretionary
%hyphen~\verb|\-| and control space~\verb|\|\n{\char32};
%\item \cs{unhbox} and \cs{unhcopy};
%\item \cs{vrule} and the
%\gr{horizontal skip} commands
%\cs{hskip}, \cs{hfil}, \cs{hfill}, \cs{hss}, and \cs{hfilneg};
%\item \cs{valign};
%\item math shift (\n\$).
%\end{itemize}
以下是\cindextermbus{水平}{命令}(\emph{horizontal commands}):
\label{h:com:list}
\begin{itemize}
\item 任何 \gr{letter}, \gr{otherchar}, \cs{char},
由 \cs{chardef} 或 \cs{noboundary} 定义的控制序列;
\item \cs{accent}, \cs{discretionary},
软连词符 \verb|\-| 和 控制空格 \verb|\|\n{\char32};
\item \cs{unhbox} 和 \cs{unhcopy};
\item \cs{vrule} 和 \gr{horizontal skip} 命令
\cs{hskip}, \cs{hfil}, \cs{hfill}, \cs{hss}, 和 \cs{hfilneg};
\item \cs{valign};
\item 数学转换 (\n\$)。
\end{itemize}
%The \indextermbus{vertical}{commands} are the following:
%\label{v:com:list}
%\begin{itemize}
%\item \cs{unvbox} and \cs{unvcopy};
%\item \cs{hrule} and the \gr{vertical skip} commands
% \cs{vskip}, \cs{vfil}, \cs{vfill}, \cs{vss}, and \cs{vfilneg};
%\item \cs{halign};
%\item \cs{end} and \cs{dump}.
%\end{itemize}
%Note that the vertical commands do not include \cs{par};
%nor are \cs{indent} and \cs{noindent} horizontal commands.
以下是\cindextermbus{竖直}{命令}(\emph{vertical commands}):
\label{v:com:list}
\begin{itemize}
\item \cs{unvbox} 和 \cs{unvcopy};
\item \cs{hrule} 和 \gr{vertical skip} 命令
\cs{vskip}, \cs{vfil}, \cs{vfill}, \cs{vss} 和 \cs{vfilneg};
\item \cs{halign};
\item \cs{end} 和 \cs{dump}.
\end{itemize}
注意!竖直命令不包含 \cs{par};
\cs{indent} 和 \cs{noindent} 也不是水平命令。
%The connection between boxes and modes is explored below;
%see Chapter~\ref{rules} for more on the connection between
%rules and modes.
下方探讨了盒子和模式的联系;
关于规则和模式的联系,详见第 \ref{rules} 章。
%\section{The internal modes}
\section{内部模式}
%The \indextermbus{restricted horizontal}{mode} and
%\indextermbus{internal vertical}{mode}
%are those variants of horizontal mode and vertical mode
%that hold inside an \cs{hbox} and \cs{vbox} (or \cs{vtop}
%or \cs{vcenter}) respectively.
%However, restricted horizontal mode is rather more
%restricted in nature than internal vertical mode.
%The third internal mode is non-display math mode
%(see Chapter~\ref{math}).
\cindextermbus{受限水平}{模式}是 \cs{hbox} 中的水平模式的变种;
而\cindextermbus{内部竖直}{模式}是 \cs{vbox} (或 \cs{vtop}, \cs{vcenter}) 中竖直模式的变种。
本质上说,受限水平模式相对于内部竖直模式限制更多。
第三种内部模式是非显示的数学模式(见 \ref{math} 章)
%%\spoint Restricted horizontal mode
%\subsection{Restricted horizontal mode}
%\spoint Restricted horizontal mode
\subsection{受限水平模式}
%The main difference between restricted horizontal mode,
%the mode in an \cs{hbox}, and unrestricted horizontal mode,
%the mode in which paragraphs in vertical boxes
%and on the page are built,
%is that you cannot break out of restricted horizontal mode:
%\cs{par}~does nothing in this mode.
%Furthermore, a~\gram{vertical command} in restricted horizontal
%mode gives an error.
%In unrestricted horizontal mode it would cause a
%\cs{par} token to be inserted and vertical mode to be entered
%(see also Chapter~\ref{par:end}).
对于水平模式,受限(\cs{hbox}的模式)与不受限(正在构建页面和竖直盒子中段落的模式)的最大区别是:你不能退出受限水平模式,而且 \cs{par} 在受限模式中不起作用。
此外,受限水平模式中的 \gram{vertical command} 会导致错误。
再非受限水平模式中,这样做会插入一个 \cs{par} 记号,并进入竖直模式(详见第 \ref{par:end} 章)。
%%\spoint Internal vertical mode
%\subsection{Internal vertical mode}
%\spoint Internal vertical mode
\subsection{内部竖直模式}
%Internal vertical mode, the vertical mode inside
%a~\cs{vbox}, is a lot like external vertical
%mode, the mode in which pages are built.
%A~\gram{horizontal command} in internal vertical mode,
%for instance, is perfectly valid:
%\TeX\ then starts building a paragraph in
%unrestricted horizontal mode.
内部竖直模式即 \cs{vbox} 内的竖直模式,很像构建页面时使用的外部竖直模式。
内部竖直模式内的 \gram{horizontal command} 是完全有效的,例如:\TeX\ 开始以非受限水平模式构建段落。
%One difference is that the commands
%\cs{unskip} and \cs{unkern} have no effect
%in external vertical mode, and
%\cs{lastbox} is always empty in external vertical mode.
%See further pages \pageref{lastbox} and~\pageref{unskip}.
内部和外部竖直模式的一个区别是:在内部竖直模式中,\cs{unskip} 和 \cs{unkern} 命令没有效果,并且 \cs{lastbox}s 总是空的。
详见第 \pageref{lastbox} 和 \pageref{unskip}。·
%The entries of alignments (see Chapter~\ref{align}) are
%processed in internal modes: restricted horizontal mode
%for the entries of an \cs{halign}, and internal vertical
%mode for the entries of a~\cs{valign}.
%The material in \cs{vadjust} and \cs{insert} items
%is also processed in internal vertical mode; furthermore,
%\TeX\ enters this mode when processing the \cs{output} token list.
输入的对齐在内部模式中处理(见第 \ref{align} 章)。
\cs{halign} 的项使用受限水平模式,而 \cs{valign} 的项使用内部竖直模式。
\cs{vadjust} 的材料和 \cs{insert} 的项也在内部竖直模式内处理;此外,\TeX\ 在处理 \cs{output} 记号序列时也会进入这个模式。
%The commands \cs{end} and \cs{dump} (the latter exists only in \IniTeX)
%are not allowed in
%internal vertical mode; furthermore, \cs{dump} is not allowed
%inside a group (see Chapter~\ref{TeXcomm}).
\cs{end} 和 \cs{dump} 命令不允许出现在内部竖直模式中(后者仅存在于 \IniTeX 中);
此外 \cs{dump} 不允许在组内使用(见底 \ref{TeXcomm} 章)。
%%\point[hvbox] Boxes and modes
%\section{Boxes and modes}
%\label{hvbox}
%\point[hvbox] Boxes and modes
\section{Boxes and modes}
\label{hvbox}
%There are horizontal and vertical boxes, and there is
%horizontal and vertical mode. Not surprisingly, there is
%a connection between the boxes and the modes.
%One can ask about this connection in two ways.
There are horizontal and vertical boxes, and there is
horizontal and vertical mode. Not surprisingly, there is
a connection between the boxes and the modes.
One can ask about this connection in two ways.
%%\spoint What box do you use in what mode?
%\subsection{What box do you use in what mode?}
%\spoint What box do you use in what mode?
\subsection{What box do you use in what mode?}
%This is the wrong question. Both horizontal and vertical boxes
%can be used in both horizontal and vertical mode.
%Their placement is determined by the prevailing mode at that moment.
This is the wrong question. Both horizontal and vertical boxes
can be used in both horizontal and vertical mode.
Their placement is determined by the prevailing mode at that moment.
%%\spoint What mode holds in what box?
%\subsection{What mode holds in what box?}
%\spoint What mode holds in what box?
\subsection{What mode holds in what box?}
%This is the right question.
%When an \cs{hbox} starts, \TeX\ is in restricted horizontal
%mode. Thus everything in a horizontal box is lined up horizontally.
This is the right question.
When an \cs{hbox} starts, \TeX\ is in restricted horizontal
mode. Thus everything in a horizontal box is lined up horizontally.
%When a \cs{vbox} is started, \TeX\ is in internal vertical mode.
%Boxes of both kinds and other items are then stacked
%on top of each other.
When a \cs{vbox} is started, \TeX\ is in internal vertical mode.
Boxes of both kinds and other items are then stacked
on top of each other.
%%\spoint Mode-dependent behaviour of boxes
%\subsection{Mode-dependent behaviour of boxes}
%\spoint Mode-dependent behaviour of boxes
\subsection{Mode-dependent behaviour of boxes}
%Any \gr{box} (see Chapter \ref{boxes} for the full definition)
%can be used in horizontal, vertical, and math mode.
%Unboxing commands, however, are specific for horizontal or vertical mode.
%Both \cs{unhbox} and \cs{unhcopy} are \gr{horizontal command}s,
%so they can make \TeX\ switch from vertical to horizontal
%mode;
%both \cs{unvbox} and \cs{unvcopy} are \gr{vertical command}s,
%so they can make \TeX\ switch from horizontal to vertical
%mode.
Any \gr{box} (see Chapter \ref{boxes} for the full definition)
can be used in horizontal, vertical, and math mode.
Unboxing commands, however, are specific for horizontal or vertical mode.
Both \cs{unhbox} and \cs{unhcopy} are \gr{horizontal command}s,
so they can make \TeX\ switch from vertical to horizontal
mode;
both \cs{unvbox} and \cs{unvcopy} are \gr{vertical command}s,
so they can make \TeX\ switch from horizontal to vertical
mode.
%In horizontal mode the \cs{spacefactor} is set to 1000
%after a box has been placed. In vertical mode the
%\cs{prevdepth} is set to the depth of the box placed.
%Neither statement holds for
%unboxing commands: after an \cs{unhbox} or \cs{unhcopy} the
%spacefactor is not altered, and after \cs{unvbox} or \cs{unvcopy}
%the \cs{prevdepth} remains unchanged.
%After all, these commands do not add a box,
%but a piece of a~(horizontal or vertical) list.
In horizontal mode the \cs{spacefactor} is set to 1000
after a box has been placed. In vertical mode the
\cs{prevdepth} is set to the depth of the box placed.
Neither statement holds for
unboxing commands: after an \cs{unhbox} or \cs{unhcopy} the
spacefactor is not altered, and after \cs{unvbox} or \cs{unvcopy}
the \cs{prevdepth} remains unchanged.
After all, these commands do not add a box,
but a piece of a~(horizontal or vertical) list.
%The operations \cs{raise} and \cs{lower} can only be
%applied to a box in horizontal mode; similarly, \cs{moveleft} and
%\cs{moveright} can only be applied in vertical mode.
The operations \cs{raise} and \cs{lower} can only be
applied to a box in horizontal mode; similarly, \cs{moveleft} and
\cs{moveright} can only be applied in vertical mode.
%%\point Modes and glue
%\section{Modes and glue}
%\point Modes and glue
\section{Modes and glue}
%Both in horizontal and vertical mode
%\TeX\ can insert glue items the size of which is
%determined by the preceding object in the list.
Both in horizontal and vertical mode
\TeX\ can insert glue items the size of which is
determined by the preceding object in the list.
%For horizontal mode the amount of glue that is inserted
%for a space token depends on the \cs{spacefactor} of
%the previous object in the list. This is treated
%in Chapter~\ref{space}.
For horizontal mode the amount of glue that is inserted
for a space token depends on the \cs{spacefactor} of
the previous object in the list. This is treated
in Chapter~\ref{space}.
%In vertical mode \TeX\ inserts glue to keep boxes at a certain
%distance from each other. This glue is influenced by the
%height of the current item and the depth of the previous one.
%The depth of items is recorded in the \cs{prevdepth} parameter
%(see Chapter~\ref{baseline}).
In vertical mode \TeX\ inserts glue to keep boxes at a certain
distance from each other. This glue is influenced by the
height of the current item and the depth of the previous one.
The depth of items is recorded in the \cs{prevdepth} parameter
(see Chapter~\ref{baseline}).
%The two quantities \cs{prevdepth}
%and \cs{spacefactor}
%use the same internal register of \TeX. Thus the \cs{prevdepth}
%can be used or asked only in vertical mode, and the \cs{spacefactor}
%only in horizontal mode.
The two quantities \cs{prevdepth}
and \cs{spacefactor}
use the same internal register of \TeX. Thus the \cs{prevdepth}
can be used or asked only in vertical mode, and the \cs{spacefactor}
only in horizontal mode.
%%\point[migrate] Migrating material
%\section{Migrating material}
%\label{migrate}
%\point[migrate] Migrating material
\section{Migrating material}
\label{migrate}
%The three control sequences \cs{insert}, \cs{mark}, and \cs{vadjust}
%can be given in a paragraph
%(the first two can also occur
%in vertical mode) to specify \indexterm{migrating material}:
%material that will wind up on the
%surrounding vertical list rather than on the current list.
%Note that this need not be
%the main vertical list: it can be a vertical box
%containing a paragraph of text. In this case a \cs{mark}
%or \cs{insert} command will not reach the page breaking algorithm.
The three control sequences \cs{insert}, \cs{mark}, and \cs{vadjust}
can be given in a paragraph
(the first two can also occur
in vertical mode) to specify \indexterm{migrating material}:
material that will wind up on the
surrounding vertical list rather than on the current list.
Note that this need not be
the main vertical list: it can be a vertical box
containing a paragraph of text. In this case a \cs{mark}
or \cs{insert} command will not reach the page breaking algorithm.
%When several migrating items are specified in a certain line
%of text, their left-to-right order is preserved when they are
%placed on the surrounding vertical list. These items are placed
%directly after the horizontal box containing the line of text
%in which they were specified: they come before any
%penalty or glue items that are automatically inserted
%(see page~\pageref{between:lines}).
When several migrating items are specified in a certain line
of text, their left-to-right order is preserved when they are
placed on the surrounding vertical list. These items are placed
directly after the horizontal box containing the line of text
in which they were specified: they come before any
penalty or glue items that are automatically inserted
(see page~\pageref{between:lines}).
%%\spoint \cs{vadjust}
%\subsection{\cs{vadjust}}
%\spoint \cs{vadjust}
\subsection{\cs{vadjust}}
%The command
%\cstoidx vadjust\par
%\begin{disp}\cs{vadjust}\gr{filler}\lb\gr{vertical mode material}\rb\end{disp}
%is only allowed in horizontal and math modes (but it is
%not a \gr{horizontal command}).
%Vertical mode material specified by \cs{vadjust} is moved from
%the horizontal list in which the command is given
%to the surrounding vertical list, directly after the box
%in which it occurred.
The command
\cstoidx vadjust\par
\begin{disp}\cs{vadjust}\gr{filler}\lb\gr{vertical mode material}\rb\end{disp}
is only allowed in horizontal and math modes (but it is
not a \gr{horizontal command}).
Vertical mode material specified by \cs{vadjust} is moved from
the horizontal list in which the command is given
to the surrounding vertical list, directly after the box
in which it occurred.
%In the current line
%\vadjust{\setbox0=\hbox{$\bullet$\hskip1em}\ht0=0pt \dp0=0pt \llap{\box0}}
%a \cs{vadjust} item was placed to put the bullet in the margin.
In the current line
\vadjust{\setbox0=\hbox{$\bullet$\hskip1em}\ht0=0pt \dp0=0pt \llap{\box0}}
a \cs{vadjust} item was placed to put the bullet in the margin.
%Any vertical material in a \cs{vadjust} item is processed
%in internal vertical mode, even though it will wind up
%on the main vertical list. For instance, the \cs{ifinner}
%test is true in a \cs{vadjust}, and at the start
%\mdqon
%of the vertical material \cs{prevdepth}$=$""\n{-1000pt}.
%\mdqoff
Any vertical material in a \cs{vadjust} item is processed
in internal vertical mode, even though it will wind up
on the main vertical list. For instance, the \cs{ifinner}
test is true in a \cs{vadjust}, and at the start
\mdqon
of the vertical material \cs{prevdepth}$=$""\n{-1000pt}.
\mdqoff
%%\point Testing modes
%\section{Testing modes}
%\point Testing modes
\section{Testing modes}
%The three conditionals \cs{ifhmode}, \cs{ifvmode}, and
%\cs{ifinner} can distinguish between the four modes of
%\TeX\ that are not math modes.
%The \cs{ifinner} test is true if \TeX\ is in
%restricted horizontal mode or internal vertical mode
%(or in non-display math mode).
%Exceptional condition: during a \cs{write} \TeX\
%is in a `no mode' state. The tests \cs{ifhmode},
%\cs{ifvmode}, and \cs{ifmmode} are then all false.
The three conditionals \cs{ifhmode}, \cs{ifvmode}, and
\cs{ifinner} can distinguish between the four modes of
\TeX\ that are not math modes.
The \cs{ifinner} test is true if \TeX\ is in
restricted horizontal mode or internal vertical mode
(or in non-display math mode).
Exceptional condition: during a \cs{write} \TeX\
is in a `no mode' state. The tests \cs{ifhmode},
\cs{ifvmode}, and \cs{ifmmode} are then all false.
%Inspection of all current lists, including the `recent
%contributions' (see Chapter~\ref{page:break}),
%is possible through the command \csidx{showlists}\label{showlists}.
%This command writes to the log file the contents of all
%lists that are being built at the moment the command is given.
Inspection of all current lists, including the `recent
contributions' (see Chapter~\ref{page:break}),
is possible through the command \csidx{showlists}\label{showlists}.
This command writes to the log file the contents of all
lists that are being built at the moment the command is given.
%Consider the example
%\begin{verbatim}
%a\hfil\break b\par
%c\hfill\break d
%\hbox{e\vbox{f\showlists
%\end{verbatim}
%Here the first paragraph has been broken into two lines, and
%these have been added to the current page. The second paragraph
%has not been concluded or broken into lines.
Consider the example
\begin{verbatim}
a\hfil\break b\par
c\hfill\break d
\hbox{e\vbox{f\showlists
\end{verbatim}
Here the first paragraph has been broken into two lines, and
these have been added to the current page. The second paragraph
has not been concluded or broken into lines.
%The log file shows the following. \TeX\ was busy
%building a paragraph (starting with an indentation box
%\n{20pt} wide):\begin{verbatim}
%### horizontal mode entered at line 3
%\hbox(0.0+0.0)x20.0
%\tenrm f
%spacefactor 1000
%\end{verbatim}
%This paragraph was inside a vertical box:\begin{verbatim}
%### internal vertical mode entered at line 3
%prevdepth ignored
%\end{verbatim}
%The vertical box was in a horizontal box,
%\begin{verbatim}
%### restricted horizontal mode entered at line 3
%\tenrm e
%spacefactor 1000
%\end{verbatim}
%which was part of
%an as-yet unfinished paragraph:\begin{verbatim}
%### horizontal mode entered at line 2
%\hbox(0.0+0.0)x20.0
%\tenrm c
%\glue 0.0 plus 1.0fill
%\penalty -10000
%\tenrm d
%etc.
%spacefactor 1000
%\end{verbatim}
%Note how the infinite glue and the \cs{break} penalty
%are still part of the horizontal list.
The log file shows the following. \TeX\ was busy
building a paragraph (starting with an indentation box
\n{20pt} wide):\begin{verbatim}
### horizontal mode entered at line 3
\hbox(0.0+0.0)x20.0
\tenrm f
spacefactor 1000
\end{verbatim}
This paragraph was inside a vertical box:\begin{verbatim}
### internal vertical mode entered at line 3
prevdepth ignored
\end{verbatim}
The vertical box was in a horizontal box,
\begin{verbatim}
### restricted horizontal mode entered at line 3
\tenrm e
spacefactor 1000
\end{verbatim}
which was part of
an as-yet unfinished paragraph:\begin{verbatim}
### horizontal mode entered at line 2
\hbox(0.0+0.0)x20.0
\tenrm c
\glue 0.0 plus 1.0fill
\penalty -10000
\tenrm d
etc.
spacefactor 1000
\end{verbatim}
Note how the infinite glue and the \cs{break} penalty
are still part of the horizontal list.
%Finally, the first paragraph has been broken into lines and
%added to the current page:\begin{verbatim}
%### vertical mode entered at line 0
%### current page:
%\glue(\topskip) 5.69446
%\hbox(4.30554+0.0)x469.75499, glue set 444.75497fil
%.\hbox(0.0+0.0)x20.0
%.\tenrm a
%.\glue 0.0 plus 1.0fil
%.\penalty -10000
%.\glue(\rightskip) 0.0
%\penalty 300
%\glue(\baselineskip) 5.05556
%\hbox(6.94444+0.0)x469.75499, glue set 464.19943fil
%.\tenrm b
%.\penalty 10000
%.\glue(\parfillskip) 0.0 plus 1.0fil
%.\glue(\rightskip) 0.0
%etc.
%total height 22.0 plus 1.0
% goal height 643.20255
%prevdepth 0.0
%\end{verbatim}
Finally, the first paragraph has been broken into lines and
added to the current page:\begin{verbatim}
### vertical mode entered at line 0
### current page:
\glue(\topskip) 5.69446
\hbox(4.30554+0.0)x469.75499, glue set 444.75497fil
.\hbox(0.0+0.0)x20.0
.\tenrm a
.\glue 0.0 plus 1.0fil
.\penalty -10000
.\glue(\rightskip) 0.0
\penalty 300
\glue(\baselineskip) 5.05556
\hbox(6.94444+0.0)x469.75499, glue set 464.19943fil
.\tenrm b
.\penalty 10000
.\glue(\parfillskip) 0.0 plus 1.0fil
.\glue(\rightskip) 0.0
etc.
total height 22.0 plus 1.0
goal height 643.20255
prevdepth 0.0
\end{verbatim}
%\endofchapter
%%%%% end of input file [modes]
\endofchapter
%%%% end of input file [modes]
\end{document}