145

I have two sections before the table of contents.

\documentclass{article}
\usepackage{lipsum}
\begin{document}
\thispagestyle{empty}
\section*{First random title} \lipsum[1]
\section*{Second random title} \lipsum[2]
\clearpage
\tableofcontents
\section{First section} \lipsum[3]
\section{Second section} \lipsum[4]
\section{Last section} Wombat \lipsum[5]
\end{document}

The problem is, that LaTeX starts the page numbering on the first page and I don't want that. I want the page numbering to start after the table of contents. How can I do this?

2
  • 8
    A Minimal working example please.
    – Simurgh12
    May 4, 2012 at 5:16
  • Have you tried to remove the horizontal bar at the top by issuing the following: \renewcommand{\headrulewidth}{0pt} ?
    – bennettr
    Jun 26, 2012 at 0:28

1 Answer 1

150

\pagenumbering can be helpful in removing page numbers and resetting it, at the same time. The following minimal example, using the article document class, removes the page numbers until the ToC, and then starts it again at 1 (set using \arabic):

enter image description here

\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\begin{document}
\pagenumbering{gobble}% Remove page numbers (and reset to 1)
\clearpage
\thispagestyle{empty}
\section*{First random title} \lipsum[1]
\section*{Second random title} \lipsum[2]
\clearpage
\pagenumbering{arabic}% Arabic page numbers (and reset to 1)
\tableofcontents
\section{First section} \lipsum[3]
\section{Second section} \lipsum[4]
\section{Last section} \lipsum[5]
\end{document}

\pagenumbering{gobble} sets the "page number printing macro" to \@gobble, which eats its argument/contents. \pagenumbering{arabic} resets this to \arabic{page}.

The principle holds for other (standard) document classes as well.

12
  • 11
    This however can cause problem when hyperref is used.
    – egreg
    May 4, 2012 at 8:41
  • There is one problem left. Between the last section and the table of contents, I get one blank page with a horizontal bar at the top. The horizontal bar comes from fancyhdr. How can I clear also fancyhdr styles before the table of contents? See: i49.tinypic.com/23mvg3t.jpg
    – Chris
    May 5, 2012 at 14:53
  • @Chris: Use \renewcommand{\headrulewidth}{0pt} to remove the header rule, and \renewcommand{\headrulewidth}{.4pt} to re-insert it. If this doesn't solve your problem completely, please update your original post with a complete, minimal example.
    – Werner
    Jun 26, 2012 at 1:10
  • 3
    @egreg: So how can this be done if the hyperref package is used? I'm using that package and I'm getting the warning destination with the same identifier (name{page.}) has been already used, duplicate ignored<to be read again>... Apr 26, 2013 at 13:40
  • 8
    @StrawberryFieldsForever Use \pagenumbering{Alph}, for instance, and \pagestyle{empty} for the duration.
    – egreg
    Apr 26, 2013 at 13:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .