这些 \widowpenalties 到底是什么,它们究竟在做什么?

这些 \widowpenalties 到底是什么,它们究竟在做什么?

在这个答案中,作者使用命令\widowpenalties=3 10000 10000 150

虽然我能理解\widowpenalty正在做什么,但我没有找到\widowpenalties3和 的文档\widowpenalties4。我查看了 TeXBook、Companion book 和 source2e.pdf,但它们没有在任何地方解释这些命令在做什么,并且它们究竟是如何工作的,细节精准。

您能解释一下这个概念吗?

答案1

widowpenalties是 e-tex 扩展,因此在教科书中未提及。Classic tex 有,\widowpenalty这是在段落最后一行处分页的惩罚

e-tex 对列表进行了简单的扩展

\widowpenalties 3 1001  1002 1003

将声明一个包含 3 个惩罚的列表,其中 1001 在最后一行使用,1002 在倒数第二行使用,1003 在前一行使用。因为\parshape最后一个值是重复的)

您可以类似地使用列表\clubpenalties来控制段落初始行的分页,而不仅仅是第一行之后的分页。

此列出了经典 tex 及其扩展中可用的所有惩罚值参数。

什么是惩罚以及惩罚的具体定义是什么?


以这个例子来说

\documentclass{article}

\begin{document}

\showoutput
\showboxdepth3

\clubpenalties 3 1001 1002 0
\widowpenalties 3 2001 2002 0
\interlinepenalty=5


some text some text some text some text some text some text 
some text some text some text some text some text some text 
some text some text some text some text some text some text 
some text some text some text some text some text some text 
some text some text some text some text some text some text 
some text some text some text some text some text some text 
some text some text some text some text some text some text 
some text some text some text some text some text some text 
some text some text some text some text some text some text 
some text some text some text some text some text some text 
some text some text some text some text some text some text 
some text some text some text some text some text some text 
some text some text some text some text some text some text 
some text some text some text some text some text some text 
some text some text some text some text some text some text 
some text some text some text some text some text some text 
some text some text some text some text some text some text 
some text some text some text some text some text some text 
some text some text some text some text some text some text 

日志显示如下行

...\hbox(6.15079+0.0)x345.0, glue set 0.55896 [] 第 1
...\penalty 1006 行 隔行 + 第一个俱乐部
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.08807 [] 第 2
...\penalty 1007 行 隔行 + 第二个俱乐部 第
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.26903 [] 3 行
...\penalty 5 隔行
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.08807 [] 4 行 隔行
...\penalty 5 隔行 隔行 隔行 隔行 隔行 隔行 隔行 隔行 隔行 + 第二个寡妇 隔行 + 第一个寡妇 文本最后一行
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.26903 []
...\penalty 5
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.08807 []
...\penalty 5
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.26903 []
...\penalty 5
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.08807 []
...\penalty 5
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.26903 []
...\penalty 5
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.08807 []
...\penalty 5
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.26903 []
...\penalty 5
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.08807 []
...\penalty 5
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.26903 []
...\penalty 5
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.08807 []
...\penalty 2007...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.26903 []
...\penalty 2006...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 256.5554fil []

相关内容