1

I'm challenged with adjusting the page numbering in the frontmatter of my thesis. I downloaded a template thesis given here, which uses the book class as a basis for the newly defined class Thesis.cls. In order to compile the MWE below you'll also a need the vector.sty and lstpatch.sty files from the link I provided (unless it's deemed necessary for me to copy and paste them in the main body of my question). Sparing details, my class document looks something like this:

\NeedsTeXFormat{LaTeX2e}[1996/12/01]
\ProvidesClass{Thesis}
              [2007/22/02 v1.0
   LaTeX document class]
\def\baseclass{book}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{\baseclass}}
\def\@checkoptions#1#2{
  \edef\@curroptions{\@ptionlist{\@currname.\@currext}}
  \@tempswafalse
  \@tfor\@this:=#2\do{
    \@expandtwoargs\in@{,\@this,}{,\@curroptions,}
    \ifin@ \@tempswatrue \@break@tfor \fi}
  \let\@this\@empty
  \if@tempswa \else \PassOptionsToClass{#1}{\baseclass}\fi
}
\@checkoptions{11pt}{{10pt}{11pt}{12pt}}
\PassOptionsToClass{a4paper}{\baseclass}
\ProcessOptions\relax
\LoadClass{\baseclass}
\newcommand\bhrule{\typeout{------------------------------------------------------------------------------}}

\newcommand\Declaration[1]{
\btypeout{Approval of the Dissertation Committee}
\addtotoc{Approval of the Dissertation Committee}
\thispagestyle{plain}
\null\vfil
%\vskip 60\p@
\begin{center}{\huge\bf Approval of the Dissertation Committee\par}\end{center}
%\vskip 60\p@
{\normalsize #1}
\vfil\vfil\null
%\cleardoublepage
}

\newcommand\btypeout[1]{\bhrule\typeout{\space #1}\bhrule}
\def\today{\ifcase\month\or
  January\or February\or March\or April\or May\or June\or
  July\or August\or September\or October\or November\or December\fi
  \space \number\year}
\usepackage{setspace}
\onehalfspacing
\setlength{\parindent}{0pt}
\setlength{\parskip}{2.0ex plus0.5ex minus0.2ex}
\usepackage{vmargin}
\setmarginsrb           { 1.5in}  % left margin
                        { 0.6in}  % top margin
                        { 1.0in}  % right margin
                        { 0.8in}  % bottom margin
                        {  20pt}  % head height
                        {0.25in}  % head sep
                        {   9pt}  % foot height
                        { 0.3in}  % foot sep
\raggedbottom
\setlength{\topskip}{1\topskip \@plus 5\p@}
\doublehyphendemerits=10000       % No consecutive line hyphens.
\brokenpenalty=10000              % No broken words across columns/pages.
\widowpenalty=9999                % Almost no widows at bottom of page.
\clubpenalty=9999                 % Almost no orphans at top of page.
\interfootnotelinepenalty=9999    % Almost never break footnotes.
\usepackage{fancyhdr}
\lhead[\rm\thepage]{\fancyplain{}{\sl{\rightmark}}}
\rhead[\fancyplain{}{\sl{\leftmark}}]{\rm\thepage}
\chead{}\lfoot{}\rfoot{}\cfoot{}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\btypeout{\thechapter\space #1}\markboth{\@chapapp\ \thechapter\ #1}{\@chapapp\ \thechapter\ #1}}
\renewcommand{\sectionmark}[1]{}
\renewcommand{\subsectionmark}[1]{}
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
\hbox{}
\thispagestyle{empty}
\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\usepackage{amsmath,amsfonts,amssymb,amscd,amsthm,xspace}
\theoremstyle{plain}
\newtheorem{example}{Example}[chapter]
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{axiom}[theorem]{Axiom}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\theoremstyle{remark}
\newtheorem{remark}[theorem]{Remark}
\usepackage[centerlast,small,sc]{caption}
\setlength{\captionmargin}{20pt}
\newcommand{\fref}[1]{Figure~\ref{#1}}
\newcommand{\tref}[1]{Table~\ref{#1}}
\newcommand{\eref}[1]{Equation~\ref{#1}}
\newcommand{\cref}[1]{Chapter~\ref{#1}}
\newcommand{\sref}[1]{Section~\ref{#1}}
\newcommand{\aref}[1]{Appendix~\ref{#1}}
\renewcommand{\topfraction}{0.85}
\renewcommand{\bottomfraction}{.85}
\renewcommand{\textfraction}{0.1}
\renewcommand{\dbltopfraction}{.85}
\renewcommand{\floatpagefraction}{0.75}
\renewcommand{\dblfloatpagefraction}{.75}
\setcounter{topnumber}{9}
\setcounter{bottomnumber}{9}
\setcounter{totalnumber}{20}
\setcounter{dbltopnumber}{9}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage[scriptsize]{subfigure}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{listings}
\usepackage{lstpatch}
\lstset{captionpos=b,
        frame=tb,
        basicstyle=\scriptsize\ttfamily,
        showstringspaces=false,
        keepspaces=true}
\lstdefinestyle{matlab} {
        language=Matlab,
        keywordstyle=\color{blue},
        commentstyle=\color[rgb]{0.13,0.55,0.13}\em,
        stringstyle=\color[rgb]{0.7,0,0} }
\usepackage[pdfpagemode={UseOutlines},bookmarks=true,bookmarksopen=true,
   bookmarksopenlevel=0,bookmarksnumbered=true,hypertexnames=false,
   colorlinks,linkcolor={blue},citecolor={blue},urlcolor={red},
   pdfstartview={FitV},unicode,breaklinks=true]{hyperref}
\pdfstringdefDisableCommands{
   \let\\\space
}
\newcommand*{\supervisor}[1]{\def\supname{#1}}
\newcommand*{\examiner}[1]{\def\examname{#1}}
\newcommand*{\degree}[1]{\def\degreename{#1}}
\newcommand*{\authors}[1]{\def\authornames{#1}}
\newcommand*{\addresses}[1]{\def\addressnames{#1}}
\newcommand*{\university}[1]{\def\univname{#1}}
\newcommand*{\UNIVERSITY}[1]{\def\UNIVNAME{#1}}
\newcommand*{\department}[1]{\def\deptname{#1}}
\newcommand*{\DEPARTMENT}[1]{\def\DEPTNAME{#1}}
\newcommand*{\group}[1]{\def\groupname{#1}}
\newcommand*{\GROUP}[1]{\def\GROUPNAME{#1}}
\newcommand*{\faculty}[1]{\def\facname{#1}}
\newcommand*{\FACULTY}[1]{\def\FACNAME{#1}}
\newcommand*{\subject}[1]{\def\subjectname{#1}}
\newcommand*{\keywords}[1]{\def\keywordnames{#1}}
\supervisor  {Dr. Such and Such}
\examiner    {}
\degree      {}
\authors     {MEEE!!}
\university  {\texorpdfstring{\href{}
                {Real Good University}}
                {Real Good University}}
\UNIVERSITY  {\texorpdfstring{\href{}
                {REAL GOOD UNIVERSITY}}
                {REAL GOOD UNIVERSITY}}
\department  {\texorpdfstring{\href{}
                {Department of Fizzx}}
                {Department of Fizzx}}
\DEPARTMENT  {\texorpdfstring{\href{}
                {DEPARTMENT OF FIZZX}}
                {DEPARTMENT OF FIZZX}}
\group       {\texorpdfstring{\href{Research Group Web Site URL Here (include http://)}
                {Research Group Name}}
                {Research Group Name}}
\GROUP       {\texorpdfstring{\href{Research Group Web Site URL Here (include http://)}
                {RESEARCH GROUP NAME (IN BLOCK CAPITALS)}}
                {RESEARCH GROUP NAME (IN BLOCK CAPITALS)}}
\faculty     {\texorpdfstring{\href{Faculty Web Site URL Here (include http://)}
                {Faculty Name}}
                {Faculty Name}}
\FACULTY     {\texorpdfstring{\href{Faculty Web Site URL Here (include http://)}
                {FACULTY NAME (IN BLOCK CAPITALS)}}
                {FACULTY NAME (IN BLOCK CAPITALS)}}
\addresses   {}
\subject     {}
\keywords    {}
\renewcommand\maketitle{
  \btypeout{Title Page}
  \hypersetup{pdftitle={\@title}}
  \hypersetup{pdfsubject=\subjectname}
  \hypersetup{pdfauthor=\authornames}
  \hypersetup{pdfkeywords=\keywordnames}
  \thispagestyle{empty}
  \begin{titlepage}
    \let\footnotesize\small
    \let\footnoterule\relax
    \let \footnote \thanks
    \setcounter{footnote}{1}
    \null\vfil
    \vskip 60\p@
    \begin{center}
      \setlength{\parskip}{0pt}
      %{\large\textbf{Claremont Graduate University}\par}
      \vfill
      {\huge \bf \@title \par}
      \vfill
      {\LARGE by \par}
      \smallskip
      {\LARGE \authornames \par}
      \vfill
      {\large A thesis submitted in partial fulfillment for the \par}
      {\large degree of Doctor of Philosophy in Mathematics \par}
      \bigskip
      \bigskip
      {\large in the \par}
      %{\large \facname \par}
      {\large \deptname \par}
      {\large \univname \par}
      \bigskip
      \bigskip
      \bigskip
      {\Large \@date \par}
      \bigskip
    \end{center}
    \par
    \@thanks
    \vfil\null
  \end{titlepage}
  \setcounter{footnote}{0}%
  \global\let\thanks\relax
  \global\let\maketitle\relax
  \global\let\@thanks\@empty
  \global\let\@author\@empty
  \global\let\@date\@empty
  \global\let\@title\@empty
  \global\let\title\relax
  \global\let\author\relax
  \global\let\date\relax
  \global\let\and\relax
  \cleardoublepage
}
\newenvironment{abstract}
{
  \btypeout{Abstract Page}
  \thispagestyle{empty}
  \null\vfil
  \begin{center}
    \setlength{\parskip}{0pt}
{\huge{\textit{Abstract}} \par}
    \bigskip
    {\normalsize\bf A Pretty Decent(?) Thesis \par}
    \medskip
{\normalsize by \par}
    {\normalsize \authornames \par}
\bigskip
    {\normalsize \UNIVNAME : 2019 \par}
    \bigskip
   % {\normalsize \facname \par}
   % {\normalsize \deptname \par}
  %  \bigskip
 %   {\normalsize Doctor of Philosophy\par}
    %\bigskip
  \end{center}
}
{
  \vfil\vfil\vfil\null
  \cleardoublepage
}
\addtocounter{secnumdepth}{1}
\setcounter{tocdepth}{6}
\newcounter{dummy}
\newcommand\addtotoc[1]{
\refstepcounter{dummy}
\addcontentsline{toc}{chapter}{#1}}
\renewcommand\tableofcontents{
\btypeout{Table of Contents}
\begin{spacing}{1}{
    \setlength{\parskip}{1pt}
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\contentsname
        \@mkboth{
           \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}
    \@starttoc{toc}
    \if@restonecol\twocolumn\fi
   \cleardoublepage
}\end{spacing}
}
\renewcommand\listoffigures{
\btypeout{List of Figures}
\addtotoc{List of Figures}
\begin{spacing}{1}{
    \setlength{\parskip}{1pt}
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\listfigurename
      \@mkboth{\MakeUppercase\listfigurename}
              {\MakeUppercase\listfigurename}}
    \@starttoc{lof}
    \if@restonecol\twocolumn\fi
    \cleardoublepage
}\end{spacing}
}
\renewcommand\listoftables{
\btypeout{List of Tables}
\addtotoc{List of Tables}
\begin{spacing}{1}{
    \setlength{\parskip}{1pt}
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\listtablename
      \@mkboth{
          \MakeUppercase\listtablename}{\MakeUppercase\listtablename}}
    \@starttoc{lot}
    \if@restonecol\twocolumn\fi
    \cleardoublepage
}\end{spacing}
}
\newcommand\listsymbolname{Abbreviations}
\usepackage{longtable}
\newcommand\listofsymbols[2]{
\btypeout{\listsymbolname}
\addtotoc{\listsymbolname}
    \chapter*{\listsymbolname
      \@mkboth{
          \MakeUppercase\listsymbolname}{\MakeUppercase\listsymbolname}}
\begin{longtable}[c]{#1}#2\end{longtable}\par
    \cleardoublepage
}
\newcommand\listconstants{Physical Constants}
\usepackage{longtable}
\newcommand\listofconstants[2]{
\btypeout{\listconstants}
\addtotoc{\listconstants}
    \chapter*{\listconstants
      \@mkboth{
          \MakeUppercase\listconstants}{\MakeUppercase\listconstants}}
\begin{longtable}[c]{#1}#2\end{longtable}\par
    \cleardoublepage
}
\newcommand\listnomenclature{Symbols}
\usepackage{longtable}
\newcommand\listofnomenclature[2]{
\btypeout{\listnomenclature}
\addtotoc{\listnomenclature}
    \chapter*{\listnomenclature
      \@mkboth{
          \MakeUppercase\listnomenclature}{\MakeUppercase\listnomenclature}}
\begin{longtable}[c]{#1}#2\end{longtable}\par
    \cleardoublepage
}
\newcommand\acknowledgements[1]{
\btypeout{Acknowledgements}
\addtotoc{Acknowledgements}
\thispagestyle{plain}
\begin{center}{\huge{\textit{Acknowledgements}} \par}\end{center}
{\normalsize #1}
\vfil\vfil\null

}
\newcommand\dedicatory[1]{
\btypeout{Dedicatory}
\thispagestyle{plain}
\null\vfil
\vskip 60\p@
\begin{center}{\Large \sl #1}\end{center}
\vfil\null
\cleardoublepage
}
\renewcommand\backmatter{
  \if@openright
    \cleardoublepage
  \else
    \clearpage
  \fi
  \addtotoc{\bibname}
  \btypeout{\bibname}
  \@mainmatterfalse}
\endinput

I've also included a MWE for compiling:

\documentclass[a4paper, 11pt, oneside]{Thesis}  
\begin{document}
\setstretch{1.3}  
\fancyhead{}  
\rhead{} %\thepage}  
\lhead{} 
\pagestyle{empty} 

\frontmatter     
\title  {A Pretty Decent(?) Thesis}
\authors  {Me}

\maketitle


%% ----------------------------------------------------------------
% The "Funny Quote Page"
\pagestyle{empty}  % No headers or footers for the following pages

\null\vfill

\begin{flushright}
Ha! A limerick\\
The bane of my existence\\
Thank goodness I'm done
\end{flushright}

\vfill\vfill\vfill\vfill\vfill\vfill\null
\clearpage  % Funny Quote page ended, start a new page

\addtotoc{Abstract}  % Add the "Abstract" page entry to the Contents
\abstract{
\addtocontents{toc}{\vspace{1em}}  
It's a pretty good thesis, I promise.
}
\clearpage

\setstretch{1.3}  

\pagestyle{fancy}
\acknowledgements{
\addtocontents{toc}{\vspace{1em}}

Thank you, I love you, Babye.
} 

\pagestyle{fancy}  
\lhead{\emph{Contents}}  
\tableofcontents  
\lhead{\emph{List of Figures}}  
\listoffigures  

\end{document}

The main problem I'm seeing can be illustrated from the 4th compiled page (the acknowledgements) where we can see this is the 4th page in the document but it is listed as page iii:

The fourth page in the document is listed as page iii.

I want two things:

  1. I want roman numeral numberings to start on the title page (i.e. first page of the pdf should be page i).
  2. I don't want the frontmatter numberings visible until the acknowledgements section.

My MWE is not perfect since the first page number shown in the MWE is on the acknowledgments page, whereas in my actual thesis the abstract has page number i printed at the bottom. I'm not sure how to make my MWE more comprehensive, but hopefully I can solve these problems one at a time if not simultaneously.

1

Okay, let us start with an compilable code to explain your issue with fancyhdr.

With the following code simulating your thesis structure

\documentclass[a4paper, 11pt, oneside]{book} 

\usepackage{fancyhdr}
\usepackage{blindtext}

\title{A Pretty Decent Thesis}
\author{username}


\begin{document}

\frontmatter 
%\pagestyle{empty} % <===================================================

\maketitle

\section*{Abstract}
\Blindtext

\tableofcontents

\listoffigures

\pagestyle{fancy} % <===================================================
\mainmatter
\chapter{Introduction}
\Blinddocument
\end{document}

you can see that the two lines with \pagestyle are important. If you compile the code above you get

resulting pdf

There you can see two things: The page numbering is shown (because the first \pagestyle{empty} is commented!) and it uses roman numbers as you can see in the red circle at the bottom. Depending on your pdf viewer the pdf viewer numbers the pages completly with arabic numbers (that happens in your and in my case). That means that the first pages (in the print numbered with roman numbers until iv) are counted with arabic numbers. You can see that on the last page after compiling my code. The last page gets the printed page number 20, but is counted in the viewer as page 25. This behaviour depends on the used viewer. As far as I rememer Acrobat shows roman and arabic numbers, for example.

Now please uncomment the first \pagestyle{empty}. Now fancyhdr knows it has not to show headers and footers on all following pages (until \pagestyle{fancy} or another command like \tableofcontents uses style plain activates the standard header and footer of fancyhdr I used in this example code).

After compiling you get some pages without page numbering, but the table of contents still shows the roman page numbering. To get rid of that you have to call \thispagestyle{empty}, because command \tableofcontents is build to use style plain we do not want. Same could happen for listoffigures!

So the following code

\documentclass[a4paper, 11pt, oneside]{book} 

\usepackage{fancyhdr}
\usepackage{blindtext}

\title{A Pretty Decent Thesis}
\author{username}

\pagestyle{plain}{%
  \fancyhead{}
  \fancyfoot[c]{}
}


\begin{document}

\frontmatter 
\pagestyle{empty} % <===================================================

\maketitle
\pagestyle{empty}

\section*{Abstract}
\Blindtext

\tableofcontents
\thispagestyle{empty} % <==============================================

\listoffigures
\thispagestyle{empty} % <==============================================

\pagestyle{fancy} % <===================================================
\mainmatter
\chapter{Introduction}
\Blinddocument
\end{document}

gives you no page numbers in frontmatter, but shows page numbers starting with chapter 1:

enter image description here

Now you can use the explained commands here and use them in your thesis to get rid of the unwanted page numbers.

If you load hyperref in your code it depends on the used pdf viewer how the shown pages are numbered. In my case -- I'm using SumatraPDF -- I get then the following screen:

enter image description here

Now SumatraPDF can show that we are on page iii (or 4 in arabic numbers). The reason is that with hyperref the bookmarks are activated carying this information.

UPDATE:

The class you are using has some errors and one of them results in the wrong numbering of the page following the titlepage, that one you added the limerick.

To get rid of this error please add the following code in your preamble (before \begin{document}) to define a new environment, where I set explicitly as a workaround the page number to be 2 (see marked line <==========):

\newenvironment{funyquote}
{
  \btypeout{Funyquote Page}
  \thispagestyle{empty}
  \setcounter{page}{2}% <===============================================
  \null\vspace{3cm}
}
{
% \vfill\vfill\vfill\vfill\vfill\vfill\null
  \cleardoublepage
} 

The you can add after \maketitle the following code to add your page with limerick (of course delete the old code with limerick!):

\clearpage
\funyquote{% <==========================================================
\begin{flushright}
Ha! A limerick\\
The bane of my existence\\
Thank goodness I'm done
\end{flushright}
} % <===================================================================
\clearpage  % Funny Quote page ended, start a new page

Then you get the result:

corrected page limerik

Without that correction you get the wrong page number resulting in the issue you observed:

wrong page numbering

I did not investigate where this issue comes from (somewhere burried in the code of that class), but I suggest to use a standard class. Who knows which other errors will come up ...

  • Thank you for your thorough response. However, I feel that one of my main concerns was still not addressed. I don't care at all if the pdf viewer displays roman numerals or arabic characters. What I do care about is that front matter pages (starting with the acknowledgements) are labeled with roman numerals according to which page they are in the document (the 4th page in the viewer should be labeled as iv in the compiled pdf). It is helpful to know how to remove page numberings from select pages, but this other point is of much greater concern to me. – Mnifldz Mar 13 at 4:35
  • Never mind actually. I was too focused on the fact that there was a user-defined thesis class rather than focusing on the book class. My previous comment is actually answered quite well by this question. Thanks for your help! – Mnifldz Mar 13 at 4:47

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.