Aller au contenu

Introduction and overview

This article demonstrates how to modify document headers and footers using the fancyhdr package. Another option for customizing headers and footers, addressed in the companion article, How does LaTeX typeset headers and footers?, is to dig deeper into LaTeX code to define new page styles or redefine appropriate low-level commands.

Here, we start with an overview of some basic LaTeX features which define default headers and footers used within a document:

If you wish to skip the introductory material, jump to the section on the fancyhdr package. As noted, much more technical detail is contained in the companion article How does LaTeX typeset headers and footers? which explores and explains the low-level, mark-based, mechanisms used by TeX engines to create headers and footers—and why the \mark command is needed.

LaTeX document classes

Different types of LaTeX document are created using document classes; for example, LaTeX provides a number of standard classes:

  • book
  • report
  • article
  • letter

which are used via the \documentclass command:

\documentclass[⟨options⟩]{⟨class⟩}

where:

  • ⟨class⟩ could be one of the standard types (book, report, article, letter) or one contributed by individuals and institutions.
  • ⟨options⟩ are settings used to configure a particular instance of the document ⟨class⟩. The available ⟨options⟩ depend on the ⟨class⟩ being used.

One- or two-sided documents

If a LaTeX document class supports different layouts for left-facing pages (even page numbers) and right-facing pages (odd page numbers) the document’s headers and footers are usually different on left- and right-facing pages. Defaults for the standard document classes are:

  • book: two-sided
  • article and report: single-sided but can become two-sided by using the option twoside; for example:
\documentclass[twoside]{article}

or

\documentclass[twoside]{report}

Default ⟨options⟩ of document classes

LaTeX applies a set of default ⟨options⟩ to each of the standard document classes:

  • article: default ⟨options⟩ are letterpaper,10pt,oneside,onecolumn,final
  • report: default ⟨options⟩ are letterpaper,10pt,oneside,onecolumn,final,openany
  • book: default ⟨options⟩ are letterpaper,10pt,twoside,onecolumn,final,openright
  • letter: default ⟨options⟩ are letterpaper,10pt,oneside,onecolumn,final

Document classes also provide commands which enable users to structure their documents into logical divisions such as parts, chapters, sections, subsections and so forth. As you might expect, the book class has a rich set of document structuring commands.

LaTeX page styles

In LaTeX, the default format of a document’s headers and footers are determined by the page style being used. Several predefined page styles are provided by LaTeX:

  • empty: no headers or footers on pages
  • plain: no page headers, footers consist of a centered page number
  • headings: no footers, headers contains class-specific information and page number
  • myheadings: no footers, headers contains page number and user-supplied information

Default page styles of standard document classes

Unless the user specifies otherwise, the standard document classes apply a default page style:

  • the article and report classes use plain
  • the book class uses headings

Setting page styles

Core LaTeX provides two commands to change (set) the page style:

  • \pagestyle{⟨style⟩}: sets the style of the current page, and all subsequent pages, to ⟨style⟩
  • \thispagestyle{⟨style⟩}: sets style of the current page only to ⟨style⟩

The style of page numbers is set with the command \pagenumbering{⟨numberstyle⟩}; for example, \pagenumbering{roman} typesets page numbers in lowercase Roman numerals: i, ii, iii...

LaTeX page layout

Because headers and footers form part of the overall page layout/design it can be helpful to understand a little more about LaTeX's model of page layout; the following Overleaf articles might be of interest:

Headers and footers in standard LaTeX document classes and page styles

As noted, LaTeX provides several built-in page styles used as defaults for the standard document classes. The following short examples demonstrate the default headers and footers produced by standard document classes using LaTeX's default ⟨options⟩ for each class.

Default article class headers and footers

\documentclass{article}
% Choose a conveniently small page size
\usepackage[paperheight=16cm,paperwidth=12cm,textwidth=10cm]{geometry}
\usepackage{lipsum}% for some dummy text
\title{An article class example}
\author{Overleaf}
\begin{document}
\maketitle

\section{In the beginning...}
\lipsum[2]

\section{Another section}
\lipsum[1]

\section{Yet another}
\lipsum[1]

 Open this article class example in Overleaf

Default report class headers and footers

\documentclass{report}
% Choose a conveniently small page size
\usepackage[paperheight=16cm,paperwidth=12cm,textwidth=10cm]{geometry}
\usepackage{lipsum}% for some dummy text
\title{A report class example}
\author{Overleaf}
\begin{document}
\maketitle
\chapter{One}
\section{In the beginning...}
\lipsum[2]

\section{Another section}
\lipsum[1]

\section{Yet another}
\lipsum[1]

 Open this report class example in Overleaf

Default book class headers and footers

\documentclass{book}
% Choose a conveniently small page size
\usepackage[paperheight=16cm,paperwidth=12cm,textwidth=10cm]{geometry}
\usepackage{lipsum}% for some dummy text
\title{Memoirs of a \TeX{} user}
\author{Overleaf}
\begin{document}

\frontmatter
\maketitle
This is frontmatter which uses Roman numerals.

\mainmatter
\chapter{Where do I start}
\lipsum[4]

\section{In the beginning...}
\lipsum[1]

\section{Yet another section}
\lipsum[1]

\chapter{Things I remember}

\section{Oh and a further section}
\lipsum[1]

 Open this book class example in Overleaf

Changing headers and footers for “non standard” LaTeX document classes

The packages/commands required to change headers and footers can vary according to the document class being used; for example, the TeX FAQ notes use of the scrlayer-scrpage package, rather than fancyhdr, for improved integration with the KOMA-script document classes. Additionally, the memoir document class contains its own features (user commands) to change headers and footers.

Using the fancyhdr package

To load the fancyhdr package add the following line to your document preamble:

\usepackage[⟨options⟩]{fancyhdr}

where ⟨options⟩ are explained in the package documentation.

Structure of fancyhdr headers and footers

The following diagram summarises the general structure of headers and footers defined by fancyhdr for a two-sided document:

  • headers and footers can contain different content on left (even) and right (odd) pages
  • headers and footers are structured into three “zones”
    • Left
    • Centre
    • Right
  • headers and footers can contain an optional rule (line)

In the L zone the content is typeset flush left; in the C zone it is centred and in the R zone it is typeset flush right.

Diagram showing the structure of fancyhdr headers and footers

Commands provided by fancyhdr use single-letter abbreviations, called “coordinates”, to identify specific header and footer zones and page locations:

  • O or E: to specify Odd or Even pages
  • H or F: to indicate Header or Footer
  • L, C or R: for the Left, Centre and Right “zone” of the header or footer

Introducing the commands

This section discusses several fancyhdr commands used to define the content of headers and footers:

  • \fancyhead[locations]{content}
  • \fancyfoot[locations]{content}
  • \fancyhf[locations]{content}

Each of these commands uses “coordinates” to define header and footer locations where the content should appear. Depending on which command you use, (up to) 2 or (up to) 3 coordinates may be required to fully specify the desired locations.

Commands using up to 2 coordinates

The following commands require up to 2 coordinates to specify particular locations in a header or footer:

  • \fancyhead[locations]{content}: assumes the Header coordinate
  • \fancyfoot[locations]{content}: assumes the Footer coordinate

where locations is an optional comma-separated list of positions, specified by 1 or 2 coordinates, in which to place content.

Double-sided document example

The following example is taken from the fancyhdr documentation:

\documentclass{book}
\usepackage[paperheight=16cm, paperwidth=12cm,% Set the height and width of the paper
includehead,
nomarginpar,% We don't want any margin paragraphs
textwidth=10cm,% Set \textwidth to 10cm
headheight=10mm,% Set \headheight to 10mm
]{geometry}
\usepackage{fancyhdr}
\begin{document}
% Set the page style to "fancy"...
\pagestyle{fancy}
%... then configure it.
\fancyhead{} % clear all header fields
\fancyhead[RO,LE]{\textbf{The performance of new graduates}}
\fancyfoot{} % clear all footer fields
\fancyfoot[LE,RO]{\thepage}
\fancyfoot[LO,CE]{From: K. Grant}
\fancyfoot[CO,RE]{To: Dean A. Smith}
% Some content:
This is page 1.\newpage
This is page 2.
\end{document}

 Open this fancyhdr example in Overleaf

The following graphic shows the output produced by this example:

Double-sided document example created with LaTeX fancyhdr package

Notes on the commands used
  • \fancyhead{}: clears the settings for the headers
  • \fancyfoot{}: clears the settings for the footers
  • \fancyhead[RO,LE]{\textbf{The performance of new graduates}}: uses the header locations RO (RightOdd) and LE (LeftEven) to place the content \textbf{The performance of new graduates}
  • \fancyfoot[LE,RO]{\thepage}: uses the footer locations LE (LeftEven) and RO (RightOdd) to place the page number output by \thepage
  • \fancyfoot[LO,CE]{From: K. Grant}: uses the footer locations LO (LeftOdd) and CE (CentreEven) to place the content From: K. Grant
  • \fancyfoot[CO,RE]{To: Dean A. Smith}: uses the footer locations CO (CentreOdd) and RE (RightEven) to place the content To: Dean A. Smith
One-sided and two-sided documents

The diagram above shows the structure of headers and footers for a two-sided document, such as the book class, or article/report classes loaded using the option twoside.

Single-sided document examples

For single-sided documents based on the article or report classes, all pages are, in effect, right-hand pages so the “coordinates” for Even pages do not apply. We also don’t need to specify the O coordinate and can use a single L, C or R value:

\documentclass{article}
\usepackage[paperheight=16cm, paperwidth=12cm,% Set the height and width of the paper
includehead,
nomarginpar,% We don't want any margin paragraphs
textwidth=10cm,% Set \textwidth to 10cm
headheight=10mm,% Set \headheight to 10mm
]{geometry}
\usepackage{fancyhdr}
\begin{document}
% Set the page style to "fancy"...
\pagestyle{fancy}
\title{Single-sided document}
\author{Overleaf}
\date{August 2022}
\fancyhf{} % clear existing header/footer entries
% We don't need to specify the O coordinate
\fancyhead[R]{Hello}
\fancyfoot[L]{\thepage}
\maketitle
\section{Introduction}
Some content.
\newpage
\section{Continued...}
\end{document}

 Open this fancyhdr example in Overleaf

The fancyhdr package issues a warning if you try to specify headers or footers using the E coordinate within single-sided documents:

\documentclass{article}
\usepackage[paperheight=16cm, paperwidth=12cm,% Set the height and width of the paper
includehead,
nomarginpar,% We don't want any margin paragraphs
textwidth=10cm,% Set \textwidth to 10cm
headheight=10mm,% Set \headheight to 10mm
]{geometry}
\usepackage{fancyhdr}
\begin{document}
% Set the page style to "fancy"...
\pagestyle{fancy}
\title{Warning without twoside}
\author{Overleaf}
\date{July 2022}
\fancyhead[E]{Hello}% This triggers a warning!
\fancyfoot[E]{\thepage}% This triggers a warning!
\maketitle
\section{Introduction}
Some content.
\newpage
\section{Continued...}
\end{document}

 Open this erroneous fancyhdr example in Overleaf

As can be seen in this annotated screengrab:

File:Fancyhdrwarning2.png

the example above produces the warnings:

Package fancyhdr Warning: \fancyhead's `E' option without twoside option is useless on input line 23.
Package fancyhdr Warning: \fancyfoot's `E' option without twoside option is useless on input line 24.
Using a single coordinate in a two-sided document: omitting E and O

If you use \fancyhead or \fancyfoot in a two-sided document but omit the E and O from a location and use only 1 coordinate, L, C or R, the content will be placed in that location on even and odd pages.

Example

The following example demonstrates omitting E and O from locations specified in \fancyhead and \fancyfoot. It also uses the following commands:

  • \pagestyle{fancy} to set the page style to one configured by fancyhdr
  • \fancyhead{}\fancyfoot{} are used to clear all headers and footers (see also \fancyhf{})
\begin{document}
% Set the page style to "fancy"...
\pagestyle{fancy}
%... then configure it.

% Clear all headers and footers (see also \fancyhf{})
\fancyhead{}\fancyfoot{}

% Set the Centre header location but do not specify O or E
\fancyhead[C]{In the centre of the header on all pages: \thepage}

% Set the Left footer location but do not specify O or E
\fancyfoot[L]{On the left of the footer on all pages: \thepage}

% Some content:
This is page 1.\newpage
This is page 2.

 Open this fancyhdr example in Overleaf

The following graphic is an annotated version of the output produced by this code:

Using a single fancyhdr coordinate in a two-sided LaTeX document

As can be seen from this graphic, the following code

\fancyhead[C]{In the centre of the header on all pages: \thepage}

sets the Centre header location but does not specify if it should appear on Odd or Even pages. The omission of O and E coordinates results in the Centre zone header content appearing on odd and even pages.

In addition, this code fragment

\fancyfoot[L]{On the left of the footer on all pages: \thepage}

sets the Left footer location but does not specify if it should appear on odd or even pages. The omission of O and E coordinates results in the Left zone content appearing in the left zone of the footer appearing on odd and even pages.

Using a single coordinate in a two-sided document: omitting L, C and R

If you omit L, C and R from a location in a two-sided document, and use only 1 coordinate, E or O, the content will be placed in all three zones on the even or odd page pages specified in the location.

Example

The following example sets the header and footer for odd and even pages but none of the locations in the \fancyhead and \fancyfoot commands specify the “zone”, L, C or R, in which the content should be placed. Note how the content is reproduced in all three zones.

\begin{document}
% Set the page style to "fancy"...
\pagestyle{fancy}
%... then configure it.

% Clear all headers and footers (see also \fancyhf{})
\fancyhead{}\fancyfoot{}

% Set the header and footer for Even
% pages but omit the zone (L, C or R)
\fancyhead[E]{Header: even page \thepage}
\fancyfoot[E]{Footer: even page \thepage}

% Set the header and footer for Odd
% pages but omit the zone (L, C or R)
\fancyhead[O]{Header: odd page \thepage}
\fancyfoot[O]{Footer: odd page \thepage}

% Some content:
This is page 1.\newpage
This is page 2.

 Open this fancyhdr example in Overleaf

The following graphic is an annotated version of the output produced by this code:

The following code sets the header and footer for Even pages but omits a zone coordinate (L, C or R):

\fancyhead[E]{Header: even page \thepage}
\fancyfoot[E]{Footer: even page \thepage}

This results in:

  • even-page headers contain Header: even page \thepage in all three header zones (L, C and R)
  • even-page footers contain Footer: even page \thepage in all three footer zones (L, C and R)

The following code sets the header and footer for Odd pages but also omits a zone coordinate (L, C or R):

\fancyhead[O]{Header: odd page \thepage}
\fancyfoot[O]{Footer: odd page \thepage}

This produces results similar to those for even pages:

  • odd-page headers contain Header: odd page \thepage in all three header zones (L, C and R)
  • odd-page footers contain Footer: odd page \thepage in all three footer zones (L, C and R)

\fancyhf: using up to 3 coordinates

\fancyhf is a more general command which can be used to combine specifications for headers and footers. To do this it supports the coordinates H (for Header) and F (for Footer). The general form of the command is

  • \fancyhf[locations]{content}

where locations is a optional comma-separated list of locations, specified by 2 or 3 coordinates, to place content.

Because this command can specify the content of headers and footers you need the third coordinate, H or F to fully specify the locations. For example, to use (refer to) the centre zone of footers on the left-hand (even) pages you would specify this as the three coordinates EFC:

  • Even-numbered pages
  • Footer
  • Centre zone

Note that the order of the coordinates is not important: EFC produces the same result as FEC and so forth.

The following example uses \fancyhf to place content in the Centre zones of all headers and footers:

\begin{document}
\pagestyle{fancy}
\fancyhf{}
\fancyhf[EHC]{Even+Header+Centre}
\fancyhf[EFC]{Even+Footer+Centre}
\fancyhf[OFC]{Odd+Footer+Centre}
\fancyhf[OHC]{Odd+Header+Centre}
\lipsum[1]\newpage\lipsum[1]

 Open this \fancyhf example in Overleaf

The following graphic is an annotated version of the output produced by the previous example:

An example using the fancyhdr \fancyhf command

Examples

Using basic rules (lines) in headers and footers

The following rule-related commands are provided by version 4.x of fancyhdr:

  • \headrulewidth: macro to define the thickness of a line under the header
  • \footrulewidth: macro to define the thickness of a line above the footer
  • \headruleskip: macro to define the distance between the line and the header text (only available since version 4.0)
  • \footruleskip: macro to define the distance between the line and the footer text
  • \headrule macro to completely redefine header rules (lines)
  • \footrule macro to completely redefine footer rules (lines)
  • \headwidth a length parameter that defines the total width of the headers and footers

NOTES:

  • the default value of \headrulewidth is 0.4pt and default value of \footrulewidth is 0pt so, by default, that rule is not shown in footers.
  • you must use \renewcommand to change the width value stored by \headrulewidth or \footrulewidth
  • similarly, use \renewcommand to change the space between header or footer text, set by \headruleskip or \footruleskip respectively

For example:

\renewcommand{\headrulewidth}{2pt}
\renewcommand{\footrulewidth}{4pt}
\renewcommand{\headruleskip}{10mm}
\renewcommand{\footruleskip}{10pt}
  • Note: It is because the following commands are macros
    • \headrulewidth
    • \footrulewidth
    • \headruleskip
    • \footruleskip

that you must use \renewcommand to change values stored by these commands. The following code will not work:

\setlength{\headrulewidth}{2pt}% does not work
\setlength{\headruleskip}{10mm}% also will not work

The next example changes rule widths and shows how to modify the distance between rules (lines) and header and footer text—using \headruleskip and \footruleskip:

\begin{document}
% Set the page style to "fancy"...
\pagestyle{fancy}
%... then configure it.
\renewcommand{\headruleskip}{10mm}
\renewcommand{\footruleskip}{10pt}
\renewcommand{\headrulewidth}{2pt}
\renewcommand{\footrulewidth}{4pt}
% Some content:
\chapter{Wrangling settings}
\section{Page 1}
This is page 1.
\newpage
\section{Page 2}
This is page 2.
\end{document}

 Open this fancyhdr example in Overleaf

Using fancy rules in headers

The following example is derived from one contained in the fancyhdr package documentation which uses the fourier-orns package.

\documentclass{book}
\usepackage[paperheight=16cm, paperwidth=12cm,% Set the height and width of the paper
includehead,
nomarginpar,% We don't want any margin paragraphs
textwidth=10cm,% Set \textwidth to 10cm
headheight=14pt,% Set \headheight to 14pt to accommodate our fancy rule!
]{geometry}
\usepackage{fourier-orns}
\usepackage{fancyhdr}
\renewcommand{\headrule}{%
\vspace{-8pt}\hrulefill
\raisebox{-2.1pt}{\quad\decofourleft\decotwo\decofourright\quad}\hrulefill}
\title{Decorative line}
\author{Overleaf}
\date{August 2022}
\begin{document}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE]{\nouppercase{\rightmark\hfill\leftmark}}
\fancyhead[RO]{\nouppercase{\leftmark\hfill\rightmark}}
\fancyfoot[LE,RO]{\hfill\thepage\hfill}
\chapter{Fancy rules!}
\section{Introduction}
This example is taken from the \texttt{fancyhdr} documentation.
\newpage
\section{See the header}
\newpage
\section{Yes, very neat!}
\end{document}

 Open this example in Overleaf

This example produces the following output:

An example of creating fancy rules in headers via the fourier-orns package

  • Notes on commands in this example
    • \headrule: a macro which defines how to draw the decorative line in the header. Here it is redefined to draw a line containing ornaments from the fourier-orns package.
    • \leftmark and \rightmark: these commands are used to obtain “mark data” inserted by LaTeX’s sectioning commands. For a more complete explanation of these commands we recommend the companion article How does LaTeX typeset headers and footers?
    • \nouppercase: a command provided by the fancyhdr package to prevent header or footer text being typeset in uppercase, which is the default style for LaTeX headers and footers

fancyhdr warning: \headheight is too small

If you receive the fancyhdr warning that \headheight is too small you can reset it to some value height by writing

\setlength{\headheight}{height}

but the recommended solution is to use the geometry package and apply its headheight=height option to set the value of \headheight to height.

The following example revisits our earlier book class example and resets \headheight to 2cm via headheight=2cm:

\documentclass{book}
\usepackage[paperheight=16cm, paperwidth=12cm,% Set the height and width of the paper
includehead,% See below for an explanation
nomarginpar,% We don't want any margin paragraphs
textwidth=10cm,% Set \textwidth to 10cm
headheight=2cm,% Set \headheight to 2cm
showframe % Show the page layout
]{geometry}
\title{Memoirs of a \TeX{} user}
\author{Overleaf}
\begin{document}

\frontmatter
\maketitle
This is frontmatter which uses Roman numerals.

\mainmatter
\chapter{Where do I start}
Chapter 1: A short chapter that ends on page 1.

\chapter{Things I remember}
Chapter 2: Starts on page 3, so \LaTeX{} inserts a ``blank'' page 2.
\end{document}

 Open in Overleaf: example to set \headheight using the geometry package

Notes on the geometry package

The example above uses several options of the geometry package:

  • nomarginpar: specifies that we don't want any margin paragraphs
  • textwidth=10cm: sets a value (10cm) for \textwidth, one of LaTeX’s page layout parameters
  • headheight=2cm: sets a value (2mm) for \headheight, one of LaTeX’s page layout parameters
  • showframe: draws the page layout

The geometry package also provides options which affect how it calculates certain values for LaTeX page layout parameters; for example:

  • includehead
  • includefoot

Our example (above) used includehead to ensure that the height of the text area is directly affected by changing the value of headheight. The following diagram, copied from the geometry package documentation, demonstrates how the includehead and includefoot options affect calculation of the document’s text height:

Image from geometry package documentation showing how the includehead and includefoot options affect calculation of the document’s text height

Note that the geometry package refers to the height of the text area via the option textheight whereas LaTeX uses the similarly-named \textheight page layout parameter.

Footers containing page X of N

Source: edited version of code posted on tex.stackexchange: https://tex.stackexchange.com/a/282840.

This example creates a footer which displays the current page number and the total number of pages. It uses the lastpage package together with a modified version of the plain page style implemented via the \fancypagestyle command provided by fancyhdr.

\documentclass[12pt]{article}
\usepackage[paperheight=16cm, paperwidth=12cm,% Set the height and width of the paper
includehead,% See below for an explanation
nomarginpar,% We don't want any margin paragraphs
textwidth=10cm,% Set \textwidth to 10cm
headheight=16pt % Set \headheight to 16pt to avoid fancyhr warnings
]{geometry}
\usepackage{lastpage}
\usepackage{fancyhdr}
\usepackage{lipsum} % just for mock text
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[C]{\thepage\ of \pageref{LastPage}}
\fancypagestyle{plain}{%
  \renewcommand{\headrulewidth}{0pt}%
  \fancyhf{}%
  \fancyfoot[C]{\thepage\ of \pageref{LastPage}}}
\begin{document}
\title{Another fancyhdr demo}
\author{\texttt{tex.stackexchange} \textit{et al}}
\maketitle

\lipsum
\end{document}

 Open this example in Overleaf

Creating completely blank pages: no headers or footers

As noted in the fancyhdr package documentation, if you create a document using

  • the book class without the openany option, or
  • the report class with the openright option

any part (\part{...}) and chapter (\chapter{...}) pages will start on odd-numbered (right-hand) pages.

Occasionally, LaTeX needs to insert a "blank" page to ensure the next chapter or part page starts on a right-hand page—but that "blank" page will still contain headers that many people consider to be unsightly.

Example of "blank" pages in a book class document

The following book class example creates 5 pages including 2 right-hand facing chapter pages.

\begin{document}

\frontmatter
\maketitle
This is frontmatter which uses Roman numerals.

\mainmatter
\chapter{Where do I start}
Chapter 1: A short chapter that ends on page 1.

\chapter{Things I remember}
Chapter 2: Starts on page 3, so \LaTeX{} inserts a ``blank'' page 2.

\end{document}

 Open this book class example in Overleaf


As shown in the following annotated graphic, chapter 2 starts on page 3 because LaTeX inserted page 2 which is nominally “blank” but contains an unsightly header.

Example of blank pages in a book class document

A variety of mechanisms—code and packages—can be used to ensure inserted pages, such as page 2 above, are completely blank. Here are some examples:

  • use the emptypage package by adding the following line to your document's preamble:
\usepackage{emptypage}
  • manually insert a blank page at the end of chapter 1 so that chapter 2 will naturally start on a right-hand page, removing the need for LaTeX to force a new page. The following code is suggested in the fancyhdr package documentation:
\clearpage
\begingroup
\pagestyle{empty}\cleardoublepage
\endgroup
  • similarly, you can create a new page at the end of chapter 1 and set its style to empty using \thispagestyle{empty}:
\newpage\thispagestyle{empty}

For more information on, and examples of, using truly blank pages, consult the TUG FAQ or search for questions tagged blank-page on TeX.stackechange.

Changing the style of a single page

Sometimes is convenient to change the style of a specific page; for example, removing the header and footer from the current chapter page:

\begin{document}
\maketitle
\chapter{Using different page styles}
\lipsum[1] % via \usepackage{lipsum}
\chapter{Sample Chapter}
\thispagestyle{empty} % remove headers/footers from the chapter page
\lipsum[1]
\clearpage
\section{New section}
\lipsum[1]
\end{document}

 Open this example in Overleaf

Multi-line headers or footers

Headers and footers produced by fancyhdr can contain multiple lines. The following example is based on the fancyhdr documentation but expanded to include a multiline header. This example uses the datetime2 package command \DTMnow to insert the date on which the draft document was typeset. The command \\ is used to terminate the first line of the header.

\documentclass{book}
\usepackage[paperheight=16cm, paperwidth=12cm,% Set the height and width of the paper
includehead,
nomarginpar,% We don't want any margin paragraphs
textwidth=10cm,% Set \textwidth to 10cm
headheight=25pt,% Set \headheight to 25pt to accommodate the multiline header
]{geometry}
\usepackage{fancyhdr}
\usepackage{datetime2}
\begin{document}
% Set the page style to "fancy"...
\pagestyle{fancy}
%... then configure it.
\fancyhead{} % clear all header fields
\fancyhead[RO,LE]{\textbf{DRAFT} (Typeset \DTMnow)\\\textbf{The performance of new graduates}}
\fancyfoot{} % clear all footer fields
\fancyfoot[LE,RO]{\thepage}
\fancyfoot[LO,CE]{From: K. Grant}
\fancyfoot[CO,RE]{To: Dean A. Smith}
% Some content:
This is page 1.\newpage
This is page 2.
\end{document}

 Open this fancyhdr example in Overleaf

The following graphic shows the output produced by this example:

An example of a multi-line header produced by fancyhdr

Overleaf guides

LaTeX Basics

Mathematics

Figures and tables

References and Citations

Languages

Document structure

Formatting

Fonts

Presentations

Commands

Field specific

Class files

Advanced TeX/LaTeX