0

I checked all solutions for similar questions to no avail. I have an extra empty page in my TOC, and I noticed that if I move \frontmatter and put it after the title page, it is solved! but another empty page is introduced after title page this time!! Here's my code for reproducibility

\documentclass[12pt,openany,a4paper]{book}
\pagestyle{headings}        % Chapter on left page, Section on right.
\usepackage{titlesec}
\titleformat{\chapter}[hang]{\Huge\bfseries}{\thechapter\hspace{20pt}}{0pt}{\Huge\bfseries}
\titlespacing{\chapter}{0pt}{-40pt}{1em}
\raggedbottom

\usepackage[margin=2.5cm]{geometry}

\usepackage{blindtext}
\usepackage{multirow,tabularx}
\usepackage[%
    bibstyle=ieee,
    citestyle=numeric-comp,
    isbn=false, 
    doi=false,
    sorting=none,
    url=false,
    defernumbers=true,
    bibencoding=utf8,
    urldate=long,
    backend=biber
]{biblatex}
\bibliography{ref}


\begin{document}

\frontmatter
% By default, frontmatter has Roman page-numbering (i,ii,...).

\begin{titlepage}
My title
\end{titlepage}



\chapter{Abstract}
\blindtext

\tableofcontents

\mainmatter

\chapter{Introduction}
\blindtext


\chapter{Methodology}
Provides an outline of the methodological approach including a theoretical justification of the approach.
Describes any analytical techniques and research designs, if appropriate.


\chapter{Outcomes}
Describes the results to date and expected outcomes of future studies.
Discusses the findings.


While the outcome presented above is reasonable, it is still behind the ultimate target, which is a working algorithm on real human heads. Therefore, we keep pushing in this direction.

In more challenging and realistic scenarios
We report that fragility of neural nets is seriously limiting its use in such a sensitive application.

\chapter{Time-line}
This must include a clear plan for the completion of experiments, write up of papers (including a targeted list of suitable journals and conferences) and write up of the thesis.
\section{Year 1 (2019)}
    \begin{tabularx}{\textwidth}{l}
        \hline \vspace{-0.3cm}
    \end{tabularx}

\noindent
    \begin{tabularx}{\textwidth}{@{} p{2cm} p{13.5cm}}
        \\ Q1 -- Q2 & 
        \vspace{-0.74cm} 

\begin{itemize}
\item Getting acquainted with the project, the technical details entailed with calibrating the system and the type of data provided.

\item Reviewing the literature on machine learning.
\end{itemize}

        \\ Q3 -- Q4 & 
        \vspace{-0.74cm}

\begin{itemize}
\item blah

\item blah
\end{itemize}

    \end{tabularx}



\section{Year 2 (2020)}

    \begin{tabularx}{\textwidth}{l}
        \hline \vspace{-0.3cm}
    \end{tabularx}


\noindent
    \begin{tabularx}{\textwidth}{@{} p{2cm} p{13.5cm}}
        \\ Q1 -- Q2 & 
        \vspace{-0.74cm} 

\begin{itemize}
\item \blindtext
\item \blindtext
\end{itemize}


        \\ Q3 -- Q4 & 
        \vspace{-0.74cm}

\begin{itemize}
\item \blindtext
\item \blindtext
\end{itemize}

    \end{tabularx}


\section{Year 3 (2021)}
    \begin{tabularx}{\textwidth}{l}
        \hline \vspace{-0.3cm}
    \end{tabularx}


\noindent
    \begin{tabularx}{\textwidth}{@{} p{2cm} p{13.5cm}}
        \\ Q1 -- Q2 & 
        \vspace{-0.74cm} 

\begin{itemize}
\item \blindtext
\item \blindtext
\end{itemize}


        \\ Q3 -- Q4 & 
        \vspace{-0.74cm}

\begin{itemize}
\item \blindtext
\item \blindtext
\end{itemize}

    \end{tabularx}


\chapter{Bibliography}


    \begin{appendix}
\chapter{Publications}
\section{Unpublished work}
Hi there
    \end{appendix}

\end{document}
Alex Deft
  • 103
  • 2
    unrelated to the question but never use tabularx without an X column. \begin{tabularx}{\textwidth}{@{} p{2cm} p{13.5cm}} should be \begin{tabular}{@{} p{2cm} p{13.5cm}} – David Carlisle Dec 30 '19 at 20:54
  • 1
    This is caused by \mainmatter. Does https://tex.stackexchange.com/questions/498201/preventing-mainmatter-from-inserting-a-blank-page help? – David Purton Dec 31 '19 at 00:42
  • @DavidPurton Yes it helped!! thanks. Bottomline: I added oneside argument and it worked! it seems that towside is the default (it wasn't there). Because of that default case, it attempts to add another page to ensure that we end on an even numbered page. – Alex Deft Dec 31 '19 at 00:51

1 Answers1

2

The reason you get the double page break is from \mainmatter, which in turn calls \cleardoublepage, which is defined as follows (from latex.ltx):

\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
    \hbox{}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}

Explanation:

  • \clearpage clears the current page and starts a new one.
  • \if@twoside if the document is two sided
    • \ifodd\c@page\else if the current page is not odd
      • \hbox{}\newpage insert an empty box and a new page (or column)
      • \if@twocolumn if the current page has two columns
        • \hbox{}\newpage insert an empty box and a new page
      • \fi close \if@twocolumn test
    • \fi close \ifodd test
  • \fi close \if@twoside test

So, how does this play out in your document?

The default options of the book class mean that \if@twoside is true and \if@twocolumn is false.

When you call \mainmatter after your table of contents, which is on page iii, \cleardoublepage is called. First a new page is inserted, making the current page iv. The document is two sided and the current page is now not odd (it's iv), so \hbox{}\clearpage is inserted. The document is not two column, so this inserts a blank page and the numbering is reset to 1 (by \mainmatter). It needs to do this for a two sided document otherwise you would get page 1 on the left hand side of two facing pages, which is weird.

The solution is to make sure your document does not use a two sided set up. Then there are no facing pages, and your document can go from page iii to page 1 without it seeming weird.

So the solution is to load the book class with the oneside option:

\documentclass[12pt,oneside,openany,a4paper]{book}
David Purton
  • 25,884