Dec 04

# Complete control of LaTeX Headers and Footers

Hey all,

LaTeX is a great way for producing beautifully written math in PDFs for printing and online use.  Here is the code to have complete control over your headers and footers in LaTeX:

First, use the fancyhdr package (before “\begin{document}”):

\usepackage{fancyhdr}

Second, set the headers and footers (before “\begin{document}”, after the above code):

\pagestyle{fancyplain}
\lfoot{\fancyplain{left foot, start chapter}{left foot, normal page}}
\cfoot{\fancyplain{center foot, start chapter}{center foot, normal page}}
\rfoot{\fancyplain{right foot, start chapter}{right foot, normal page}}

You can also use set the \headrulewidth and \footrulewidth

\renewcommand{\footrulewidth}{3pt}

The best way to see what these produce is to compile a sample document! Here is one to use:

\documentclass{book}

\usepackage{fancyhdr}

\pagestyle{fancyplain}%
\lfoot{\fancyplain{left foot, start chapter}{left foot, normal page}}
\cfoot{\fancyplain{center foot, start chapter}{center foot, normal page}}
\rfoot{\fancyplain{right foot, start chapter}{right foot, normal page}}

\renewcommand{\footrulewidth}{3pt}

\begin{document}

\chapter{FirstChapter}

Blah blah blah this is text blah blah blah \newpage

blah blah blah this is text on the second page. Nice thick line
above the footer, eh?
\newpage

blah blah blah this is text on the third page, and the chapter is

\chapter{SecondChapter}

blah blah blah this is text on the fifth page (the book
documentclass leaves a blank page to make sure the chapters start on
odd numbered pages).

\newpage

blah blah blah. Getting sick of the blah’s? Alright, I’m done.

\end{document}

Enjoy!