[Tex/LaTex] Hyperref: possible page numbering conflict with \alph and \roman

hyperrefpage-numbering

I remember reading somewhere (can't seem to find the actual page now) that in order to avoid duplicate references with hyperref one should switch the page numbering to an "unused" one (say, \alph) for unnumbered pages (eg. the title pages, copyright pages, etc.).

Additionally, one usually uses roman numbers (say, \roman) for the front matter (eg. table of contents, list of figures/tables, introductions, etc.).

It just crossed my mind that, where one to have a longish front matter, this two numberings could clash and you would still get duplicate references. For example, suppose you have 10 unnumbered pages "numbered" a through j, and suppose you have 60 pages of front matter numbered i to dx: wouldn't the "d" in the unnumbered part clash with the "d" in the front matter? is there a way to avoid this?

Best Answer

Indeed, there can still be a clash of page numbers, although it is unlikely under normal circumstances. But it can be easily avoided: just modify the "invisible" page numbers to contain something that can never be part of a roman numeral. The following example introduces a new page numbering style myalph, which does nothing but prepend a z to the alph output:

\documentclass{article}

\makeatletter
\newcommand{\@myalph}{z\@alph}
\makeatother

\usepackage{hyperref}

\begin{document}

\pagenumbering{myalph}
\setcounter{page}{9}
test

\newpage
\pagenumbering{roman}
test

\end{document}