[Tex/LaTex] How to prevent \pagenumbering from resetting page number


I want to page number the preliminary sections of my document in roman numerals, then use arabic for the rest, but I don't want the arabic numerals to start from 1. Since I don't know how long the table of contents and other preliminaries will be, I don't want to have to hard code the first page of the main section. Is there a way to prevent \pagenumbering from resetting, or to somehow direct \setcounter to "the page number of the last page + 1"?



%preliminary materials
This should be on page ``iii''.
Page ``iv''.
Page ``v''.

%main section
\setcounter{page}{6} % how can I set this without hard coding the 6?
Page ``6''.

Best Answer

You can define \pagenumberingnoreset:

\newcommand\pagenumberingnoreset[1]{\gdef\thepage{\csname @#1\endcsname\c@page}}

However, as I said in the comments, this is strongly against typographical principles, which is (one of) the reasons why it doesn't exist in LaTeX.

The definition above is based on the original definition of \pagenumbering:

  \global\c@page\@ne % this resets the counter
  \gdef\thepage{\csname @#1\endcsname\c@page}%