# Don't reset page numbering when a new part starts

I am just learning LaTeX, so this might be a very obvious question, but unfortunetely I haven't found any answer on this forum, or anywhere else.

I have a document (book) with multiple parts and chapters, but when a new part starts the page numbering goes back to 1. Is there an option to disable this automatic reset?

I am looking forward to your respons!

Kind regards

I think I found the problem! I created a few days ago a function to create new parts without the page numbering on the whitepage of the new part. So it turns the page numbering off creates the page and then turns it on again. But it probably turns it on back to 1.

Is there an easy way to store the page number before it is turned off? Or is there in general an easier way to do this?

\newcommand{\createpart}[2]
{
\pagenumbering{gobble}
\ifthenelse{\equal{#2}{with}}
{\part{#1}}
\pagenumbering{arabic}
}

• Which class are you using? book class does not reset page numbers after part. – Sigur Feb 12 '18 at 15:46
• Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – samcarter is at topanswers.xyz Feb 12 '18 at 15:48
• (1) welcome, (2) this is not normal behaviour so please post a full minimal example giving this kind of out put. – daleif Feb 12 '18 at 15:48
• \pagenumbering always resets the page number to 1 – user31729 Feb 12 '18 at 21:39

Don't fiddle with page numbers, just use \pagestyle{empty} (or \thispagestyle{empty}) for the \part page. This has worked for me:

\part[Title]{Title\thispagestyle{empty}}


which puts Title in the ToC and Title plus \thispagestyle{empty} in the document body. However, if you use the memoir class just put:

\aliaspagestyle{part}{empty}


in your preamble (without fiddling with each \part{...})

• Well, either me or you seem to have misunderstood the question -- isn't the question about preventing page number reset with every \part? If that is true, I don't see how the empty pagestyle comes in... Please correct me, if I am wrong -- I will delete this comment then – user31729 Feb 18 '18 at 9:15
• @ChristianHupfer I don't know of any class where \part resets the page numbering. The asker said that a new definition of \part was used to turn off page number printing on \part pages which resulted in page number resetting. I responded to what I thought was the underlying question of how to turn off the printing of the page number. If you think I'm right please upvote my answer. – Peter Wilson Feb 19 '18 at 19:55
• In some sense we're both right ;-) – user31729 Feb 19 '18 at 20:06
• @ChristianHupfer The question was not the clearest that I have seen. I have expanded my answer and thanks for the vote. – Peter Wilson Feb 19 '18 at 20:45

With the \newcounter command you can save a variable temporarily. So the code below saves the page nubmer temporarily and than sets the pagenumber back when the arabic pagenumbering is reinstated. :)

\newcommand{\createpart}[2]
{
\newcounter{tempPageNumber}
\setcounter{tempPageNumber}{\thepage}
\pagenumbering{gobble}
\ifthenelse{\equal{#2}{with}}
{\part{#1}}

• Also to second @daleif's comment: You can't use your \createpart macro twice or even more, since \newcounter is a macro that defines counters globally -- it will complain about tempPageNumber being defined already. Also, don't rely on \thepage printing pure numbers only, so \setcounter{tempPageNumber}{\thepage} may fail miserably – user31729 Feb 12 '18 at 19:48
• Each time you are using \pagnumbering the page counter is reset to one. Adding an auxiliary counter to store a value and revode it later is kind of pointless since resetting the pagecounter is unwanted and unneeded in the first place. – Johannes_B Feb 24 '18 at 11:13