Search code examples
latextableofcontents

Strange interaction between multi-page \tableofcontents and \pagenumbering{roman}


Take this document:

\documentclass{report}
\usepackage[utf8]{inputenc}

\usepackage{blindtext}

\title{\LaTeX\ page numbering repro}
\author{Hendrik}

\begin{document}

%\pagenumbering{roman}

\maketitle

\begin{abstract}
    \blindtext
\end{abstract}

\tableofcontents

%\pagenumbering{arabic}

\chapter{Chapter 1}

\section{Section}
\Blindtext
\subsection{Subsection}
\Blindtext
\subsection{Subsection}
\Blindtext
\subsection{Subsection}
\Blindtext

\section{Section}
\Blindtext
\subsection{Subsection}
\Blindtext
\subsection{Subsection}
\Blindtext
\subsection{Subsection}
\Blindtext

\section{Section}
\Blindtext
\subsection{Subsection}
\Blindtext
\subsection{Subsection}
\Blindtext
\subsection{Subsection}
\Blindtext

\chapter{Chapter 2}

\section{Section}
\Blindtext
\subsection{Subsection}
\Blindtext
\subsection{Subsection}
\Blindtext
\subsection{Subsection}
\Blindtext

\section{Section}
\Blindtext
\subsection{Subsection}
\Blindtext
\subsection{Subsection}
\Blindtext
\subsection{Subsection}
\Blindtext

\section{Section}
\Blindtext
\subsection{Subsection}
\Blindtext
\subsection{Subsection}
\Blindtext
\subsection{Subsection}
\Blindtext

\chapter{Chapter 3}

\section{Section}
\Blindtext
\subsection{Subsection}
\Blindtext
\subsection{Subsection}
\Blindtext
\subsection{Subsection}
\Blindtext

\section{Section}
\Blindtext
\subsection{Subsection}
\Blindtext
\subsection{Subsection}
\Blindtext
\subsection{Subsection}
\Blindtext

\section{Section}
\Blindtext
\subsection{Subsection}
\Blindtext
\subsection{Subsection}
\Blindtext
\subsection{Subsection}
\Blindtext

\end{document}

It compiles correctly, such that

  • title page and abstract are unnumbered,
  • the first page of the ToC is page 1,
  • the second page of the ToC is page 2,
  • it continues with pages 3, 4, 5, ….

However, I would like everything before chapter 1 to use roman numbers, such that chapter 1 starts at page 1. To accomplish that, I added the \pagenumbering{roman} and \pagenumbering{arabic} lines. If you uncomment them, the document still compiles, but there is a problem.

  • Title page and abstract are still unnumbered. ✓
  • First page of the ToC starts at i. ✓
  • Second page of the ToC is now page 1. ❌ What? why??
  • It continues with pages 2, 3, 4, …. ✓

I want the second page of the ToC to be numbered page ii instead. What is going on here?


Solution

  • You used \pagenumbering{arabic} when you were still on the page of the toc. The page break only happens when the chapter starts. So you either have to start the new page manually (e.g. \clearpage) or use it when the chapter has already started the new page.

    \documentclass{report}
    \usepackage[utf8]{inputenc}
    
    \usepackage{blindtext}
    
    \title{\LaTeX\ page numbering repro}
    \author{Hendrik}
    
    \begin{document}
    
    \pagenumbering{roman}
    
    \maketitle
    
    \begin{abstract}
        \blindtext
    \end{abstract}
    
    \tableofcontents
    
    
    
    \chapter{Chapter 1}
    \pagenumbering{arabic}
    
    \section{Section}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    
    \section{Section}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    
    \section{Section}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    
    \chapter{Chapter 2}
    
    \section{Section}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    
    \section{Section}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    
    \section{Section}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    
    \chapter{Chapter 3}
    
    \section{Section}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    
    \section{Section}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    
    \section{Section}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    \subsection{Subsection}
    \Blindtext
    
    \end{document}