# Trick LaTeX into displaying different page numbers

Is it possible to 'trick' LaTeX into displaying different page numbers?

For a whole host of complicated reasons I would like to display

etc....

without changing the page counter. Is this needlessly tricky?

• Difficult to say without some more details; how should the pages before page 7 (to be displayed as 1) be numbered? – egreg Apr 14 '15 at 13:43
• Those numbers will be suppressed so wont be displayed. – Juggler Apr 14 '15 at 13:46
• Modifying \thepage is allowed, but not the counter? – user31729 Apr 14 '15 at 13:49
• If that's possible? – Juggler Apr 14 '15 at 13:50
• Maybe create a new counter page and use it in the page style? – Sigur Apr 14 '15 at 13:52

This version (modified from egreg) would work with hyperref

\documentclass{article}
\usepackage{hyperref}

\begin{document}

\pagenumbering{Roman}
\pagestyle{empty}

\clearpage
\pagenumbering{arabic}

This is page 1\newpage

This is page 2

\end{document}


The problem when using \pagenumbering{gobble} with hyperref is that you get warnings because several pages have the same identifier and the pdf-page numbering is broken. If you have no problem with the empty pages being numbered with roman numerals in the pdf-pagecount but not in the print area of the file, then this should work.

• This adds other problems if the page style shouldn't be empty. – egreg Apr 14 '15 at 14:10
• @egreg That is certainly true. It only solves the problem assuming that Juggler added all necessary information. – Manuel Weinkauf Apr 14 '15 at 14:14

If you don't need hyperref, the trick is very easy:

\documentclass{article}

\begin{document}

\pagenumbering{gobble}

\clearpage
\pagenumbering{arabic}

This is page 1\newpage

This is page 2

\end{document}

• I am using hyperref is that an issue? – Juggler Apr 14 '15 at 13:53
• @Juggler Yes, of course it is. Please, add details to your question. – egreg Apr 14 '15 at 13:58

Perhaps this works

\documentclass{article}

\def\pageoffset{6}  %(7 - 1 = 6)

\usepackage{etoolbox}
\usepackage{blindtext}
\usepackage{hyperref}
\let\origthepage\thepage
\renewcommand{\thepage}{%
\ifnumgreater{\value{page}}{1}{\number\numexpr\value{page}+\numexpr\pageoffset-1}{\origthepage}
}

\begin{document}
\pagestyle{empty}
\tableofcontents
\listoffigures
\listoftables
\clearpage

\pagestyle{plain}

\section{First}
\blindtext[30]
\section{Other}
\end{document}


I omitted a screenshot, it shows the feature (for a small document, untested for a larger one). hyperref works in here

Edit A better version, taking care of the current page value:

\documentclass{book}

\usepackage{etoolbox}
\usepackage{blindtext}
\usepackage{hyperref}

\def\pageoffset{6}%
\newcounter{pagereset}
\let\latexthepage\thepage

\newcommand{\SwitchPagenumbering}{%
\setcounter{pagereset}{\number\value{page}}%
\renewcommand{\thepage}{%
\ifnumgreater{\value{page}}{\value{pagereset}-1}{\number\numexpr\value{page}+\number\numexpr\pageoffset}{\latexthepage}%
}%
}

\begin{document}
\pagenumbering{Roman}
\tableofcontents
\listoffigures
\clearpage
\pagenumbering{arabic}

\SwitchPagenumbering

\chapter{First}
\section{First}

\blindtext[30]
\typeout{Pagereset is \thepagereset: Page is \number\value{page}}

\section{Other}
\blindtext[20]
\section{Other}
\section{Other}

\end{document}

• I have not much time right now to provide a better version, so be patient ... – user31729 Apr 14 '15 at 14:07
• I think, the page number before this resetting occurs, should be stored, to make the whole stuff more fail safe – user31729 Apr 14 '15 at 14:16