Get rid of page number on 1st page of ToC in LaTeX!

LaTeX, or more generally TeX, is undoubtly the best typesetting tool available, and what’s more, it’s for free (for Windows users – check out MiKTeX!). Yet, there are few things that should work in a certain “obvious” way, yet they don’t (fortunately, there’s very few of them).

One of them is quite a surprising thing – pagestyle{empty} command does not affect first page of the table of contents. Yet, all the other pages of ToC it does! The same holds for list of figures and list of tables.
This is quite an annoyance, especially if you put ToC at the beginning of the document, and want to have all the pages, before the real contents starts, without the page numbering.

So, how to get rid of the page number on the first page of table of contents in LaTeX? You have to dig into the header and footer setting for this.

First thing is to use fancyhdr package – put usepackage{fancyhdr} command anywhere before the begin{document}.

Second, right before issuing the tableofcontents command, redefine the “plain page style” to an empty one, like this:

fancypagestyle{plain}
{
    fancyhead{}
    fancyfoot{}
}	% clear header and footer of plain page because of ToC

And after the ToC, just get back to the “classical” plain page style (this is important – even if you use your “fancy” page style, each page containing first page of chapter is “plain”, unless you redefine this behaviour), like this:

fancypagestyle{plain}
{
    fancyhead{}
    fancyfoot[C]{thepage}
}	% re-define plain page after the ToC

This block has to be “on a new page” – either after you issue newpage or cleardoublepage command, or after your first chapter{...} command.

19 responses to “Get rid of page number on 1st page of ToC in LaTeX!

  1. Nice!

    Thanks for the info, i’ve been cracking my head open on this one…
    it’s also possible to do clear the plain pagestyle within an encapsulating environment, so you don’t have to redefine it afterwards

    {
    \fancypagestyle{plain}
    {
    \fancyhead{}
    \fancyfoot{}
    } % clear header and footer of plain page because of ToC
    \tableofcontents
    }

  2. You’re welcome, I’m glad I could be of any help!

    Thanks for the snippet, I found it later also, yet I was lazy to update the post to include it…

    Cheers!

  3. This also worked for me:

    \renewcommand\thepage{}
    \tableofcontents
    \newpage
    \renewcommand\thepage{\arabic{page}}

    Cheers

  4. I’m not quite sure what exactly you mean; you can blank-out just parts of footer and header, like this:

    \fancyfoot[C]{} % clears central part of footer

    Cheers

  5. This did the trick for me (without needing fancyhdr)

    \renewcommand\thepage{}
    \tableofcontents
    \listoffigures
    \newpage
    \renewcommand\thepage{\arabic{page}}

  6. This also seems to work:
    put \addtocontents{toc}{\protect\thispagestyle{empty}}
    before the \tableofcontents command.

  7. Thank you so much for this tip. I ended up using the one that redefines \thepage because I got some slight weirdnesses when I used fancyhdr. This was the last formatting bug I had to fix and it was really annoying.

  8. I think the simplest way is to place \pagestyle{empty} in the header (this removes the page number for pages 2 and beyond) and place \thispagestyle{empty} anywhere in the BODY of the first page (that is, after some text has been written to the page).

  9. Dear all,
    I am writing my dissertation. I am have problems with producing the desirable pdf. The problems I am getting are:
    1. No bookmark for Title Page or ToC.
    2. List of Figures and List of Tables bookmarks point to Title Page.
    3. Bibliography and vita are bookmarked under Part III (Appendices).
    4. ToC lists a page number for each of the Parts’ pages.

    My main file is copied here. What I want to end up with is:
    1. Top level bookmarks with correct targets for:
    a. Title Page
    b. ToC
    c. List of Figures
    d. List of Tables
    e. Main matter components
    f. Bibliography
    g. Vita
    h. Appendices
    2. I want each of the Parts’ pages not to have a page number on the ToC.

    The use of “Part: Documentation” is only a workaround and not a solution. I do not like it, but I do not have a working alternative now.

    I tried using the appendices environment but kept receiving an error message about redefining a command that was not defined before. My guess is that the Appendix package is running into a conflict with another package. My problem is that I cannot figure out which one is the offensive package.

    Any help is greatly appreciated.

    Best regards,
    MRK
    %
    % This is file `iuthesis.tex’,
    % generated with the docstrip utility.
    %
    % The original source files were:
    %
    % iuthesis.dtx (with options: `docs’)
    % IUThesis Document Class (N. Danner)
    %
    % iuthesis: Document class for IU Thesis.
    % N. Danner (nxxxxx@indiana.edu)
    % Copyright 1999
    %
    % RCS Info:
    % iuthesis.dtx,v 1.2.0.23 1999/06/04 14:30:00 ndanger Exp
    %
    \def\fileversion{1.2.0.23}
    \def\filedate{1999/06/04}
    \errorcontextlines=999
    %\raggedbottom
    %\documentclass[letterpaper,14pt,fleqn]{report}
    \documentclass[12pt,reqno,final]{iuthesis}
    \renewcommand{\thepart}{\Roman{part}}
    \usepackage{listings} % identify the language with \lstset{language=FORTRAN}
    \usepackage{verbatim}
    \usepackage{fancyvrb}
    \usepackage{rotating}
    \usepackage[usenames]{color} % to include .jpg figures
    \usepackage{graphicx} % to include .jpg figures
    \usepackage{natbib}
    \usepackage[version=3]{mhchem}
    \usepackage{setspace}
    \usepackage{caption}
    \usepackage{lscape}
    \DeclareCaptionFont{singlespacing}{\singlespacing}
    %The following six lines make it possible for Figure number to go continuous over all chapters using the package: {remreset}.
    \usepackage{remreset}
    \makeatletter
    \@removefromreset{figure}{chapter}
    \makeatother
    \renewcommand{\thefigure}{\arabic{figure}}
    \makeatother
    \usepackage{morehelp}
    \usepackage[centertags]{amsmath}
    \usepackage[title,titletoc,header]{appendix}
    \usepackage{datetime}
    \usepackage{fancyhdr}
    \usepackage{ifpdf}
    %\ifpdf
    \usepackage[
    pdftex,
    pagebackref = true,
    breaklinks = true,
    colorlinks = true,
    linkcolor = red,
    anchorcolor = red,
    citecolor = blue,
    filecolor = red,
    urlcolor = red,
    pdfborder={0 0 0}
    bookmarks,
    %bookmarksopen,
    pdffitwindow,
    pdftitle = {My Dissertation},
    pdfauthor = {Me},
    ]{hyperref}
    \title{Geol. of the IL Basin}
    \author{}
    \advisor{} \secondreader{}
    \thirdreader{}
    \fourthreader{} \fifthreader{}

    \department{Geological Sciences}
    \submitdate{2 May 2011}
    \copyrightyear{~\copyright ~2011}

    \begin{document}
    %
    %
    \lstset{language=Fortran}
    % Dedication
    % \begin{dedication}
    % \textbf{Dedication}\\
    % \bigskip
    % \par
    % To my parents, wife, and daughters\\
    % \par
    % \ldots \par \ldots \par \ldots
    % \end{dedication}

    % Dedication
    \begin{dedication}
    To my parents, wife\\
    \par
    \ldots \par \ldots \par \ldots
    \end{dedication}

    % Acknowledgements
    \begin{acknowledgements}
    Thank God, advisor, committee members, IUB computing facilities, and Aramco\\
    \par
    \ldots \par \ldots \par \ldots
    \end{acknowledgements}

    % Abstract
    \begin{abstract}
    In this dissertation, I will discuss\\
    \par
    \ldots \par \ldots \par \ldots
    \end{abstract}

    \frontmatter

    % generate the Title
    \maketitle
    % generate the Signature page
    \signaturepage
    % generate the Copyright page
    \copyrightpage
    % generate the Dedication page
    \makededication[2in]
    % generate the Acknowledgement page
    \makeack
    % generate the Abstract page
    \makeabstract
    % insert the table of contents
    \tableofcontents
    %{\texorpdfstring{\tableofcontents}{Table of Contents}}
    % insert the list of figures
    \listoffigures
    % insert the list of tables
    \listoftables

    \mainmatter
    \part{Reaction-Transport}
    \include{chapter_01}
    \include{chapter_02}
    %\include{chapter_03}
    %\include{chapter_04}
    %
    %
    \part{Stratigraphic Modeling}
    \include{chapter_05}
    %

    \backmatter
    \include{vita}
    %
    %
    \part{Appendices}
    \appendix
    %\appendixpage
    %\addappheadtotoc
    %\appendixname
    %\noappendicestocpagenum
    %
    %\begin{appendices}
    \include{MeshGen_Code}
    \include{Rxn_Rate}
    \include{Chem_Transport}
    %\end{appendices}
    %
    %
    %\part{Documentation}
    {\setlength{\baselineskip}{0.75\baselineskip}
    \bibliographystyle{agufull}
    %\bibliography{mrk-thesis}\par}
    \bibliography{mrk-thesis-full}\par}
    \backmatter
    \include{vita}
    %

    \end{document}
    %
    % End of file `iuthesis.tex’.

  10. Thanks for the tips.

    \renewcommand\thepage{\arabic{page}}
    \setcounter{page}{1}

    They were live savers.

  11. Having no page numbers for the front matter is not common practice and would look very odd. No wonder it’s hard in LaTeX! Instead you should have Roman numbering for the pages of the front matter (i, ii, etc.) and arabic numbering restarting at 1 for the main matter. Because it’s the right thing to do, this is easy in LaTeX without any tricks; just Google something like “LaTeX front matter Roman page numbers” for instructions.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s