# Inserting an external page before front matter using its own page counter

I have a manuscript (my PhD Thesis, in fact) that uses Roman numerals for showing page numbers in the front matter and Arabic numbers for the page numbers in the main content.

Now I want to add an external page at the beginning of the document using the \includepdf sentence from the pdfpages package. It is the external cover of the book, so it shouldn't be taken into account for page numbering.

Ideally, what should happen is that this cover page (and also maybe blank page after it) should be numbered with its own counter, neither Roman nor Arabic. More precisely, what I've seen in some PDF documents that include the cover is that those initial external pages are labelled as C1 and C2 (for cover, I imagine).

Notice that I do not want the page numbers to be printed in the externally added pages, but just assign them a different page numbering (that is, a different page counter), so that the rest of the pages keep their old page numbers.

So, my question is: How can be this done in LaTeX?

Here it is a MWE:

\documentclass[11pt]{book}

\usepackage{pdfpages}

\usepackage{hyperref} %[pdfpagelabels] is default

\begin{document}

\includepdf{pdffile.pdf}

\frontmatter
\pagenumbering{roman}

Some front matter here
\newpage
And more

\mainmatter
\pagenumbering{arabic}

\newpage
And even more

\end{document}


When viewing the resulting PDF document, the first two pages are numbered as 1 and 2 (both in the document and also in the PDF viewer), and then the front matter starts, numbered as 'i', 'ii', etc. Then, the main matter starts and pages are numbered as 1, 2, etc. again.

In fact, the package hyperref rises a warning because there are two pages labelled as '1', and two pages labelled as '2'.

So, how can I manage to have those first pages before the front matter numbered as 'C1', 'C2', etc. (at least in the PDF viewer)?

Well, I discovered it by myself.

The solution is customizing the numbering of pages by redefining the \thepage command, using

\renewcommand{\thepage}{C\arabic{page}}


Also, if we want to avoid page numbers to appear in that cover section, we can use

\thispagestyle{empty}


So the MWE that would work for me is this:

\documentclass[11pt]{book}

\usepackage{pdfpages}

\usepackage{hyperref} %[pdfpagelabels] is default

\begin{document}

% ///////////////////////////////////////
\thispagestyle{empty}
\renewcommand{\thepage}{C\arabic{page}}
% ///////////////////////////////////////
\includepdf{pdffile.pdf}\thispagestyle{empty}

\frontmatter
\pagenumbering{roman}

Some front matter here
\newpage
And more

\mainmatter
\pagenumbering{arabic}

\newpage
And even more

\end{document}


EDIT: I changed the initial \pagestyle{empty} for \thispagestyle{empty} in order to ensure that he rest of the document is not affected.

EDIT: I've just discovered a similar answer to a similar question here: Custom page numbering for appendix

• You don't have to give those pages a different appearance if they are never printed, and any \pagenumbering will reset the page counter to one (1). Please read more about it at How to use pagenumbering in the document? – Johannes_B Nov 13 '14 at 8:15
• by the way, frontmatter and mainmatter both set the pagenumbering to roman and arabic, respectively. ;-) – Johannes_B Nov 13 '14 at 8:19
• @Johannes_B, the point is that when you don't print but instead open the file with a PDF viewer, the program usually shows you the number of the page you are watching, and there is where I wanted 'C1' and 'C2' to appear. It is true that reseting the page counter when front matter starts was not a problem, as it is the normal behaviour. Thank you for the link! – Vicent Nov 13 '14 at 8:42
• @vincent I saw this addition a little later after posting. But since the link could be useful (also to others) i left it. :-) – Johannes_B Nov 13 '14 at 8:44
• @Johannes_B, yes I knew it was redundant. Nevertheless, I usually keep those sentences there in order to remind me of that (or just in case the behaviour of frontmatter or mainmatter changed in the future). – Vicent Nov 13 '14 at 8:44