为了在 eledpar 中提供新功能,我想仅在奇数页上输出一些注释。我遇到了一个问题,正如您在以下 MWE 中看到的那样
我修改了输出例程以添加测试
\documentclass{article}
\usepackage{blindtext}
\makeatletter
\gdef \@makecol {%
\ifvoid\footins
\setbox\@outputbox \box\@cclv
\else
\setbox\@outputbox \vbox {%
\boxmaxdepth \@maxdepth
\unvbox \@cclv
\ifodd\c@page%
\vskip \skip\footins
\color@begingroup
\normalcolor
\footnoterule%
\unvbox \footins
\color@endgroup
\fi%
}%
\fi
\let\@elt\relax
\xdef\@freelist{\@freelist\@midlist}%
\global \let \@midlist \@empty
\@combinefloats
\ifvbox\@kludgeins
\@makespecialcolbox
\else
\setbox\@outputbox \vbox to\@colht {%
\@texttop
\dimen@ \dp\@outputbox
\unvbox \@outputbox
\vskip -\dimen@
\@textbottom
}%
\fi
\global \maxdepth \@maxdepth
}
\makeatother
\begin{document}
\blindtext Before\footnote{\blindtext[13]
\textbf{2}}\blindtext[10]
After
even more After
\end{document}
所以:如果我们在奇数页,就输出注释,如果有注释,就不要这样做。
在实际示例中,我使用与插入链接的计数器来防止进球问题。这很有效。
不幸的是,正如您在第 3 页上看到的,最后一行注释与前一行注释太接近了。有什么想法吗?
如果我们在偶数页中使用框,问题就解决了,正如我们在 MWE 中看到的那样
\documentclass{article}
\usepackage{blindtext}
\makeatletter
\gdef \@makecol {%
\ifvoid\footins
\setbox\@outputbox \box\@cclv
\else
\setbox\@outputbox \vbox {%
\boxmaxdepth \@maxdepth
\unvbox \@cclv
\ifodd\c@page%
\vskip \skip\footins
\color@begingroup
\normalcolor
\footnoterule%
\unvbox \footins
\color@endgroup
\else
\global\setbox0=\box\footins
\fi%
}%
\fi
\let\@elt\relax
\xdef\@freelist{\@freelist\@midlist}%
\global \let \@midlist \@empty
\@combinefloats
\ifvbox\@kludgeins
\@makespecialcolbox
\else
\setbox\@outputbox \vbox to\@colht {%
\@texttop
\dimen@ \dp\@outputbox
\unvbox \@outputbox
\vskip -\dimen@
\@textbottom
}%
\fi
\global \maxdepth \@maxdepth
}
\makeatother
\begin{document}
\blindtext Before\footnote{\blindtext[13]
\textbf{2}}\blindtext[10]
After
even more After
\unvbox0
\end{document}
\unvbox0 没有空间问题。不过我当然想在主注释中使用它
答案1
好的,这就是我的解决方案。同时也回答@david-carlisle。
首先,为什么我不想只在一侧有注释?因为它是用于 eledpar 的,它允许在 // 中排版文本:一个部分是原始语言,另一个部分是翻译。因此,在某些部分有注释可能会很有用。
其次,我们必须知道 eledpar 在每页之间插入 \newpage。所以我现在提供的 MWE 试图模仿它。如果你用正常的分页符来做这件事,会有一些问题,但用正常的分页符做这件事没有理由需要这样做 ;-)。
因此有三个问题。
- 只打印单面脚注。简单测试即可。
- 确保长脚注不会:a. 缩短未打印的页面。b. 与已打印的页面中的行号重叠。
- 最后一行注释与前一行注释太接近的问题。这是我的问题。
对于第 2 点,我们在输出例程中所做的是检查当前页面的奇偶校验。如果下一页不应有注释,我们将 \footins 计数设置为 0,并且 \footins 跳至 0pt。如果下一页应有注释,我们将重置这些计数并跳至默认值。
第 3 点是最成问题的,也是我的问题。问题在于,当 \insert 对于页面来说太长时,TeX 会在新页面构建的开始处向插入框中添加至少一行,即使先前的插入框不是空的。
所以在我的例子中,我多出了一行。而且这一行与前一行的衔接很差。我找到的解决方案是将 \footins 框分成两部分:第一部分和最后一行,即“多出”的那一行。然后打印它们。我需要对这两部分之间的跳跃进行一些调整,但这很容易。
在理想情况下,我会通过更改 \footins dimen 来避免这种“过多的线条”。在这个已经很复杂的例子中,我不会这样做。但在 eledpar 中,我会这样做。我已经进行了测试。它正在工作。
所以最后的是“MWE”。
\documentclass{article}
\dimen\footins=\dimexpr\textheight - \baselineskip\relax
\usepackage[showframe]{geometry}
\usepackage{blindtext}
\makeatletter
\newif\iffootinsnotprinted
\gdef \@makecol {
\ifvoid\footins
\setbox\@outputbox \box\@cclv
\else
\setbox\@outputbox \vbox {%
\boxmaxdepth \@maxdepth
\unvbox \@cclv
\ifodd\c@page%
\vskip \skip\footins
\color@begingroup
\normalcolor
\splittopskip=0pt
\footnoterule%
\footnotesize
\iffootinsnotprinted
\setbox\footins=\vbox{
\vsplit\footins to \dimexpr\ht\footins-1pt\relax
\vskip \dimexpr-0.5\baselineskip-0.5\lineskip-0.5pt\relax
\unvbox\footins}
\global\footinsnotprintedfalse
\fi
\unvbox\footins
\color@endgroup
\else
\ifvoid\footins\else
\global\footinsnotprintedtrue
\fi
\fi%
}%
\fi
\let\@elt\relax
\xdef\@freelist{\@freelist\@midlist}%
\global \let \@midlist \@empty
\@combinefloats
\ifvbox\@kludgeins
\@makespecialcolbox
\else
\setbox\@outputbox \vbox to\@colht {%
\@texttop
\dimen@ \dp\@outputbox
\unvbox \@outputbox
\vskip -\dimen@
\@textbottom
}%
\fi
\global \maxdepth \@maxdepth
\ifodd\c@page
\global\count\footins=0
\global\skip\footins=0pt%
\else
\global\count\footins=1000
\global\skip\footins=\footskip
\fi
}
\makeatother
\begin{document}
Here will be eledpar Right page\footnote{\blindtext[16]
\textbf{2}}
\newpage
even more After. In eledpar, here will be left page. even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page. even more After. In eledpar, here will be left page. even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page. even more After. In eledpar, here will be left page. even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page. even more After. In eledpar, here will be left page. even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After. In eledpar, here will be left page.even more After.
\newpage
Here will be eledpar Right page
\end{document}
因此结果
当然,我认为大多数人不应该使用这种结构。正如我在开篇所说的,有两个限制:
- 第一个输出后注释中多一行。可以通过更改 \footins dimen 来解决。
- \newpage 是设置正确 \count\footins 的必需项。但是,在我最初的问题中,我有一个新的页面。我认为没有人会喜欢不仅在一侧同时排版文本。但是,如果有人愿意,我认为可以通过错误的输出例程(如
\output={\unvbox255 \penalty\outputpenalty}
TeXBook 第 255 页中提到的)来解决问题。