LaTeX forum ⇒ 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

Postby beyma » Tue Feb 26, 2008 6:07 pm

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 !!

  1. \documentclass[bind,twoside,ams,booktabs,a4paper]{hepthesis}
  2. \begin{document}
  3.  
  4. \begin{abstract}
  5. \thispagestyle{empty}
  6. This is the abstract.
  7. \end{abstract}
  8. \cleardoublepage
  9.  
  10. % first page of contents always has page number on bottom
  11. \tableofcontents
  12. \thispagestyle{empty}
  13. \cleardoublepage
  14.  
  15. \begin{mainmatter}
  16. \pagestyle{fancy}
  17. \pagenumbering{arabic}
  18. \input{chap1}
  19. \input{chap2}
  20. \end{mainmatter}
  21.  
  22. \listoffigures
  23. \listoftables
  24.  
  25. \bibliographystyle{unsrt}
  26. \bibliography{biblio}
  27.  
  28. \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.
Reason: code marked

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

Postby localghost » Tue Feb 26, 2008 6:44 pm

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¹
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

beyma
Posts: 2
Joined: Tue Feb 26, 2008 5:53 pm

Postby beyma » Tue Feb 26, 2008 6:56 pm

Dear Thorsten,

many thanks for the precise hint ! It worked wonderfully.

Regards,
Sergio

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

Postby stinkinrich88 » Sat Jun 07, 2008 11:57 am

great, could you let us know how you did it?

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

Postby localghost » Sat Jun 07, 2008 11:59 am

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
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

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

Postby stinkinrich88 » Sat Jun 07, 2008 12:21 pm

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: 9204
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Sat Jun 07, 2008 12:27 pm

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.
  1. \fancypagestyle{plain}{%
  2. \fancyhf{} % clear all header and footer fields
  3. \renewcommand{\headrulewidth}{0pt}
  4. \renewcommand{\footrulewidth}{0pt}
  5. }

In principal this is some kind of empty page style.
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

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

Postby Stefan Kottwitz » Sat Jun 07, 2008 4:12 pm

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:
  1. \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
  1. \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

Postby Dott_JJ » Sat Dec 03, 2011 6:45 pm

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: 9557
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Sun Dec 04, 2011 1:38 am

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:

  1. \renewcommand*{\contentsline}[3]{\csname l@#1\endcsname{#2}{}}


Stefan
LaTeX.org admin


Return to “General”

Who is online

Users browsing this forum: No registered users and 8 guests