[Tex/LaTex] PDF page labels

page-numbering

Is it possible to set page labels in pdfs “correctly”? Pages in my latex documents are numbered 1-x. I'd like the page labels to correspond to the actual page numbers (as mentioned here: http://pdf.editme.com/pdfua-PageLabels).

So that the first page would be “Cover”, pages—let's say—2–5 (with toc and so on) numbered with Roman literals (i, ii, iii, etc.) and pages 6–end numbered with Arabic literals.
How do I achieve that?

Best Answer

Package hyperref also adds support for the PDF page labels. It uses \thepage for this purpose.

The cover page can be labeled using \thispdfpagelabel:

\documentclass{report}
\usepackage{hyperref}
\begin{document}
\begin{titlepage}
\hypersetup{pageanchor=false}
\thispdfpagelabel{Cover}
\Huge Cover
\end{titlepage}
\pagenumbering{roman}
\tableofcontents
\listoffigures
\listoftables
\pagenumbering{arabic}
\chapter{Abc}
\end{document}

The example also disables the page label for the cover page, because it is unlikely, that it is needed (e.g., page anchors are needed for index entries). Otherwise the page anchor for the cover page (1) would clash with the page anchor for the first chapter page (also 1).

If the cover pages do not print the page number, then \thepage can be redefined, e.g., with Cover- as prefix. With a unique \thepage the page anchor does not need to be disabled, example:

\documentclass{book}
\usepackage{hyperref}
\begin{document}
\begingroup
  \renewcommand*{\thepage}{Cover-\arabic{page}}
  \pagestyle{empty}
  \Huge Cover
  \cleardoublepage
\endgroup
\frontmatter
\tableofcontents
\listoffigures
\listoftables
\mainmatter
\chapter{Abc}
\end{document}