Generalno page number in table of contents

LaTeX specific issues not fitting into one of the other forums of this category.
beyma
Posts: 2
Joined: Tue Feb 26, 2008 5:53 pm

no page number in table of contents

Post by beyma »

Hi all,

I'm desperate with this issue... My document follows the hepthesis class.
I would like to eliminate the bottom page numbering in the first page of toc, lof and lot.
I've tried \thispagestyle{empty} without success !!

Code: Select all

\documentclass[bind,twoside,ams,booktabs,a4paper]{hepthesis}
\begin{document}

\begin{abstract}
\thispagestyle{empty}
This is the abstract.
\end{abstract}
\cleardoublepage

% first page of contents always has page number on bottom
\tableofcontents
\thispagestyle{empty}
\cleardoublepage

\begin{mainmatter}
\pagestyle{fancy}
\pagenumbering{arabic}
\input{chap1}
\input{chap2}
\end{mainmatter}

\listoffigures
\listoftables

\bibliographystyle{unsrt}
\bibliography{biblio}

\end{document}
Any ideas will be highly appreciated !!

Cheers,
Sergio
Last edited by Stefan Kottwitz on Thu Dec 08, 2011 11:54 am, edited 2 times in total.

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

no page number in table of contents

Post by localghost »

Refer to the documentation of the fancyhdr package and search for the redefinition oft the plain style (Section 7 - Redefining plain style, p. 7f).


Best regards
Thorsten¹
beyma
Posts: 2
Joined: Tue Feb 26, 2008 5:53 pm

Re: no page number in table of contents

Post by beyma »

Dear Thorsten,

many thanks for the precise hint ! It worked wonderfully.

Regards,
Sergio
stinkinrich88
Posts: 52
Joined: Sat Jun 07, 2008 11:56 am

Re: no page number in table of contents

Post by stinkinrich88 »

great, could you let us know how you did it?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

no page number in table of contents

Post by localghost »

stinkinrich88 wrote:great, could you let us know how you did it?
That is described in detail in the section of the documentation I mentioned above.


Best regards
Thorsten
stinkinrich88
Posts: 52
Joined: Sat Jun 07, 2008 11:56 am

Re: no page number in table of contents

Post by stinkinrich88 »

I meant it would've been really great if beyma had posted his / her solution to help other people and save people's time. Anyway, that document wasn't very specific about the problem---more of a general guide---so here's what I came up with:

\pagestyle{empty} %get rid of header/footer for toc page
\tableofcontents %put toc in
\cleardoublepage %start new page
\pagestyle{plain} % put headers/footers back on
\setcounter{page}{1} %reset the page counter
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

no page number in table of contents

Post by localghost »

stinkinrich88 wrote:[...] Anyway, that document wasn't very specific about the problem---more of a general guide---so here's what I came up with: [...]
The documentation is very specific about that. Right in the section I mentioned. And the more convenient way would be to follow the suggestions of the fancyhdr documentation.

Code: Select all

\fancypagestyle{plain}{%
  \fancyhf{}                          % clear all header and footer fields
  \renewcommand{\headrulewidth}{0pt}
  \renewcommand{\footrulewidth}{0pt}
}
In principal this is some kind of empty page style.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10319
Joined: Mon Mar 10, 2008 9:44 pm

no page number in table of contents

Post by Stefan Kottwitz »

Hi,

just some explanation about the behaviour of the code in the first posting: if the toc has more than one page, a following \thispagestyle cannot affect its first page, only the last. However \thispagestyle can be used in the toc like this:

Code: Select all

\addtocontents{toc}{\protect\thispagestyle{empty}}
This way you could do other things too, for example place a pagebreak in the toc, enlarge a toc page or even embed \addcontentsline with \addtocontents inside a list of tables and so on.

Further, if I don't want to use the plain pagestyle but empty instead, I just write

Code: Select all

\let\ps@plain\ps@empty
If you want to use that, don't forget \makeatletter ... \makeatother around the line.

Stefan
LaTeX.org admin
Dott_JJ
Posts: 4
Joined: Sat Dec 03, 2011 5:44 pm

Re: no page number in table of contents

Post by Dott_JJ »

Hi everybody,

what about deleting ALL the page numbers in TOC? I tried all of your suggestions but they are only useful for the first page. My TOC is at the moment 4 pages long...

Thank you guys

Giacomo
User avatar
Stefan Kottwitz
Site Admin
Posts: 10319
Joined: Mon Mar 10, 2008 9:44 pm

no page number in table of contents

Post by Stefan Kottwitz »

Hi Giacomo!

\contentsline produces the page numbers for the table of contents entries, it calles further macros \l@chapter, \l@section etc. It is called like this, in the .toc file:

\contentsline {section}{\numberline {1.1}section title}{page number}

So you could redefine it, doing nothing with that third argument. Just add to your preamble:

Code: Select all

\renewcommand*{\contentsline}[3]{\csname l@#1\endcsname{#2}{}}
Stefan
LaTeX.org admin
Post Reply