Skip to main content
Headers and footers control the information that appears at the top and bottom of each page. In LaTeX, the usual workflow is simple: keep page numbering separate, then use page styles or fancyhdr to place the page number, section title, date, or document title where you want it.
Quick answer:
example.tex
Use built-in page styles for simple cases and fancyhdr when you need custom header and footer content.Related topics: Page numbering | Multiple columns | Document classes

When To Use Page Numbering vs Headers and Footers

Use Page numbering when your main question is:
  • how to switch between roman and arabic numbers
  • how to restart numbering
  • how to hide numbers on selected pages
  • how to show Page X of Y
Use this page when your main question is:
  • how to put the page number in a specific place
  • how to show chapter or section titles in the header
  • how to create different header/footer styles for different pages
  • how to control header and footer rules with fancyhdr

Understanding Page Styles

Default Page Styles

LaTeX provides four built-in page styles:
basic-styles.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

The fancyhdr Package

The fancyhdr package provides complete control over headers and footers.

Basic Setup

fancyhdr-basic.tex

Position Specifiers

position-specifiers.tex

Advanced Header Customization

Dynamic Content

dynamic-headers.tex

Conditional Headers

conditional-headers.tex

Multi-line Headers

multiline-headers.tex

Graphics in Headers

graphics-headers.tex

Chapter and Section Information

Automatic Section Headers

section-headers.tex

Custom Section Marking

custom-marking.tex

Special Page Styles

Title Page Style

title-page-style.tex

Bibliography Style

bibliography-style.tex

Headers with Boxes and Borders

boxed-headers.tex

Troubleshooting Common Issues

Header Height Problems

header-height.tex

Page Break Issues

page-break-issues.tex

Best Practices

Header and footer guidelines:
  1. Keep it simple - Too much information clutters the page
  2. Be consistent - Use the same style throughout similar documents
  3. Consider your audience - Academic vs. business documents have different conventions
  4. Test thoroughly - Check headers on all page types (first, last, odd, even)
  5. Mind the margins - Ensure headers don’t overlap with main content
  6. Use semantic marking - Let LaTeX generate section names automatically when possible

Professional Formatting

professional-example.tex

Quick Reference

Essential fancyhdr Commands

Position Codes

Common Variables


Next: Learn about Page numbering for advanced numbering schemes, or explore Multiple columns for overall layout principles.