# Roman Page Numbering for TOC in Article

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?

-
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

This would be automatic in book class

\frontmatter
\tableofcontents
\mainmatter
...


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

\makeatletter

\newif\if@mainmatter \@mainmattertrue

\newcommand\frontmatter{%
\cleardoublepage
\@mainmatterfalse
\pagenumbering{roman}}
\newcommand\mainmatter{%
\cleardoublepage
\@mainmattertrue
\pagenumbering{arabic}}
\makeatother


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.

-
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