考虑以下示例(Plain TeX):
%%%%%
Tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt-
Test.
\end
%%%%%
第一行生成一个以破折号结尾的段落,其中有(小)溢出。出于某种奇怪的原因,TeX 在本段后留下了一个额外的(空)行(日志文件中相应的消息为“Underfull \hbox (badness 10000)”)。对这种行为有什么解释吗?TIA
答案1
似乎是因为连字符暗示了其后有一个可自由选择的换行符。由于不管怎样,行都已经满了,所以换行符被采用,留下一个单独的空格标记,该标记最终占据一行。
如果你插入
\showboxbreadth=999
\showboxdepth=999
\showlists
在长行之后(中间有一个空白行),您将在日志文件中看到以下内容:
### vertical mode entered at line 0
### current page:
\glue(\topskip) 3.16669
\hbox(6.83331+0.0)x469.75499
.\hbox(0.0+0.0)x20.0
.\tenrm T
.\tenrm t
.\tenrm t
…
.\tenrm t
.\tenrm t
.\tenrm -
.\discretionary
.\glue(\rightskip) 0.0
.\rule(*+*)x5.0
\penalty 400
\glue(\baselineskip) 12.0
\hbox(0.0+0.0)x469.75499
.\glue(\rightskip) 0.0
total height 22.0
goal height 643.20255
prevdepth 0.0, prevgraf 2 lines
有趣的是,那里没有\parfillskip
,所以我的理论可能缺少一些谜题。但是如果将破折号替换为,您确实会得到相同的结果\discretionary{}{}{}
。
答案2
TeX 会因为破折号而断线。您可以使用\hbox
来避免这种情况。如果您以这种方式结束该行
...tttttt\hbox{-}
多余的线就会消失。
最小示例(使用 pdfTeX 而不是 pdfLaTeX 进行编译):
%%%%%
Tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt\hbox{-}
Test.
\end
%%%%%