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 two sections before the table of contents, for which I use the following code:

\clearpage
\thispagestyle{empty}
\section*{RandomTitle}

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

share|improve this question
4  
A Minimal working example please. –  Simurgh12 May 4 '12 at 5:16
    
Have you tried to remove the horizontal bar at the top by issuing the following: \renewcommand{\headrulewidth}{0pt} ? –  bennettr Jun 26 '12 at 0:28

1 Answer 1

up vote 55 down vote accepted

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

share|improve this answer
6  
This however can cause problem when hyperref is used. –  egreg May 4 '12 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 '12 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 '12 at 1:10
    
@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>... –  StrawberryFieldsForever Apr 26 '13 at 13:40
4  
@StrawberryFieldsForever Use \pagenumbering{Alph}, for instance, and \pagestyle{empty} for the duration. –  egreg Apr 26 '13 at 13:44

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.