The fancyhdr package

Last edit

Summary: content

Changed:

< The {{{fancyhdr}}} package enables us to change the headers and footers.

to

> The {{{fancyhdr}}} package enables us to change the headers and footers. As usual, the [[http://www.ctan.org/get/macros/latex/contrib/fancyhdr/fancyhdr.pdf|documentation]] is the best source of information---but first, a small example:
> <LaTeX-source>
> \documentclass{article}
> \usepackage{fancyhdr}
> \lhead{Left header}
> \chead{Center header}
> \rhead{Right header}
> \lfoot{Left footer}
> \cfoot{Center footer}
> \rfoot{page number: \thepage}
> \renewcommand{\headrulewidth}{0pt}
> \renewcommand{\footrulewidth}{0.4pt}
> \pagestyle{fancy}
> \begin{document}
> An example of \texttt{fancyhdr} package usage.
> \end{document}
> </LaTeX-source>
> The example should be rather self-explanatory. Three things worth mentioning are: the {{{\thepage}}} command, which typesets the current page number; the {{{\pagestyle{fancy}}}}, which changes the page style to the newly defined one; and the strange-looking {{{\renewcommand...}}} stuff---we will not delve in any details here, but these commands set the width of the rule above the footer to the usual width and the header line to zero (so that it effectively disappears).


The fancyhdr package enables us to change the headers and footers. As usual, the documentation is the best source of information—but first, a small example:

\documentclass{article}

\usepackage{fancyhdr}

\lhead{Left header}
\chead{Center header}
\rhead{Right header}
\lfoot{Left footer}
\cfoot{Center footer}
\rfoot{page number: \thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0.4pt}

\pagestyle{fancy}

\begin{document}
An example of \texttt{fancyhdr} package usage.
\end{document}

The example should be rather self-explanatory. Three things worth mentioning are: the \thepage command, which typesets the current page number; the \pagestyle{fancy}, which changes the page style to the newly defined one; and the strange-looking \renewcommand... stuff—we will not delve in any details here, but these commands set the width of the rule above the footer to the usual width and the header line to zero (so that it effectively disappears).