[Tex/LaTex] Reversing the effect of \nopagenumbers in plain TeX

page-numberingplain-tex

I'm happy with Plain TeX's page-numbering format, except that I want to turn it off for the first few pages of my book. I can do this with the \nopagenumbers macro, but is there a macro with the opposite effect, to make the page numbers reappear later? Or do I have to manually re-establish the default footer?

Best Answer

A quick look at \nopagenumbers shows

> \nopagenumbers=macro:
->\footline {\hfil }.

while \showthe\footline yields

> \hss \tenrm \folio \hss .

Thus the simplest solution is by hand

\def\pagenumbers{\footline{\hss\tenrm\folio\hss}}

You could of course save the existing definition using something like

\newtoks\savedfootline
\savedfootline\expandafter{\the\footline}

and restore with

\footline\expandafter{\the\savedfootline}

or use a group within your document: \begingroup before \nopagenumbers and \endgroup after.

Note that whatever approach you use, make sure you force a new page, for example

\begingroup
  \nopagenumbers
  <content>
  \vfil
  \eject
\endgroup
Related Question