4

In my Latex document the page number is reset when I call the \maketitle function. My document class is \documentclass[a4paper, twoside, 14pt]{extreport}.

An example is illustrated here:

\documentclass[a4paper, twoside, 14pt]{extreport}
\title{Page resetting title}
\author{J Smith}

\begin{document}

\pagenumbering{arabic}
first page          
\newpage
second page
\newpage
third page  

    \maketitle     

\newpage
fifth page
\newpage
sixth page

\end{document}

I would like to prevent this, but I don't know where the page number will be eventually.

I could use \setcounter{page}{}, but I don't know how to pass a dynamic argument.

Could anybody please tell me how to either prevent \maketitle from resetting the counter, or restore the count dynamically myself?

6
  • the standard \maketitle in for example article class does not reset the page counter, so you need to give more information, preferably a complete small document that shows the problem. May 10, 2015 at 22:38
  • Sorry. I've added an example now. May 10, 2015 at 22:48
  • I have quickly skimmed through the code of the class you use (extreport), and indeed the titlepage environment resets the page counter to one. @DavidCarlisle: (!) The article class does the same (I repeat, in the titlepage environment, not in \maketitle).
    – GuM
    May 10, 2015 at 23:09
  • @GustavoMezzetti the difference is that article by default doesn't use titlepage. May 10, 2015 at 23:20
  • @DavidCarlisle: I hope you are not annoyed because of the “(!)”: a smiley was implied. You will understand, that, talking to D. Carlisle from the depths of my 208 reputation, I was almost ashamed of daring make such a remark…
    – GuM
    May 10, 2015 at 23:44

2 Answers 2

1

The easiest way is to use the notitlepage option

\documentclass[a4paper, twoside, 14pt,notitlepage]{extreport}
\title{Page resetting title}
\author{J Smith}

\begin{document}

\pagenumbering{arabic}
first page          
\newpage
second page
\newpage
third page  

    \maketitle     

\newpage
fifth page
\newpage
sixth page

\end{document}
4
  • Won't this have any (potentially unwanted) side-effects? May 10, 2015 at 23:32
  • No title page (of course!). The title is printed atop the fourth page (in your example), which nonetheless is empty because of the \newpage; though, the vertical alignment is quite different.
    – GuM
    May 10, 2015 at 23:57
  • @user2565010 the only affect of the notitlepage option is to define \maketitle so it doesn't throw a separate page and doesn't restart the page counter. May 11, 2015 at 0:00
  • Great. Thank you for the informative and clear answer. May 11, 2015 at 0:47
2

The only thing I can think of is to patch the definition of the titlepage environment:

\documentclass[a4paper, twoside, 14pt]{extreport}
\usepackage{etoolbox}

\makeatletter
\patchcmd{\titlepage}
    {\setcounter{page}\@ne}
    {}
    {}{}
% Also:
\patchcmd{\endtitlepage}
    {\if@twoside\else\setcounter{page}\@ne\fi}
    {}
    {}{}
\makeatother

\title{Page resetting title}
\author{J Smith}

\begin{document}

\pagenumbering{arabic}
first page          
\newpage
second page
\newpage
third page  

% \show\titlepage
% \show\endtitlepage
    \maketitle     

\newpage
fifth page
\newpage
sixth page

\end{document}

But it is much simpler to use \setcounter at the appropriate place, I guess…!

You must log in to answer this question.

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