我在处理 multicols 环境中的寡妇时遇到问题,也就是说,我没有设法指示 LaTeX 删除它们。
此 PDF 文档显示了该问题的示例。在第二页的顶部,我从第一页的最后一段中得到了一个寡妇。我尝试了几种方法,但没有运气:
\widowpenalty都设置\clubpenalty为高值\raggedcolumns在和之间切换\flushcolumnscollectmore和unbalance计数器我还阅读了multicol 的文档,但没有发现任何有用的内容。
还有什么我可以尝试的吗?
{\obeyspaces\gdef\nomorebreak{\beginnomorebreak\let \nobreakspace}}
\def\beginnomorebreak{\begingroup
\def\par{\endgraf\endgroup\par\penalty 9999 }\obeyspaces
\brokenpenalty 10000 \widowpenalty 10000 \clubpenalty 10000 }
\def\nobreakspace{\vadjust{\nobreak} \removespaces}
\def\removespaces{\futurelet\next\checkspace}
\def\checkspace{\ifx\next\nobreakspace\expandafter\removesinglespace\fi}
\def\removesinglespace#1{\removespaces}
Run Code Online (Sandbox Code Playgroud)
\nomorebreak在段落的任意位置插入。该宏之后直到段落末尾将禁止分页。