3

I'm currently playing around with the LaTeX template for my thesis, but am at a loss as to why extra pages appear between the generated "Contents", "Glossary" and "Acronyms" lists?

Is this a problem with interference between the loaded packages, or have I forgotten something important? Can I manually suppress the creation of these extra pages by tweaking the \tableofcontents and \printglossaries commands?

I am running this project on Windows 7, using the TeXmaker front end... Cheers.


%% Define document class and load required packages
\documentclass{book}
\usepackage[british]{babel} 
\usepackage{commath, amsmath, amsfonts, amssymb, setspace}
\usepackage{graphicx, pgfplots} \pgfplotsset{compat=newest} 
\usepackage[colorlinks=true,linkcolor=red,citecolor=green, urlcolor=blue]{hyperref}
\usepackage[xindy, toc, acronym, nonumberlist, translate=babel]{glossaries} \makeglossaries

%% Define example glossary entry
\newglossaryentry{exampleglossary}{
    name={Example Glossary},
    description={An example glossary entry},
    sort=exampleglossary
}

%% Define example acronym entry
\newacronym{exampleacronym}{EA}{Example Acronym}

%% Begin document
\begin{document}

%% Generate table of contents and glossary pages
\tableofcontents
\glsaddall \printglossaries 

%% Define example chapter with hyperref links
\chapter{Chapter Title}
Example Bibliography reference \cite{examplebibliography}.\\
Example Glossary reference \gls{exampleglossary}.\\
Example Acronym reference \gls{exampleacronym}.\\

%% Define example bibliography entry and construct bibliography
\addcontentsline{toc}{chapter}{Bibliography}    
\begin{thebibliography}{9}

    \bibitem{examplebibliography} 
        author, 
        title, 
        publisher,
        year.

\end{thebibliography}       

%% End document
\end{document}
1
  • 2
    Welcome to the site! Thanks for providing a complete example- it's not quite minimal, but it's still very helpful :)
    – cmhughes
    Feb 14, 2014 at 23:40

2 Answers 2

4

As cmhughes indicates, this is the intended behaviour. By default, the book class assumes that your book will be printed double-sided and that you would like things like the table of contents to always appear on an odd page. Usually, that is what you want. If not, however, you have various options.

If your document is to be double-sided but you don't mind whether things start on odd (front) or even (back) pages, you can use

\documentclass[openany]{book}

If, on the other hand, your book will be single-sided, then it would be better to use

\documentclass[oneside]{book}

which will also ensure consistent headers and margins (which TeX will otherwise typically change to accommodate different odd and even page layouts).

With openany:

Double-sided with openany

Note the changes to inner and outer margins between odd and even pages because they are designed to be printed back-to-back.

With oneside:

Single-sided

Note the consistent page margins for the single-sided case.

2
  • Thanks cfr; the subtle difference between openany and oneside document classes is definitely useful to know for future projects, but in order to satisfy my University's one-sided marking criteria, using the oneside is preferable for my thesis... Feb 15, 2014 at 0:06
  • @DominicKerr oneside is generally what you want. I don't remember ever using openany. Note that oneside is preferable to the solution offered by cmhughes, I think, because it will get the margins and headers correct whereas that solution will work more like openany but just restricted to a particular part of the document.
    – cfr
    Feb 15, 2014 at 0:10
2

Don't worry, this is the expected behaviour; what you're seeing is the result of the \cleardoublepage command which is issued by the book document class between successive chapters.

You can manually tell it not to do so by temporarily disabling the command- the following code does the trick:

\begingroup
\let\cleardoublepage\relax
\tableofcontents
\printglossaries 
\endgroup
2
  • Amazing; Thanks so much. Additionally I have just stumbled across an article suggesting that redefining the document class as \documentclass[oneside]{book} also fixes the problem... Feb 14, 2014 at 23:43
  • @DominicKerr See my answer below. oneside will have other effects - good if your document is single-sided, not otherwise. openany is an alternative with more limited effects. Either of these will help ensure a consistent layout throughout the document. (Although cmhughes solution may work better if you really just need to change this one aspect of layout for some reason.)
    – cfr
    Feb 14, 2014 at 23:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .