为什么在 \vbox 末尾添加 etc.,这是什么意思?

为什么在 \vbox 末尾添加 etc.,这是什么意思?

简短的示例代码

% pdfTeX
\newbox\thbx
\setbox\thbx\hbox{abc}
\newbox\tvbx
\setbox\tvbx\vbox{\unhbox\thbx}
\showbox\tvbx
\bye

将输出

\thbx=\box16
\tvbx=\box17
> \box17=
\vbox(6.94444+0.0)x469.75499
.\hbox(6.94444+0.0)x469.75499, glue set 434.47717fil
..\hbox(0.0+0.0)x20.0
..\tenrm a
..\tenrm b
..\kern0.27779
..\tenrm c
..etc.

输出的最后一行(etc.)是什么意思,为什么 TeX 将它放在那里?

答案1

默认情况下\showboxbreadth=5,即 TeX 显示列表的前五个元素后,它会写入etc.以表明还有更多。

还有一个参数会影响和的输出\showbox,即\showboxdepth(默认3),即 TeX 下降到的嵌套级别。如果超出深度,则用表示[]

另请参阅 TeXbook 的摘录:

\danger When \TeX\ displays a box as part of diagnostic output, the amount
of data is controlled by two parameters called ^|\showboxbreadth| and
^|\showboxdepth|. The first of these, which plain \TeX\ sets equal to~5,
tells the maximum number of items shown per level; the second, which plain
\TeX\ sets to~3, tells the deepest level. For example, a small box
whose full contents are ^^{internal box format} ^^{symbolic box format}
\begintt
\hbox(4.30554+1.94444)x21.0, glue set 0.5
.\hbox(4.30554+1.94444)x5.0
..\tenrm g
.\glue 5.0 plus 2.0
.\tenrm || (ligature ---)
\endtt
will be abbreviated as follows when |\showboxbreadth=1| and |\showboxdepth=1|:
^^{ligature} ^^{em-dash}
\begintt
\hbox(4.30554+1.94444)x21.0, glue set 0.5
.\hbox(4.30554+1.94444)x5.0 []
.etc.
\endtt
And if you set |\showboxdepth=0|, you get only the top level:
\begintt
\hbox(4.30554+1.94444)x21.0, glue set 0.5 []
\endtt
(Notice how `^|[]|' and `^|etc.|'~indicate that the data has been
truncated.)

相关内容