3

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
  • 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? – Reinstate Monica - M. Schröder Feb 18 '12 at 17:42
3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy