4

I want to add roman page numbering to all the pages up to the end of the table of contents, apart from the title page. So I did the following, which works, apart from the fact that the abstract does not have any page number.

\begin{document}
\pagenumbering{roman}
\maketitle

\include{abstract}

\tableofcontents

\newpage
\pagenumbering{arabic}

The abstract.tex file contains \begin{abstract} and \end{abstract}.

So I tried to follow the solution to the question here which seems to be asking the exact same question.

And in my abstract tex file I put:

\begin{abstract}
\thispagestyle{plain} 

My abstract...

\end{abstract}

This does add page 'i' to the Abstract page. However, the problem is that subsequent pages in the roman numbering part, such as the table of contents are also getting page 'i' again (that is before changing to arabic numbering).

So essentially I am getting:

Abstract - Page i, TOC - Page i

While I want

Abstract - Page i, TOC - Page ii

Why is the counter getting reset to 1 (before changing to arabic numbering) and not continuing from where it was in the abstract?

2
  • \pagenumbering{arabic} does always reset the page counter to 1
    – user31729
    Commented Jan 2, 2016 at 22:31
  • The resetting is happening before that. The table of contents is also getting 'i' which is before changing to arabic. Even when I tried adding an acknowledgements page after the abstract, it got 'i' instead of following the next roman page number. I can't understand why this is happening.
    – jbx
    Commented Jan 2, 2016 at 22:32

1 Answer 1

5

\pagenumbering - changes should be done after a \clearpage (unless it's the first change right after the start)

\pagenumbering always resets the page counter to 1, see the definition

\def\pagenumbering#1{%
  \global\c@page \@ne \gdef\thepage{\csname @#1\endcsname
   \c@page}}

\global\c@page \@ne is basically Plain TeX for \setcounter{page}{1}

Now the real culprit for report is that it sets titlepage option, i.e. abstract uses the titlepage environment internally, which is defined to reset the page number at the end. Some code from latex.ltx

\if@titlepage
  \newenvironment{abstract}{%
      \titlepage
       \null\vfil
      \@beginparpenalty\@lowpenalty
      \begin{center}%
        \bfseries \abstractname
        \@endparpenalty\@M
      \end{center}}%
     {\par\vfil\null\endtitlepage}
\else
  \newenvironment{abstract}{%
      \if@twocolumn
        \section*{\abstractname}%
      \else
        \small
        \begin{center}%
          {\bfseries \abstractname\vspace{-.5em}\vspace{\z@}}%
        \end{center}%
        \quotation
      \fi}
      {\if@twocolumn\else\endquotation\fi}
\fi

\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

Here the real code

The whole issue can be cured if titlepage is redefined to take care for the special needs of the O.P. by setting \@abstractmode to true and setting the pagestyle and stepping the page counter accordingly, but do no reset of the page counter at the end of the titlepage environment.

\documentclass{report}

\usepackage{etoolbox}
\makeatletter
\newif\if@abstractmode

\renewenvironment{titlepage}
{
  \if@twocolumn
  \@restonecoltrue\onecolumn
  \else
  \@restonecolfalse\newpage
  \fi
  \if@abstractmode
  \thispagestyle{plain}%
  \stepcounter{page}%
  \else
  \thispagestyle{empty}%
  \setcounter{page}\@ne%
  \fi
}%
{\if@restonecol\twocolumn \else \newpage \fi
  \if@twoside\else
  \if@abstractmode
  \else
  \setcounter{page}\@ne%
  \fi
  \fi
}

\AtBeginEnvironment{abstract}{%
  \@abstractmodetrue%
}


\makeatother



\usepackage{blindtext}
\title{Theory of Brontosaurs}
\author{Ann Elk}
\begin{document}
\pagenumbering{roman}
\maketitle
\clearpage
\begin{abstract}
\blindtext[2]
\end{abstract}
\tableofcontents
\cleardoublepage
\pagenumbering{arabic}

\section{First}
\blindtext[10]
\end{document}

enter image description here

enter image description here

10
  • Could you explain a bit what the blindtext package is and what the command does? thanks.
    – jbx
    Commented Jan 2, 2016 at 22:34
  • @jbx: \blindtext is a famous package that adds dummy text, just to fill up the content
    – user31729
    Commented Jan 2, 2016 at 22:35
  • @jbx It's basically a Lorem Ipsum. :)
    – Alenanno
    Commented Jan 2, 2016 at 22:37
  • Yes just realised that, after posting my comment :). How is your solution different to what I pasted in my question though? I am getting page number 'i' before changing to arabic, within the roman part. So Table Of Contents is getting page 'i'. It is before the arabic part, so ignore the arabic part, that is working fine. I want Abstract - (i), TOC (ii) ... etc. then Chapter 1 is Page 1 (which is working perfect). But I am getting Abstract - (i), TOC (i) <--- why?!
    – jbx
    Commented Jan 2, 2016 at 22:37
  • @jbx -- I misunderstood. I thought up to, not up to the end of ToC
    – user31729
    Commented Jan 2, 2016 at 22:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .