
eledmac.sty
我仍然對兩列腳註中的列平衡有一個奇怪的問題。但我有一個新的 MWE,可能表明這可能不是一個特定的問題eledmac
(這就是為什麼我將其發佈到更廣泛的受眾)。
我有這個簡單的 MWE:
\documentclass{article}
\usepackage{lipsum}
\usepackage{eledmac}
\foottwocolX{A}
\def\footnote#1{\footnoteA{#1}}
\begin{document}
% Either remove this section:
\section{Section Headline}
\lipsum[1]
% ... or remove the item / quote environment:
\begin{itemize}
%\begin{quote}
\item The same problem happens if this is not an itemize but a quote
environment.
%\end{quote}
\end{itemize}
Bla\footnote{Test.}
Foo\footnote{Test Test Test Test Test Test Test Test Test Test Test Test Test
Test Test }
Bar \footnote{Test.}
\end{document}
在這個 MWE 中,兩列腳註看起來不平衡,如下所示:
但如果我刪除任何一個這\section
或者環境itemize
(放置普通文本,以便保持相同的垂直空間),列將像這樣平衡:
如果我使用quote
環境而不是itemize
.
是否有可能對懲罰系統做任何奇怪的事情,從而使腳註中的列平衡的懲罰計算變得“惱火”或其他什麼itemize
?quote
\section
在我的上一篇文章我指出,不可能透過設定面板變數來正確影響這種行為。在另一個帖子,我提取了列平衡演算法的程式碼,以便您可以使用它。
答案1
哇哦,二十年後 LaTeX 核心仍然能夠帶來驚喜!
多麼令人討厭的錯誤,從第-1天起就在那裡。
這不是 eledmac 的問題,而是 LaTeX 嘗試在節標題後保留至少 2 行文字的方式的問題。它透過設定\clubpenalty
為 10000 來實現這一點,然後\everypar
在開始第二段時使用恢復原始設定。
不幸的是,MWE 中的第二段是一個環境,因此重置發生在群組內。因此,最終環境\clubpenalty
會恢復其禁止值。這不會太糟糕,因為\everypar
也可以恢復它的定義來重置它。
然而,在環境組結束後,LaTeX 會運行進一步的程式碼來處理所謂的「段落環境」(環境周圍有空行,因為它們有額外的間距),而該機制 ( \@doendpe
) 也用於\everypar
恢復一些設置,並在此過程中恢復代碼\clubpenalty
遺失。
因此,`\clubpenalty 保持在 10000,在所有後續段落中將前兩行放在一起 --- 這就是腳註中的差異:第二個腳註在第一行和第二行之間沒有斷點不再排隊)。
在普通文字中,或實際上在大多數LaTeX 文件中,LaTeX 通常會發現附近的分頁符號是可以接受的(並且俱樂部線無論如何都不是那麼好:-)),但這裡清楚地顯示了這一點。
\documentclass{article}
\def\X{\showthe\clubpenalty\showthe\everypar}
\begin{document}
\section{Section Headline}
\X
a little bit of text
\X
% Uncomment this para then the issue goes away
%Another paragraph that makes \verb=\clubpenalty= okay again.
\X
% ... or remove the item / quote environment:
\begin{itemize}
\item \X
The same problem happens if this is not an itemize but a quote
environment.
\end{itemize}
\X
\par
\X Here is the issue: \verb=\clubpenalty= is restored back to 10000 but the \verb=\@doendpe= kills the also restored \verb=\everypar= so that it is never set back to normal.
Bla\footnote{Test.}
Foo\footnote{\X Test Test Test Test Test Test Test Test Test Test Test Test Test
Test Test }
Bar \footnote{Test.}
\X
Another paragraph
\X
\end{document}
如果你運行上面的版本,你可以看到戲劇是如何展開的。
一個可能的解決方案可能如下(但我說可能是因為這確實是一個非常微妙的領域,我不確定我是否考慮過所有影響......所以將此視為一個未經測試的想法-它基本上是\clubpenalty
無條件地設定回當達到 par env 末尾時其保存的值,很可能需要有條件地完成:
\makeatletter
\def\@doendpe{\@endpetrue
\def\par{\@restorepar
\clubpenalty \@clubpenalty
\everypar{}\par\@endpefalse}%
\everypar{{\setbox\z@\lastbox}\everypar{}\clubpenalty \@clubpenalty
\@endpefalse}}
\makeatother