TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm writing something with the article class, and I'd like to have the table of contents pages numbered with roman numerals, and in addition and most importantly: to have the arabic numbers reset after the table of contents.

That's because I'm printing the document as I write, and the TOC will be ready only after the work is finish (and I don't want to change the page numbers). As it's a somewhat big article (~70 pages maybe) should I switch to a book class instead?

share|improve this question
It's not clear why the continuous page numbering should be a issue. If you need to refer to a precise page, there's the \pageref command. – egreg May 29 '12 at 14:54
@egreg Yeah, I should've said it in the question more clearly, anyways that's because the TOC will grow, and then all the page numbers would eventually be incremented and all my previously printed pages would contain the wrong numbers. – typk May 29 '12 at 15:00
Of course not! Compiling twice guarantees that the page numbers in the TOC are correct. – egreg May 29 '12 at 15:03
@egreg I know, but I'm not sure if I understand. Say that I have my TOC in page 1, and page 2 contains the article start. Then I write more 20 pages and print them. Ok, now when I write the next page, the TOC is big enough to take two pages. Then my article first page will be 3 instead of the old 2 (which is already printed) as well as the next 20 pages. – typk May 29 '12 at 15:10
LaTeX writes the .toc file during a compilation and at the next run it reads the "old" file. If the TOC grows one page, the page numbers will be incorrect after that run, but will be correct at the next. Just give it a try adding a number of mock sections. – egreg May 29 '12 at 15:13
up vote 12 down vote accepted

This would be automatic in book class


In other classes you could just borrow the definitions from book.cls


\newif\if@mainmatter \@mainmattertrue


as may be seen from the above definitions, essentially all you need if you don't want to define commands is \pagenumbering{roman} at the start and \pagenumbering{arabic} at the point that you want to switch.

share|improve this answer
Thanks Mr. Carlisle. I didn't realise that switching the page numbering style resets the count. Maybe each style uses a separate counter then. – typk May 29 '12 at 15:12
No it's the same counter, just \pagenumberimg is defined by \def\pagenumbering#1{% \global\c@page \@ne \gdef\thepage{\csname @#1\endcsname \c@page}} so it first resets the page counter to 1 then redefines \thepage to use the specified format roman or arabic or whatever. – David Carlisle May 29 '12 at 15:27

Your Answer


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.