Document Formatting
How to Customize Headers and Footers in LaTeX
The fancyhdr package lets you create professional headers and footers with page numbers, titles, and more.
Basic Setup
Load fancyhdr and set style:
\usepackage{fancyhdr}
\pagestyle{fancy}
% Clear defaults:
\fancyhf{}
% Add content:
\fancyhead[L]{Left Header}
\fancyhead[C]{Center Header}
\fancyhead[R]{Right Header}
\fancyfoot[C]{\thepage} % Page number centerCommon Patterns
Typical academic headers:
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
% Chapter/section in header:
\fancyhead[L]{\leftmark} % Chapter name
\fancyhead[R]{\rightmark} % Section name
\fancyfoot[C]{\thepage}
% Author and title:
\fancyhead[L]{Smith et al.}
\fancyhead[R]{LaTeX Tutorial}
\fancyfoot[R]{Page \thepage}Different First Page
Remove header from first page:
% In document, after \maketitle:
\thispagestyle{plain} % Only page number
\thispagestyle{empty} % Nothing
% Or define for title pages:
\fancypagestyle{plain}{
\fancyhf{}
\fancyfoot[C]{\thepage}
}💡 Tips
- •L = left, C = center, R = right
- •\leftmark and \rightmark contain section/chapter titles
- •Add \renewcommand{\headrulewidth}{0pt} to remove the line
Try This in Bibby AI
Write LaTeX faster with AI auto-complete and instant compilation.
Start Writing Free