![当段落被 afterpage 分割时,避免为脚注添加额外的页面](https://linux22.com/image/373325/%E5%BD%93%E6%AE%B5%E8%90%BD%E8%A2%AB%20afterpage%20%E5%88%86%E5%89%B2%E6%97%B6%EF%BC%8C%E9%81%BF%E5%85%8D%E4%B8%BA%E8%84%9A%E6%B3%A8%E6%B7%BB%E5%8A%A0%E9%A2%9D%E5%A4%96%E7%9A%84%E9%A1%B5%E9%9D%A2.png)
我有一份文档,其中的文本应该浮动在我用 插入的横向页面周围\afterpage{}
。如果(就像我的情况一样)某个段落被 afterpage '打断'(即该段落在横向页面之前开始并在其之后结束),并且同时有一个脚注,那么该脚注将独自进入一个原本空白的页面。
以下是 MWE:
\documentclass[11pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{afterpage} %for landscape pages with text floating around
\usepackage{pdflscape} %for landscape pages
\usepackage{bigfoot} % for better footnotes
\usepackage{lipsum} % for testing
\interfootnotelinepenalty=10000
\begin{document}
\lipsum[1-4]
\afterpage{
\begin{landscape}
It doesn't matter what I put here.
\end{landscape}
\clearpage
}
Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text.\footnote{This is a footnote to a paragraph that starts on the page before afterpage and ends after the afterpage. The footnote should be on the page after, but instead it goes on an extra page. }
\lipsum[7-8]
\end{document}
期望的行为:编译示例时第 2 页的脚注应该位于当前的第 4 页上。这当然应该消除第 2 页,以便总共只有三页(即脚注将在第 3 页)。
不是解决方案:我知道我可以将相关段落分成两段,但我宁愿避免这样做。这是一条连贯的信息,中断会显得不自然。移动文本也是一样,因为我到处都有脚注。
答案1
这不是一个完美的解决方案,但它在这里有效。现在的问题是为什么第 3 页底部有这么大的空白?
\documentclass[11pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{afterpage} %for landscape pages with text floating around
\usepackage{pdflscape} %for landscape pages
\let\oldoutput\output
\usepackage{bigfoot} % for better footnotes
\let\newoutput\output
\usepackage{lipsum} % for testing
\interfootnotelinepenalty=10000
\begin{document}
\lipsum[1-4]
\afterpage{\let\clearpage\newpage
\begin{landscape}
It doesn't matter what I put here.
\end{landscape}
}
Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text.
\footnote{This is a footnote to a paragraph that starts on the page before afterpage and ends after the afterpage. The footnote should be on the page after, but instead it goes on an extra page. }
\lipsum[7-8]
\end{document}
以上演示了\clearpage
和\output
在问题中的作用。此解决方案将\footnotemark
和\footnotetext
放在不同的段落中。 \afterpage
在格式化第一个段落之后但在打印结尾之前执行。这应该通常有效,尽管仅在这种情况下才需要它。
\documentclass[11pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{afterpage} %for landscape pages with text floating around
\usepackage{pdflscape} %for landscape pages
\usepackage{bigfoot} % for better footnotes
\usepackage{lipsum} % for testing
\interfootnotelinepenalty=10000
\begin{document}
\lipsum[1-4]
\afterpage{%
\begin{landscape}
It doesn't matter what I put here.
\end{landscape}
}
Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text.
\footnotemark
\hrule height0pt% removes gap
\footnotetext{This is a footnote to a paragraph that starts on the page before afterpage and ends after the afterpage. The footnote should be on the page after, but instead it goes on an extra page. }
\lipsum[7-9]
\end{document}