TeX Live 2014 在 Xubuntu 14.04 LTS 上,使用 进行编译xelatex
。
最小工作示例:
\documentclass[11pt, twoside]{book}
\usepackage{geometry}
\geometry{a4paper, left=3.5cm, right=2.5cm, top=3.5cm, bottom=3.5cm}
\usepackage{fontspec}
\setmainfont[Mapping=tex-text]{Linux Libertine O}
\setmonofont{Linux Libertine Mono O}
\usepackage{lipsum}
\usepackage{afterpage}
\begin{document}
\mainmatter
\lipsum[1-3]
\afterpage{
\clearpage
Here be landscape content.
\clearpage
}
\lipsum[4-5]
\paragraph{Paragraph Title}
Text spanning this and the two next lines. Text spanning this and the two next
lines. Text spanning this and the two next lines. Text spanning this and the
two next lines. Text spanning this and the two next lines. Text spanning this
and the two next lines.
\paragraph{Paragraph Title}
Text spanning this and the three next lines. Text spanning this and the three
next lines. Text spanning this and the three next lines. Text spanning this
and the three next lines. Text spanning this and the three next lines. Text
spanning this and the three next lines. Text spanning this and the three next
lines.
\paragraph{This paragraph breaks uglily}\label{mrkr}
\lipsum[2]
\end{document}
第一个\paragraph
出现在后面的\afterpage
被剪切成位于其自己页面上的插入标题,其余部分出现在后面\afterpage
。我做错了什么?
附言:我不得不添加自己的虚拟段落,因为尝试让段落获得正确的高度太麻烦了\lipsum
。
答案1
在根据实际约 100 页的文档构建 MWE 时,我删除了\label
后面的 from \paragraph
,发现不需要的分页符消失了。重新阅读《LaTeX 指南》(第 211-212 页,第四版)中的相应页面时,我偶然发现了这一点:
请注意,命令存储的计数器值
\label
取决于命令的上下文。这通常是不言而喻的。在常规文本中,它将是最后发出的分段命令的计数器及其值,这些值可能不会立即可见。因此,当需要引用分段编号时,最好将命令放在\label
相应的分段命令之后,甚至放在其参数中,作为标题文本的一部分。这实际上是推荐的方法。仅当您想引用该处的页码时才将\label
命令放在正文内。
突出显示是我添加的。因此,这样做后,MWE 看起来如下所示:
\documentclass[11pt, twoside]{book}
\usepackage{geometry}
\geometry{a4paper, left=3.5cm, right=2.5cm, top=3.5cm, bottom=3.5cm}
\usepackage{fontspec}
\setmainfont[Mapping=tex-text]{Linux Libertine O}
\setmonofont{Linux Libertine Mono O}
\usepackage{lipsum}
\usepackage{afterpage}
\begin{document}
\mainmatter
\lipsum[1-3]
\afterpage{
\clearpage
Here be landscape content.
\clearpage
}
\lipsum[4-5]
\paragraph{Paragraph Title}
Text spanning this and the two next lines. Text spanning this and the two next
lines. Text spanning this and the two next lines. Text spanning this and the
two next lines. Text spanning this and the two next lines. Text spanning this
and the two next lines.
\paragraph{Paragraph Title}
Text spanning this and the three next lines. Text spanning this and the three
next lines. Text spanning this and the three next lines. Text spanning this
and the three next lines. Text spanning this and the three next lines. Text
spanning this and the three next lines. Text spanning this and the three next
lines.
\paragraph{This paragraph breaks nicely\label{mrkr}}
\lipsum[2]
\end{document}
所以,现在我们知道为什么这是推荐的做事方式。
答案2
我发现了同样的问题,但由字符串触发\paragraph{Name}\index{entry}
。当重新编码为
blah blah blah
\afterpage{....big landscape figure}
blah blah blah
\paragraph{Name of paragraph\index{entry}} blah blah blah
问题就消失了。