10

I'm writing my thesis as several separate chapters and incorporating them into one .tex file.

Some of the chapters are pdfs of articles, and they are simply added to my master.tex using \input.

However, 2 chapters are 'traditionally' written (not published articles) and include a bibliography at the end of each chapter. For this reason, I use chapterbib with [sectionbib] enabled. And in order for the separate bibliographies to appear, I have to \include these chapters, rather than \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}

The problem: I'm getting two additional blank pages before the start of chapter 1, one extra blank page before the start of chapter 2, but no extra blank pages in between chapters 2-3 or 3-4 etc.

An example of one of my \include chapters:

\chapter{Introduction}

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

An example of one of my \input chapters:

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

I have to compile each \include chapter individually in BibTeX, then run PDFLaTeX twice on my master.tex.

I assumed it was a problem with LaTeX trying to keep the first page of each chapter on an odd numbered page. But actually it's putting them on odd or even. So perhaps it's something to do with the bibliographies?

Any suggestions about how I can get rid of all these blank pages? Much appreciated.

4
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Commented Aug 19, 2013 at 19:03
  • 2
    Related: When should I use \input vs. \include? Commented Aug 19, 2013 at 19:04
  • 3
    \include does a \clearpage before and after the content that is included; see this answer. If you need to use \include with no page breaks, then see this answer. Commented Aug 19, 2013 at 19:04
  • Okay, my solution. Using \let\clearpage\relax does work (gets rid of blank space between chapters), however I have some landscape-orientated tables in my document, and they went horrible wrong when I did this. So I used the 'newclude' package (ctan.org/tex-archive/macros/latex/contrib/frankenstein) alongside \include*(mychapter) and it worked a treat. Commented Aug 20, 2013 at 9:53

2 Answers 2

10

The following answer is basically a copy of Will Robertson's answer on stackoverflow. It seems that it doesn't actually have an answer on TeX.SX, so I thought that I would post it here, too.

\include issues a \clearpage before and after the content that is included. There are two ways around this.

The first way is to use \input instead of \include (cf., When should I use \input vs. \include?).

However, since the OP is after a method that functions as \include does, the second option, then, is to utilize the package newclude which provides the command \include*. This command does not issue the \clearpage at the beginning and at the end of the \included content.


See also:

(Though none of the answers to these questions mention the answer provided by Will Robertson on stackoverflow.)

1

A simpler, and in my experience, more robust solution:

\let\oldInclude=\include
\def\include#1{\bgroup\def\clearpage{\relax}\oldInclude{#1}\egroup}
2
  • 1
    I know this thread is like, a million years old, but I'm up-voting your solution. This is the perfect mix of familiar (because no new packages), succinct, and robust. Many thanks for this! Update: I just discovered that this solution breaks the use of \usepackage{xr} to cross-list Theorems/Lemmas/etc. with the same name (in different files) from one file to the other. I'm going to tinker to try to rectify but for most cases, I think it's safe to say that your solution will be a non-issue. Commented Sep 24, 2014 at 23:31
  • the \clearpage in \include in necessary, this completely breaks \include functionality. Use \input if you do not want \include. Commented Apr 17, 2018 at 17:39

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.