[Tex/LaTex] Setting logical page number of first page to zero (displayed in viewer)

numberingpage-numbering

I'm not an expert in LateX and I encounter the following problem when writing a report for my internship:

I've the following structure of my document (MWE down below):

  1. titlepage (no number)
  2. table of contents (start roman numbering)
  3. first section (start arabic numbering)

The problem is that, when viewed with Adobe Reader, it shows "1" for the first page (titlepage) and then it shows "i,ii…" for the table of contents…
I just want the (logic) numbering to go like 0,i,ii,1,2,3…
In the PDF itself the numbering is correct.

I tried use the \setcounter{page}{0} command but I couldn't get it right.

I've spent hours on the Internet but couldn't find an answer, even in these (related) questions: How to change page numbers displayed in a pdf viewer? and Page number and logical pages

Here is my structure (it should be in the article-class):

\documentclass[12pt, a4paper]{article}

\usepackage{fullpage}
\usepackage{hyperref}

\begin{document}

\newpage
\thispagestyle{empty}
\input{FrontPage} %it's a titlepage-environment

\newpage
\pagenumbering{roman}
\tableofcontents

\newpage
\pagenumbering{arabic}
\input{Introduction} %just plain text
\end{document}

Thanks in advance!
Lennert

Best Answer

You need to place the \setcounter{page}{0} inside the titlepage environment since, depending on your setup, the default document class either sets the page counter to 0 or 1.


More specifically, the following is taken from article.cls:

\if@compatibility
\newenvironment{titlepage}
    {%
      \if@twocolumn
        \@restonecoltrue\onecolumn
      \else
        \@restonecolfalse\newpage
      \fi
      \thispagestyle{empty}%
      \setcounter{page}\z@
    }%
    {\if@restonecol\twocolumn \else \newpage \fi
    }
\else
\newenvironment{titlepage}
    {%
      \if@twocolumn
        \@restonecoltrue\onecolumn
      \else
        \@restonecolfalse\newpage
      \fi
      \thispagestyle{empty}%
      \setcounter{page}\@ne
    }%
    {\if@restonecol\twocolumn \else \newpage \fi
     \if@twoside\else
        \setcounter{page}\@ne
     \fi
    }
\fi

If you're under the compatibility condition, then the page counter is set to 0 (\z@), otherwise it's set to 1 (\@ne). Since the former is rarely used anymore, you have to reset page to 0 inside the titlepage environment.