6

I know that \pagenumbering{gobble} makes the page numbering off. But when I use, for example \pagenumbering{arabic} again, page numbering starts over from 1. How to make it start from an offset?

2
  • \setcounter{page}{100} is what you want?
    – vaettchen
    Dec 23, 2017 at 5:34
  • Partha D's answer is the answer to the question in the title, but the text of your question appears to be asking a different question about changing the value of the counter rather than affecting a single page. Perhaps you could edit the question to clarify the actual problem? Dec 23, 2017 at 9:25

2 Answers 2

8

You have to look at what \pagenumbering actually does in order to understand why (from the LaTeX kernel):

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

Note how \pagenumbering{<scheme>} does two things:

  1. Globally (re)sets the page number counter \c@page to 1;
  2. Globally (re)defines \thepage to be a representation of the page counter according to <type>. Here <scheme> is defined as a macro \@<scheme>. So, \pagenumbering{gobble} results in \@gobble.

Now that you know it (re)sets the page number back to 1, you have a couple of options:

  1. Store the page number before setting it to gobble, and use that when you restore the numbering scheme.

    enter image description here

    \documentclass{article}
    
    \usepackage[paper=a5paper]{geometry}% Just for this example
    \usepackage{fancyhdr,lipsum}
    
    \newcounter{savepage}
    
    \begin{document}
    
    \sloppy% Just for this example
    \lipsum[1-20]
    
    \setcounter{savepage}{\value{page}}% Store page number on page 6
    \pagenumbering{gobble}% Remove page number
    \lipsum[1-2]
    
    \pagenumbering{arabic}% Restore page numbering
    \setcounter{page}{\numexpr\value{savepage}+2}% Restore original numbering + offset (should be page 8)
    \lipsum[3-20]
    
    \end{document}
    
  2. Just set the page number outright using \setcounter{page}{<number>} after restoring the numbering scheme (using \pagenumbering{arabic}, say). A similar technique is used as in (1) above.

  3. Use a page style to change the appearance of the page number (or remove it), leaving the counter untouched.

    enter image description here

    \documentclass{article}
    
    \usepackage[paper=a5paper]{geometry}% Just for this example
    \usepackage{fancyhdr,lipsum}
    
    \fancypagestyle{strangepage}{%
      \fancyhf{}% Remove header/footer
      \renewcommand{\headrulewidth}{0pt}% Remove header rule
      \renewcommand{\footrulewidth}{0pt}% Remove footer rule (default)
      \fancyhead[C]{non-default header}% Header
      \fancyfoot[C]{no page number}% Footer
    }
    
    % Set default fancy header
    \fancyhf{}% Clear header/footer
    \renewcommand{\headrulewidth}{0pt}% Remove header rule
    \renewcommand{\footrulewidth}{0pt}% Remove footer rule
    \fancyhead[C]{default header}% Header
    \fancyfoot[C]{\thepage}% Footer
    \pagestyle{fancy}% Set page style
    
    \begin{document}
    
    \sloppy% Just for this example
    \lipsum[1-20]
    
    \thispagestyle{strangepage}% Change page style *just* for this page
    \lipsum[1-20]
    
    \end{document}
    
4
  • There is a problem with your approach. It manipulated the page style and everything got bigger and so weird.
    – lonesome
    Dec 23, 2017 at 10:30
  • 1
    @lonesome: If you don't like the \thispagestyle approach, I did provide other options. Alternatively, can you provide details of what your concern is through a minimal example that replicates the problem?
    – Werner
    Dec 23, 2017 at 12:15
  • Well, What I want is to only remove numbering for a page and continue with the same numbering from next page. I used your first example and fonts got much bigger and not just for that page, but for every page.
    – lonesome
    Dec 23, 2017 at 12:34
  • @lonesome: It doesn't happen with my example, so I don't know what you might be doing differently.
    – Werner
    Dec 23, 2017 at 12:46
4

What about \thispagestyle{empty} ?

That should print no page number (supposed to be 73, say) on the page where this command is placed, and continue numbering next page (74) as usual.

You must log in to answer this question.

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