Skip to main content
LaTeX adds page numbers automatically, but you can change the numbering style, restart the counter, hide numbers on selected pages, or show Page X of Y when you need a more formal layout.
Quick answer:
example.tex
Use \pagenumbering{...} to change style and \setcounter{page}{...} to restart numbering.Most common jobs: switch front matter to roman numerals, restart page 1 for the main document, hide numbers on title pages, and show Page X of Y with fancyhdr and lastpage.Related topics: Headers and footers | Document classes | Cross-referencing

Common Page Numbering Tasks

Most page-numbering questions fall into one of these patterns:
  • Start with arabic page numbers like 1, 2, 3
  • Use roman numerals like i, ii, iii for front matter
  • Restart numbering after the title page or table of contents
  • Hide the page number on one page with \thispagestyle{empty}
  • Show Page X of Y in the footer
  • Move the number into a custom header or footer with fancyhdr

Basic Page Numbering

Default Numbering

LaTeX automatically numbers pages starting from 1. The page number appears in different locations depending on the document class and page style.
basic-numbering.tex
Ready to use this syntax? Continue in the browser editor when you want to adapt the example in a real project.Open LaTeX Cloud Studio

Changing Page Number Style

number-styles.tex

Setting Page Number

set-page-number.tex
Note: Place \setcounter{page}{1} after \newpage (or \clearpage). Placing it before \newpage changes the current page’s counter before shipout, which is why pages 2 and 3 in the preview above are numbered 1 and 2 instead of 6 and 1.

Page Number Positioning

If you only want to move the page number, keep the numbering logic simple here and move to Headers and footers when you need a custom header/footer layout.

Using Page Styles

page-styles.tex

Custom Positioning with fancyhdr

custom-positioning.tex

Advanced Page Numbering

Different Styles for Different Sections

different-styles.tex
Note: Issue \clearpage before \pagenumbering{Alph} so the style change does not affect the previous chapter page (without \clearpage, Chapter 2 is numbered A and Appendix A starts at B in the preview above). Also, \chapter applies \thispagestyle{plain} to chapter-opening pages.

Page Ranges and Prefixes

page-ranges.tex
Note: In book, add \cleardoublepage before \appendix and \renewcommand{\thepage}{...} so the preceding chapter ships out with its own numbering first (otherwise Chapter 1 picks up the appendix format before chapter is stepped, producing App–1 in the preview above). To restart each appendix chapter at page 1, also reset \setcounter{page}{1} after each chapter’s page break.

Two-Sided Documents

Different Numbering for Odd/Even Pages

two-sided-numbering.tex

Blank Pages in Two-Sided Documents

blank-pages.tex

Special Page Numbering Schemes

Chapter-Based Numbering

chapter-numbering.tex
Note: \counterwithin{page}{chapter} overwrites \thepage with \thechapter.\arabic{page} and resets page to 0 rather than 1 (producing 1.0, 2.0, 3.0 in the preview above). To start each chapter at page 1 (1-1, 2-1, …), place \renewcommand{\thepage}{\thechapter-\arabic{page}} without \counterwithin{page}{chapter} and reset page to 1 at each chapter (for example via \clearpage\setcounter{page}{1} or the chappg package).

Section-Based Numbering

section-numbering.tex
Note: \counterwithin{page}{section} resets page to 0 (not 1), and because \section does not start a new page in article, all three sections sit on one page numbered 3.0 in the preview above. If each section should begin at X.1, remove \counterwithin{page}{section} and start each section with \clearpage\setcounter{page}{1}.

Total Page Count

total-pages.tex

Conditional Page Numbering

Hide Numbers on Specific Pages

conditional-numbering.tex

Different Formats by Page Range

format-by-range.tex
Note: Consecutive \newpage commands with no content between them collapse into a single page break, so the preview above only reaches page 3 (keeping the "Introduction Section" header on all three pages). To create intentional blank pages for testing higher page numbers, place \null (or text) before each \newpage.

Multi-Volume Documents

Volume and Page Numbering

multi-volume.tex
Note: \frontmatter and \mainmatter call \pagenumbering{roman} and \pagenumbering{arabic}, which overwrite an earlier \renewcommand{\thepage} (leaving plain numbers 1, 2, 3 in the preview above). Redefine \thepage after \frontmatter and \mainmatter, and add \cleardoublepage before updating volume and resetting page.

Customizing Number Appearance

Styling Page Numbers

styling-numbers.tex

Custom Number Commands

custom-commands.tex

Troubleshooting Page Numbering

Common Issues and Solutions

troubleshooting.tex

Best Practices

Page numbering guidelines:
  1. Be consistent - Use the same style throughout similar sections
  2. Consider your audience - Academic papers often use different schemes than business documents
  3. Plan ahead - Design your numbering scheme before starting
  4. Test thoroughly - Check numbering across all document sections
  5. Use automation - Let LaTeX handle numbering rather than manual placement
  6. Follow conventions - Front matter typically uses roman numerals, main content uses arabic

Professional Examples

professional-example.tex

Quick Reference

Page Numbering Commands

Numbering Styles

Position Codes (with fancyhdr)


Next: Learn about Single-sided vs double-sided documents for layout considerations, or explore Headers and footers for complementary page design.