4

I have just started typesetting my PhD thesis. I am using the book class. I have a parent file where I define style, chapter header styling, page numbering, etc., and I include every chapter using \include{}. When compiled I have one single PDF file. However, I have a problem with page numbering on preliminary pages such as Abstract, List of Contents, List of Figures, etc. Page numbers restart on every preliminary page. Here is how my TeX file looks like

%Page number formatting for preliminary pages.
\fancypagestyle{preliminary}{
\fancyhf{}
\fancyfoot[C]{\thepage}
\pagenumbering{roman}
\renewcommand{\headrulewidth}{0pt}
\fancypagestyle{plain}{\pagestyle{preliminary}}}

%Page number formatting for main matter.
\fancypagestyle{mainmatter}{
\fancyhf{}
\fancyfoot[C]{\thepage}
\pagenumbering{arabic}
\renewcommand{\headrulewidth}{0pt}
\fancypagestyle{plain}{\pagestyle{mainmatter}}

\onehalfspacing

\newenvironment{abstract}{\chapter*{Abstract}}{}

\begin{document}

\pagestyle{preliminary}
\setcounter{page}{2}

\begin{abstract}...\end{abstract}

\tableofcontents
\listoffigures
\listoftables

\mainmatter

\pagestyle{mainmatter}
\include{chapter1}

\end{document}

Am I doing something wrong? I have a suspicion that pre-defined page number formatting at the very beginning is causing this but I am not sure. What do you guys think?

  • 2
    \pagenumbering restarts the page counter at 1, so this is actually reset at page shipout, with every page. So, remove \pagenumbering{roman} and \pagenumbering{arabic} from the page styles, and include them directly in your document at the appropriate location. – Werner Jul 23 '13 at 4:34
  • Thank you @Werner. It worked like a charm. Probably the fastest reply and solution at the same time. Thanks :) – Mustafa Hasanbulli Jul 23 '13 at 4:40
4

You define the two page styles preliminary and mainmatter to be the same, except for the numbering (roman in the former, arabic in the latter). So, for now, the following setup is what you're after:

\documentclass{book}

%... Preamble stuff

% Page style for preliminary pages.
\fancypagestyle{preliminary}{
  \fancyhf{}% Clear header/footer
  \fancyfoot[C]{\thepage}% Footer
  \renewcommand{\headrulewidth}{0pt}% No header rule
}

% Page style for main matter.
\fancypagestyle{mainmatter}{
  \fancyhf{}% Clear header/footer
  \fancyfoot[C]{\thepage}% Footer
  \renewcommand{\headrulewidth}{0pt}% No header rule
}

%...

\begin{document}

\pagestyle{preliminary}\pagenumbering{roman}
\fancypagestyle{plain}{\pagestyle{preliminary}}% Correct plain page style

%... Preliminary stuff

\mainmatter
\pagestyle{mainmatter}\pagenumbering{arabic}
\fancypagestyle{plain}{\pagestyle{mainmatter}}% Correct plain page style

%... Mainmatter stuff

\end{document}

Another common way of copying a page style into another is to use

\makeatletter
\let\ps@plain\ps@preliminary% Copy preliminary page style into plain
\makeatother
  • Beautiful. Thank you. Though, I think, you forgot to add \pagestyle{} in \fancypagestyle{}{}. – Mustafa Hasanbulli Jul 23 '13 at 4:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.