Page LayoutRemove page number from first page of ToC

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
User avatar
hariharanb
Posts: 12
Joined: Mon Jun 28, 2010 10:48 am

Remove page number from first page of ToC

Post by hariharanb »

I have been experiencing a different problem.

This is my preamble

Code: Select all

\documentclass[12pt]{article}
\title{\textbf{Regression Testing}}
\author{\sc{Hariharan B}}
\usepackage{lastpage}
\usepackage{fancyhdr}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{graphicx}
\usepackage{booktabs}
\pagestyle{fancy}
\renewcommand\headheight{16pt}
\renewcommand\footrulewidth{0.4pt}
\rhead{\small\sc{Regression Testing}}
\lhead{}
\cfoot{\thepage\ of \pageref{LastPage}}

\begin{document}
\date{}
\maketitle
\begin{center}
\large \textbf{Term Paper, Software Testing}
\vspace{2mm}
\large \textbf{Fall 2010}
\end{center}
\thispagestyle{empty}
\pagebreak

\tableofcontents
\thispagestyle{empty}
\listoffigures
\thispagestyle{empty}
\end{document}
In my case, table of contents exceeds a page and goes to two pages. The command \thispagestyle{empty} fails in the first page and as a result I get to see 2 of 20 in the footer of first page of table of contents. How to remove this? Even after giving \thispagestyle{empty} below \tableofcontents, I am getting this problem..

Here is the link to the image
ToCpagenumber.jpg
ToCpagenumber.jpg (10.97 KiB) Viewed 3450 times
Kindly help
Masters in Technology, Software Engineering
International Institute of Information Technology - Bangalore, India

Recommended reading 2024:

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

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

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

Remove page number from first page of ToC

Post by localghost »

It requires the inclusion of a page style command into the ToC. You can do that by adding a line to your preamble.

Code: Select all

\AtBeginDocument{\addtocontents{toc}{\protect\thispagestyle{empty}}}
As soon as the problem is sosrted out, please act exactyl according to Section 3 of the Board Rules.


Thorsten
User avatar
hariharanb
Posts: 12
Joined: Mon Jun 28, 2010 10:48 am

Re: Remove page number from first page of ToC

Post by hariharanb »

Thank you, I'll try this and get back to you

Edit: Works perfectly, thanks :-)
Masters in Technology, Software Engineering
International Institute of Information Technology - Bangalore, India
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Remove page number from first page of ToC

Post by localghost »

Now that the problem is solved, please be so kind and mark the topic accordingly as written in the Board Rules (to be read before posting) and as you have already been directed. Please keep that in mind for the future so that further reminders will not be necessary.
Post Reply