Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have this issue with a LaTeX document: I want to have page numbers on every page of the Table of Content. In my case the ToC is displayed across two pages because of many chapters in the text, but the first page of the ToC does not show a page number (the second page does). I generate the ToC like this:

\newpage
\pagestyle{plain}
\setcounter{page}{5}
\tableofcontents
share|improve this question

migrated from stackoverflow.com Feb 18 '12 at 16:30

This question came from our site for professional and enthusiast programmers.

    
What happens if you remove \pagestyle{plain}? –  phimuemue Feb 18 '12 at 14:43
    
it's completely without page numbers. Probably because of \pagestyle{empty} on previous screens. –  Jiří Vlašimský Feb 18 '12 at 14:53
1  
@JiříVlašimský: What document class are you using (perhaps memoir? It is customary for the first page of the ToC to be set similarly to what a regular \chapter* should look like. And these have their first pages set to plain using \thispagestyle. However, subsequent page should follow whatever \pagestyle you set before it. –  Werner Feb 18 '12 at 16:12
1  
Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Feb 18 '12 at 16:33
    
Sorry, but your question is unclear. Do you want to set the page number of your toc? –  Martin Schröder Feb 18 '12 at 17:42
show 1 more comment

1 Answer

In your preamble, add

\makeatletter
\newenvironment{keeppage}{\let\thispagestyle=\@gobble}{}
\makeatother

And wrap the table of contents like so:

\begin{keeppage}
    \tableofcontents
\end{keeppage}

This also works for chapters, title pages, and such.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.