LaTeX 报告类中 \include 后的空白页

LaTeX 报告类中 \include 后的空白页

我将我的论文写成几个独立的章节,并将它们合并到一个.tex文件中。

有些章节是文章的 pdf,它们只是添加到我的master.tex使用中\input

但是,有 2 章是“传统”写作的(不是已发表的文章),每章末尾都包含参考书目。因此,我使用了chapterbib启用[sectionbib]的。为了显示单独的参考书目,我必须列出\include这些章节,而不是\input

\documentclass[a4paper,12pt,openany]{report}
\usepackage{pdfpages}
\usepackage[top=1.5in, bottom=1.5in, left=1.57in, right=1in]{geometry}
\usepackage[sectionbib]{natbib}
\usepackage[sectionbib]{chapterbib}
\bibliographystyle{apalike}

\begin{document}

\input{frontpage}
\input{abstracts}
\input{declarationandcopyright}
\input{acknowledgementsanddedictation}
\include{chapter1}
\input{chapter2}
\input{chapter3}
\input{chapter4}
\include{chapter5}
\input{chapter6}

\end{document}

问题:在第 1 章开始之前我得到了两个额外的空白页,在第 2 章开始之前得到了一个额外的空白页,但在第 2-3 章或第 3-4 章之间没有额外的空白页等。

以下是我其中一章的示例\include

\chapter{Introduction}

\addcontentsline{lof}{chapter}{Introduction}
\addcontentsline{lot}{chapter}{Introduction}
\section{A subtitle}
Some text here
\newpage
\bibliographystyle{apalike}
\bibliography{library}

以下是我其中一章的示例\input

\chapter{chapter3}
\includepdf[pages=-, scale=0.9, offset=30 1]{paper2.pdf}

我必须\include在 BibTeX 中单独编译每个章节,然后在我的 上运行两次 PDFLaTeX master.tex

我以为这是 LaTeX 的问题,它试图将每章的第一页放在奇数页上。但实际上它把它们放在奇数或偶数上。所以也许这与参考书目有关?

关于如何清除这些空白页,您有什么建议吗?非常感谢。

答案1

以下答案基本上是威尔·罗伯逊stackoverflow 上的回答。似乎 TeX.SX 上实际上没有答案,所以我想我也会在这里发布它。

\include在包含的内容之前和之后发出\clearpage。有两种方法可以解决这个问题。

第一种方法是使用\input\include参见何时应使用 \input 和 \include?)。

但是,由于 OP 遵循的方法与上述方法一样,因此第二种选择是利用提供命令的\includenewclude\include*包。此命令确实不是\clearpage在 d 内容的开始和结束时发出\include


也可以看看:

(尽管这些问题的答案都没有提到Will Robertson 在 stackoverflow 上提供的答案

答案2

根据我的经验,一个更简单、更强大的解决方案:

\let\oldInclude=\include
\def\include#1{\bgroup\def\clearpage{\relax}\oldInclude{#1}\egroup}

相关内容