I am writing a document with multiple \mainmatter
s and \backmatter
s.
The structure is basically:
...
\mainmatter
\backmatter
...
\mainmatter
\backmatter
...
Is there a simple way of preventing LaTeX to reset the page counter?
Also \backmatter
should not reset the counter.
Best Answer
This depends highly on the document class you're using. Taking the standard
book
as base,\fontmatter
and\mainmatter
both reset the page counter.\backmatter
on the other hand doesn't:The important thing that causes the page numbering to be reset when issuing the above commands is
\pagenumbering
(taken fromlatex.ltx
):As mentioned, this sets the page counter to one (
\global\c@page \@ne
) and redefines the representation\thepage
(\gdef\thepage{\csname @#1\endcsname\c@page}
). So, with an issue of\pagenumbering{roman}
(as is performed by\frontmatter
), LaTeX issues something equivalent tomemoir
does something similar. If your question is only "How to prevent LaTeX from resetting the page counter?", then you should not use\frontmatter
and friends, or at least void what\pagenumbering
is doing. You might just be better off redefining the page counter printing mechanism\thepage
as is done above. Or, for convenience of use in order to stick to your current layout, perhaps the following suffices in your preamble (which removes the page counter resetting):Finally, neither
book
normemoir
resets the page counter for\backmatter
.