我正在研究一种自动处理机制孤儿和寡妇在我自己定义的文档类中。
Tex 版本:xelatex-2022
目前的进展是引用widows-and-orphans包并重写相应的方法
怀疑:
- 寡妇惩罚何时发生/发现?是在渲染之后吗?是可预测的吗?
- 使用原始命令后再行书写,上一页每段间距都会变大
\widowpenalties
,这个现象是不是说明当出现widowpenalty时,可以缩小上一页的行距,把widow line挤进上一页呢?
代码:
\documentclass{book}
%\widowpenalties=4 10000 10000 10000 150 ===> In fact, only 1 row needs to be processed, but it is written as 4 for the sake of testing
\begin{document}
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\par
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\par
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\par
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\par
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\par
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\par
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\par
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\par
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\par
\end{document}
Qa1:为什么出现孤行时要调整上一页的间距?
回答 1:我不希望在上一页插入寡行时出现过满的情况。
问题2:为什么\enlargethispage{\baselineskip}
?
回答2:我知道这个解决方案但不适合我的目标。
答案1
您的问题标题询问行距,但代码表明您想询问的是段落之间的间距,而不是行之间的间距。
在您的示例中,如果取消注释 widowpenalties 行,则更多行将移动到第 2 页,而使第 1 页未满(而不是像您的注释所暗示的那样过满)。
由于默认情况下book
课堂上\parskip
所有的段落间空间都是可拉伸的,所以新的最后一行被放置在页面的底部。
默认值是,0.0pt plus 1.0pt
在这种情况下拉伸不够,所以你得到
Underfull \vbox (badness 10000) has occurred while \output is active [1
添加
\setlength\parskip{0pt plus 3pt}
这里的拉伸就足够了,但是为了确保即使页面上只有一个段落分隔符,也有足够的空间来获得行空间,请使用
\setlength\parskip{0pt plus \baselineskip}
所以
\documentclass{book}
\widowpenalties=4 10000 10000 10000 150 % ===> In fact, only 1 row needs to be processed, but it is written as 4 for the sake of testing
\setlength\parskip{0pt plus \baselineskip}
\begin{document}
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\par
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\par
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\par
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\par
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\par
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\par
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\par
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\par
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\\
a text a text a text a text a text a text a text a text\par
\end{document}
答案2
寡妇惩罚何时发生/发现?是在渲染之后吗?是可预测的吗?
\widowpenalty
和\clubpenalty
通常在序言中设置一次,尽管它们可以在任何时候自由更改。当页面以孤行结尾时, 的值\widowpenalty
将添加到页面的 中\outputpenalty
,对于孤行/俱乐部也是如此。
一般来说,您只想设置和的值\widowpenalty
并\clubpenalty
读取的值\outputpenalty
;读取\widowpenalty
或设置\outputpenalty
很少有意义。
有关这些值如何工作的详细描述,请参阅我关于寡妇和孤儿的文章第 4 部分。
我使用原来的命令 \widowpenalties 后,上一页每段的间距都会变大,这个现象是不是说明当出现 widowpenalty 时,我可以缩小上一页的行距,把寡行挤进上一页呢?
通常,您需要手动执行此操作。请参阅大卫·卡莱尔的评论。
我正在研究一种自动机制,用于处理我自己定义的文档类中的孤儿和寡妇。
我写了一个包lua-widow-control
旨在实现这一点。它要求 LuaLaTeX 使用不同的方法来删除孤行和寡行,但它在自动删除孤行和寡行方面非常有效。