Page LayoutSuppress Page Number on first Page of ToC

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
cotanugo
Posts: 2
Joined: Wed Jul 03, 2013 12:59 pm

Suppress Page Number on first Page of ToC

Post by cotanugo »

Hello,

I use book or report document class, and I need no page number on the first page of the ToC, while keep page numbers (or column titles via \pagestyle{myheadings}), on the top of page, in the other pages of Contents.

For instance, if I simply declare global \pagestyle{empty}, I need to remove page number from the bottom of first page of ToC.

Code: Select all

\documentclass{book}
\pagestyle{empty}

\begin{document}
  The Title \newpage

  \thispagestyle{empty}   \tableofcontents

  \chapter{chapter1}\thispagestyle{empty}
  \chapter{chapter2}\thispagestyle{empty}
  \chapter{chapter3}\thispagestyle{empty}
  \chapter{chapter4}\thispagestyle{empty}
  \chapter{This is a chapter}\thispagestyle{empty}
  \chapter{This is a chapter}\thispagestyle{empty}
  \chapter{This is a chapter}\thispagestyle{empty}
  \chapter{This is a chapter}\thispagestyle{empty}
  \chapter{This is a chapter}\thispagestyle{empty}
  \chapter{This is a chapter}\thispagestyle{empty}
  \chapter{This is a chapter}\thispagestyle{empty}
  \chapter{This is a chapter}\thispagestyle{empty}
  \chapter{This is a chapter}\thispagestyle{empty}
  \chapter{This is a chapter}\thispagestyle{empty}
  \chapter{This is a chapter}\thispagestyle{empty}
  \chapter{This is a chapter}\thispagestyle{empty}
  \chapter{This is a chapter}\thispagestyle{empty}
  \chapter{This is a chapter}\thispagestyle{empty}
  \chapter{This is a chapter}\thispagestyle{empty}
  \chapter{This is a chapter}\thispagestyle{empty}
  \chapter{This is a chapter}\thispagestyle{empty}
  \chapter{This is a chapter}\thispagestyle{empty}
  \chapter{This is a chapter}\thispagestyle{empty}
  \chapter{This is a chapter}\thispagestyle{empty}
  \chapter{This is a chapter}\thispagestyle{empty}
  \chapter{This is a chapter}\thispagestyle{empty}
  \chapter{This is a chapter}\thispagestyle{empty}
\end{document}
As I understand, \thispagestyle{empty} before \tableofcontents does not affect on it due to \tableofcontents is taken from another file.

Could anybody give an advise?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Suppress Page Number on first Page of ToC

Post by localghost »

Seemingly you want to suppress page numbers in general on pages which start a chapter. Hence it is smarter to redefine the plain page style, which is automatically used on those pages. This can be done e.g. by the fancyhdr package as shown below.

Code: Select all

\documentclass[12pt,a4paper]{book}
\usepackage[T1]{fontenc}

\usepackage{geometry}
\geometry{
  headheight=15pt
}

\usepackage{fancyhdr}  % customized pages style
\fancypagestyle{plain}{%
  \fancyhf{} % clear all header and footer fields
  \renewcommand{\headrulewidth}{0pt}
  \renewcommand{\footrulewidth}{0pt}
}

\usepackage{lipsum}  % only for dummy text, not for use in actual document


\begin{document}
  \tableofcontents

  \chapter{Foo}
    \lipsum[1-3]  % only for dummy text, not for use in actual document

  \chapter{Bar}
    \lipsum[4-6]  % only for dummy text, not for use in actual document

  \chapter{Baz}
    \lipsum[7-9]  % only for dummy text, not for use in actual document
\end{document}
Remarks:
  • For a freely created title page you may want to take a look at the {titlepage} environment.

Best regards and welcome to the board
Thorsten
cotanugo
Posts: 2
Joined: Wed Jul 03, 2013 12:59 pm

Suppress Page Number on first Page of ToC

Post by cotanugo »

Thanks. I did not know that \tableofcontains works similar to chapter. Anyway, without fancyhdr package \thispagestyle{clear} works for common chapter head, and does not work for the first page of ToC.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Suppress Page Number on first Page of ToC

Post by localghost »

cotanugo wrote:[…] Anyway, without fancyhdr package \thispagestyle{clear} works for common chapter head, and does not work for the first page of ToC.
What is this page style clear and where does it come from? Or do you mean the empty page style? Is this a follow-up question?
Post Reply