Page X of Y when you need a more formal layout.
Quick answer: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-referencingCommon 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, iiifor 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 Yin 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.Changing Page Number Style
Setting Page Number
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
Custom Positioning with fancyhdr
Advanced Page Numbering
Different Styles for Different Sections
Page Ranges and Prefixes
Two-Sided Documents
Different Numbering for Odd/Even Pages
Blank Pages in Two-Sided Documents
Special Page Numbering Schemes
Chapter-Based Numbering
Section-Based Numbering
Total Page Count
Conditional Page Numbering
Hide Numbers on Specific Pages
Different Formats by Page Range
Multi-Volume Documents
Volume and Page Numbering
Customizing Number Appearance
Styling Page Numbers
Custom Number Commands
Troubleshooting Page Numbering
Common Issues and Solutions
Best Practices
Professional Examples
Quick Reference
Page Numbering Commands
| Command | Purpose | Example |
|---|---|---|
\pagenumbering{style} | Set numbering style | \pagenumbering{roman} |
\setcounter{page}{n} | Set page number | \setcounter{page}{1} |
\thepage | Current page number | Use in headers/footers |
\pageref{label} | Reference page number | \pageref{LastPage} |
Numbering Styles
| Style | Output | Typical Use |
|---|---|---|
arabic | 1, 2, 3, 4… | Main content |
roman | i, ii, iii, iv… | Front matter |
Roman | I, II, III, IV… | Volume numbers |
alph | a, b, c, d… | Appendix sections |
Alph | A, B, C, D… | Appendix chapters |
Position Codes (with fancyhdr)
| Code | Position | Code | Position |
|---|---|---|---|
L | Left | E | Even pages |
C | Center | O | Odd pages |
R | Right | LE | Left on even |
Next: Learn about Single-sided vs double-sided documents for layout considerations, or explore Headers and footers for complementary page design.
