texlive[49886] Master/texmf-dist: fancyhdr (31jan19)

commits+karl at tug.org commits+karl at tug.org
Thu Jan 31 23:39:45 CET 2019


Revision: 49886
          http://tug.org/svn/texlive?view=revision&revision=49886
Author:   karl
Date:     2019-01-31 23:39:45 +0100 (Thu, 31 Jan 2019)
Log Message:
-----------
fancyhdr (31jan19)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/fancyhdr/README
    trunk/Master/texmf-dist/doc/latex/fancyhdr/fancyhdr.pdf
    trunk/Master/texmf-dist/tex/latex/fancyhdr/extramarks.sty
    trunk/Master/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty
    trunk/Master/texmf-dist/tex/latex/fancyhdr/fancyheadings.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/source/latex/fancyhdr/
    trunk/Master/texmf-dist/source/latex/fancyhdr/fancyhdr.dtx
    trunk/Master/texmf-dist/source/latex/fancyhdr/fancyhdr.ins

Removed Paths:
-------------
    trunk/Master/texmf-dist/doc/latex/fancyhdr/fancyhdr.tex

Modified: trunk/Master/texmf-dist/doc/latex/fancyhdr/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fancyhdr/README	2019-01-31 19:27:00 UTC (rev 49885)
+++ trunk/Master/texmf-dist/doc/latex/fancyhdr/README	2019-01-31 22:39:45 UTC (rev 49886)
@@ -2,28 +2,28 @@
 
 The package provides extensive facilities, both for constructing headers and footers, and for controlling their use (for example, at times when LaTeX would automatically change the heading style in use).
 
-The package consists of the following files:
+The distribution package consists of the following files:
 
 README				 This file
+fancyhdr.dtx		 The complete source of the package and documentation
+fancyhdr.ins		 The installation file; run through TeX to generate *.sty
+fancyhdr.pdf  		 PDF of the documentation
+
+After processing (by tex) of fancyhdr.ins, the following package files will be generated:
+
 fancyhdr.sty		 the LaTeX package
-fancyhdr.tex		 extensive documentation file
-fancyhdr.pdf  		 PDF of the above
+extramarks.sty 		 a package for additional marks
 fancyheadings.sty	 this loads fancyhdr with a warning message
-extramarks.sty 		 a package for additional marks
 
 Fancyhdr is a replacement for the old LaTeX2 package fancyheadings. That
 one should not be used anymore. The package fancyheadings included here
 just loads fancyhdr with a warning message.
 
-The documentation (fancyhdr.tex/fancyhdr.pdf) describes both
+The documentation (fancyhdr.dtx/fancyhdr.pdf) describes both
 fancyhdr.sty and extramarks.sty.
 In order to latex the documentation you need to have a copy of
 boxedminipage.sty (CTAN:/macros/latex/contrib/boxedminipage) installed.
 
-There used to be a package fixmarks.sty, but that is obsolete. It fixed
-a problem in LaTeX, but that is now solved in the LaTeX2ε system itself.
-So it is no longer included.
-
 fancyhdr.sty version 3 and extramarks.sty version 2 are the packages as
 described in the second edition of The LaTeX Companion. But that
 documentation should also suffice for the newer versions.

Modified: trunk/Master/texmf-dist/doc/latex/fancyhdr/fancyhdr.pdf
===================================================================
(Binary files differ)

Deleted: trunk/Master/texmf-dist/doc/latex/fancyhdr/fancyhdr.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fancyhdr/fancyhdr.tex	2019-01-31 19:27:00 UTC (rev 49885)
+++ trunk/Master/texmf-dist/doc/latex/fancyhdr/fancyhdr.tex	2019-01-31 22:39:45 UTC (rev 49886)
@@ -1,1711 +0,0 @@
-\documentclass[a4paper]{article}
-\usepackage{multicol}
-\usepackage{float}
-\usepackage{makeidx}
-\usepackage{layout}
-\usepackage{array}
-\usepackage{a4wide}
-\usepackage{boxedminipage}
-\usepackage{fourier-orns}
-\makeindex
-\title{Page layout in \LaTeX}
-\author{Piet van Oostrum\thanks{A considerable part of this article was
-    written by  George
-    Gr\"atzer (University of Manitoba) in \emph{Notices Amer. Math. Soc.}
-    Thanks, George!}\\
-  Dept.\ of Computer Science\thanks{This was my employer at the time I developed this package. I am now retired.}\\
-  Utrecht University}
-\def\latex/{\protect\LaTeX{}}
-\def\tex/{\TeX}
-\def\ams/{\protect\pAmS}
-\def\pAmS{{\the\textfont2
-        A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}
-\def\amslatex/{\ams/-\latex/}
-\newcommand{\PSNFSS}{{\sf
-    PSNFSS}}
-\newcommand{\bs}{\symbol{'134}}
-\newcommand{\Cmd}[1]{\texttt{\def\{{\char`\{}\def\}{\char`\}}\bs#1}}
-\newcommand{\CmdIndex}[1]{\index{#1@\string\texttt{\bs#1}}}
-\newcommand{\TTindex}[1]{\index{#1@\string\texttt{#1}}}
-\newcommand{\PSindex}[1]{\index{page style!#1@\string\texttt{#1}}}
-%\floatstyle{ruled}
-\restylefloat{figure}
-\renewcommand{\topfraction}{0.9}
-\renewcommand{\bottomfraction}{0.9}
-\renewcommand{\textfraction}{0.05}
-\setlength{\parindent}{0pt}
-\setlength{\parskip}{1ex}
-\setlength{\emergencystretch}{4em}
-\addtolength{\textheight}{-0.5in} % make it print better on US letter paper
-\makeatletter
-\renewcommand\l at section      {\@dottedtocline{1}{1.5em}{2.3em}}
-\makeatother
-\newenvironment{block}{\vspace{8pt}\begin{minipage}{\textwidth}}{\end{minipage}\vspace{8pt}}
-\newenvironment{fblock}{\vspace{8pt}\begin{boxedminipage}{\textwidth}}{\end{boxedminipage}\vspace{8pt}}
-\begin{document}
-\maketitle
-\begin{abstract}
-  This article describes how to customize the page layout of your LaTeX
-  documents, i.e how to change page margings and sizes, 
-  headers and footers, and the
-  proper placement of figures and tables (collectively called floats) on
-  the page. 
-
-  Originally this was the documentation of the  \textsf{fancyheadings}
-  package. It did contain also other info, e.g. advanced use of marks.
-  It has now been upgraded to include more, e.g. the handling of floats.
-  The documentation describes version 3.6 or later of the \textsf{fancyhdr} package 
-  and version 2.1 or later of the \textsf{extramarks} package.
-
-\end{abstract}
-\tableofcontents
-
-
-\section{Introduction}
-\label{sec:intro}
-
-A page in a \LaTeX{} document is built from various elements as shown in
-figure \ref{fig:layout}. 
-\begin{figure}[htbp]
-  \begin{center}
-    \leavevmode
-    \layout
-    \vspace{3cm}
-    \caption{Page elements. The values shown are those in effect in the current document, not the defaults.}
-    \label{fig:layout}
-  \end{center}
-\end{figure}
-%\thispagestyle{fancy}
-\thispagestyle{plain}
-The body contains the main text of the document
-together with the so called floats (tables and figures). 
-
-The pages are constructed by \LaTeX's output routine, which is quite
-complicated and should therefore not be modified. Some of the packages
-described in this paper contains small modifications to the output routine
-to accomplish things that cannot be done in another way. You should use
-these packages to get the desired result rather than fiddling with the
-output routine yourself.
-
-There are a number of things that you must be aware of:
-\begin{enumerate}
-\item The margins on the left are not called \Cmd{leftmargin}, but
-  \Cmd{evensidemargin} (on even-numbered pages) and \Cmd{oddsidemargin}
-  (on odd-numbered pages). In one-sided documents 
-  \Cmd{oddsidemargin} is used for either.  \Cmd{leftmargin} is also a valid
-  \latex/ parameter but it has a different use (namely the indentation of
-  lists). 
-\item Most of the parameters should not be changed in the middle of a
-  document. Some changes might work at a pagebreak. If you want to change
-  the height of a single page, you can use the \Cmd{enlargethispage}
-  command. 
-\end{enumerate}
-
-The margin notes
-area contains small pieces of information created by the \Cmd{marginpar}
-command. On twosided documents the margin notes appear on the left and right
-alternatively. The margin notes are not on fixed places with respect to the
-paper but at approximately the same height as the paragraph in which they
-appear. Due to the algorithm used to decide the placement of margin notes,
-in a twosided document unfortunately 
-they may appear on the wrong side if they are close
-to a page break.
-If you want to put information on fixed places in the margins you may use
-the technique described in sections \ref{sec:movie} and \ref{sec:thumb}.
-
-The first part of this paper describes how to change the header and footer
-areas. The last part describes how to get your floats at the desired place.
-
-\section{Page headers and footers}
-
-The page headers and footers in \LaTeX{} are defined by the
-\Cmd{pagestyle} and \Cmd{pagenumbering} commands. \Cmd{pagestyle}
-defines the general contents of the headers and footers (e.g. where the
-page number will be printed), while
-\Cmd{pagenumbering} defines the format of the page number.
-\LaTeX{} has four standard pagestyles:
-
-\begin{tabular}{>{\tt}lp{10cm}}
-empty & no headers or footers \\
-plain & no header, footer contains page number centered \\
-headings & no footer, header contains name of chapter/section and/or
-subsection and page number \\
-myheadings & no footer, header contains page number and user supplied information
-\end{tabular}
-
-Although these are useful styles, they are quite limited. Additional page
-styles can be defined by defining commands of the form \Cmd{ps at xxx}. This
-command is executed when a \Cmd{pagestyle\{xxx\}} is given in the document.
-The  \Cmd{ps at xxx} command should define the following 
-commands for the contents of the headers and footers:
-
-\noindent
-\begin{tabular}{lp{10cm}}
-\Cmd{@oddhead} & header on odd numbered pages in two-sided documents
-(on all pages in one-sided) \\
-\Cmd{@evenhead} & header on even numbered pages in two-sided documents \\
-\Cmd{@oddfoot} & footer on odd numbered pages in two-sided documents
-(on all pages in one-sided) \\
-\Cmd{@evenfoot} & footer on even numbered pages in two-sided documents \\
-\end{tabular}
-
-These are not user commands, but rather ``variables'' that are used by
-\latex/'s output routine.
-As the command names contain the character '\texttt{@}', they should
-be defined in a package file, or otherwise be sandwiched between the commands
-\Cmd{makeatletter} and \Cmd{makeatother}.
-
-The \Cmd{pagenumbering} command defines the layout of the page number. It
-has a parameter from the following list:
-
-\begin{tabular}{>{\tt}ll}
-arabic & arabic numerals \\
-roman & lower case roman numerals \\
-Roman & upper case roman numerals \\
-alph & lower case letter \\
-Alph & upper case letter
-\end{tabular}
-
-The  \Cmd{pagenumbering\{xxx\}} defines the command \Cmd{thepage} to be the
-expansion of the page number in the given notation \texttt{xxx}. 
-The pagestyle command
-then would include \Cmd{thepage} in the appropriate place. Additionally
-the  \Cmd{pagenumbering} command resets the page number to~1.
-The  \Cmd{pagestyle} and  \Cmd{pagenumbering} apply to the page that is
-being constructed, so they should be used at a location where it is clear
-to what page they apply (see section \ref{sec:change}).
-
-
-\section{What is \textsf{fancyhdr}}
-
-The \textsf{fancyhdr} macro package allows you to customize
-in \latex/ your page headers and footers in an easy way.  You can
-define:
-\begin{itemize}
-\item three-part headers and footers
-\item decorative lines in headers and footers
-\item headers and footers wider than the width of the text
-\item multi-line headers and footers
-\item separate headers and footers for even and odd pages
-\item different headers and footers for chapter pages
-\item different headers and footer on pages with floats
-\end{itemize}
-
-Of course, you also have complete control over fonts, uppercase
-and lowercase displays, etc.
-
-\section{Simple use of \textsf{fancyhdr}}  To use this package in a
-\LaTeXe\ document, place the file \verb|fancyhdr.sty| in a
-directory/folder where \tex/ can find it (normally in the input
-directory/folder), and include in the preamble of your document
-after
-
-\begin{verbatim}
-\documentclass{...}
-\end{verbatim}
-the commands: 
-
-\PSindex{fancy}
-\begin{verbatim}
-\usepackage{fancyhdr}
-\pagestyle{fancy}
-\end{verbatim}
-
-We can visualize the page layout we can create with \textsf{fancyhdr}
-as follows:
-
-\begin{fblock}
-\noindent\makebox[\textwidth]{LeftHeader\hfill
-CenteredHeader\hfill RightHeader}
-\noindent\makebox[\textwidth]{\hrulefill}\\[\baselineskip]
-\noindent\makebox[\textwidth]{\hfill page body\hfill}\\[\baselineskip]
-\noindent\makebox[\textwidth]{\hrulefill}
-\noindent\makebox[\textwidth]{LeftFooter\hfill
-CenteredFooter\hfill RightFooter}
-\end{fblock}
-
-The LeftHeader and LeftFooter are left justified; the
-CenteredHeader and CenteredFooter are centered; the
-RightHeader and RightFooter are right justified.
-
-We define each of the six ``fields'' and the two decorative lines
-separately.
-
-\section{A simple example}  K. Grant is writing a report to Dean
-A. Smith, on ``The performance of new graduates'' with the
-following page layout:
-
-\begin{fblock}
-\noindent\makebox[\textwidth]{\hfill\textbf{The performance of new
-graduates}}
-\noindent\makebox[\textwidth]{\hrulefill}\\[\baselineskip]
-\noindent\makebox[\textwidth]{\hfill page body\hfill}\\[\baselineskip]
-\noindent\makebox[\textwidth]{\hrulefill}
-\noindent\makebox[\textwidth]{From: K. Grant\phantom{3}\hfill
-To: Dean A. Smith\hfill \phantom{From: K. Grant}3}
-\end{fblock}
-
-\noindent where ``3'' is the page number.  The title: ``The
-performance of new graduates'' is bold.
-
-This is accomplished by these commands following \Cmd{pagestyle\{fancy\}}
-\footnote{Note that version 1 of fancyheadings used the
-\Cmd{setlength} command to change the \texttt{\bs...rulewidth} parameters.}:
-\CmdIndex{lhead}
-\CmdIndex{rhead}
-\CmdIndex{chead}
-\CmdIndex{lfoot}
-\CmdIndex{rfoot}
-\CmdIndex{cfoot}
-\CmdIndex{headrulewidth}
-\CmdIndex{footrulewidth}
-\begin{verbatim}
-\lhead{}
-\chead{}
-\rhead{\textbf{The performance of new graduates}}
-\lfoot{From: K. Grant}
-\cfoot{To: Dean A. Smith}
-\rfoot{\thepage}
-\renewcommand{\headrulewidth}{0.4pt}
-\renewcommand{\footrulewidth}{0.4pt}
-\end{verbatim}
-(The \Cmd{thepage} macro displays the current page number.
-\Cmd{textbf} puts it in bold face.)
-
-This is now fine, except that the first page does not need
-all these headers and footers.  To eliminate all but the
-centered page number, issue the command
-
-\CmdIndex{thispagestyle}
-\begin{verbatim}
-\thispagestyle{plain}
-\end{verbatim}
-after the
-\Cmd{begin\{document\}}
-and the
-\CmdIndex{maketitle}
-\Cmd{maketitle}
-commands.
-
-Alternatively, issue
-\begin{verbatim}
-\thispagestyle{empty}
-\end{verbatim}
-if you do not want any headers or footers.
-
-In fact the standard \latex/ classes have the command \Cmd{maketitle}
-defined in such a way that a \Cmd{thispagestyle\{plain\}} is automatically
-issued. So if you \emph{do} want the fancy layout on a page containing
-\Cmd{maketitle} you must issue a \Cmd{thispagestyle\{fancy\}} after the
-\Cmd{maketitle}.
-
-\section{An example of two-sided printing}\label{two-sided}
-
-\TTindex{twoside}
-Some document classes, such as \verb|book.cls|, print two-sided by default: the even
-pages and the odd pages have different layouts; other document classes
-use the \verb|twoside| option to print two-sided.
-
-Now let us print the report two-sided.  Let the above page
-layout be used for the odd (right-side) pages, and the
-following for the even (left-side) pages:
-
-\begin{fblock}
-
-\noindent\makebox[\textwidth]{\textbf{The performance of new
-graduates}\hfill}
-\noindent\makebox[\textwidth]{\hrulefill}\\[\baselineskip]
-\noindent\makebox[\textwidth]{\hfill page body\hfill}\\[\baselineskip]
-\noindent\makebox[\textwidth]{\hrulefill}
-\noindent\makebox[\textwidth]{4\phantom{To: Dean A. Smith}\hfill
- From: K. Grant\hfill \phantom{4}To: Dean A. Smith}
-
-\end{fblock}
-\noindent where ``4'' is the page number.
-
-Here are the commands:
-
-\begin{verbatim}
-\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}
-\renewcommand{\headrulewidth}{0.4pt}
-\renewcommand{\footrulewidth}{0.4pt}
-\end{verbatim}
-
-\CmdIndex{fancyhead}
-\CmdIndex{fancyfoot}
-We use the more general commands \Cmd{fancyhead} and \Cmd{fancyfoot}.
-These have an additional parameter between square brackets that specifies
-for which pages and/or parts of the header/footer they apply. The first
-\Cmd{fancyhead} command omits this parameter, and thus applies to all
-header fields. In general this is only useful to get rid of the defaults or
-a previous definition, as is done here. Similar the \Cmd{fancyfoot} command
-without square brackets clears all footer fields. In this particular
-example it could be omitted as all footer fields are specified.
-The selectors that can be used
-between the square brackets are given in figure~\ref{fig:sel}. Selectors can be combined so
-\Cmd{fancyhead[LE,RO]\{text\}}
-will define the field for both the left header on even pages and the right
-header on odd pages. If you don't give an E or O the definition applies to
-both. Similar for LRC. So the use of \Cmd{lhead} in the previous section
-is just an abbreviation for \Cmd{fancyhead[L]}.
-The selectors may be given as uppercase or lowercase letters.
-
-\CmdIndex{fancyhf}
-There is also a more general command \Cmd{fancyhf} that you can use to
-combine the specifications for headers and footers. This allows additional
-selectors H (header) and F (footer). In fact  \Cmd{fancyhead} and
-\Cmd{fancyfoot} are just  \Cmd{fancyhf} with H and F prespecified.
-\begin{figure}[tb]
-  \begin{center}
-    \leavevmode
-    \begin{tabular}{|l|l|}
-      \hline
-      E & Even page         \\
-      O & Odd page          \\
-      \hline
-      L & Left field        \\
-      C & Center field      \\
-      R & Right field       \\
-      \hline
-      H & Header            \\
-      F & Footer            \\
-      \hline
-%%      T & float at Top      \\
-%%      B & float at Bottom   \\
-%%      F & Float page         \\
-%%      \hline
-    \end{tabular}
-  \end{center}
-  \caption{Selectors}
-  \label{fig:sel}
-\end{figure}
-
-Again, you may
-use  \Cmd{thispagestyle\{plain\}} for a simple page layout for
-page~1.
-
-\section{Redefining \texttt{plain} style}
-
-Some \latex/ commands, like \Cmd{chapter}, use the \Cmd{thispagestyle}
-command to automatically switch to the \texttt{plain} page style, thus
-ignoring the page style currently in effect. 
-To customize even such pages you must redefine the \texttt{plain}
-pagestyle. As we indicated before you could do this by defining the
-\Cmd{ps at plain} command, but \textsf{fancyhdr} gives you an easier way
-with the \Cmd{fancypagestyle} command. This command can be used to
-redefine existing pagestyles (like \texttt{plain}) or to define new ones,
-e.g. if part of your document is to use a different pagestyle. This command
-has two parameters: one is the name of the pagestyle to be defined, the
-second consists of commands that change the headers and/or footers, i.e.
-\verb|fancyhead| etc. Also allowed are changes to \Cmd{headrulewidth} and
-\Cmd{footrulewidth}. 
-  As an example, let us
-redefine the \texttt{plain} style for the report in Section~\ref{two-sided} by
-making the page number bold. 
-\PSindex{plain}
-
-\begin{verbatim}
-\fancypagestyle{plain}{%
-\fancyhf{} % clear all header and footer fields
-\fancyfoot[C]{\textbf{\thepage}} % except the center
-\renewcommand{\headrulewidth}{0pt}
-\renewcommand{\footrulewidth}{0pt}}
-\end{verbatim}
-
-
-\section{The default layout}\label{default}
-Let us use the \verb|book.cls| documentclass and the default settings for
-\textsf{fancyhdr}; so we only issue the commands
-
-\begin{verbatim}
-\usepackage{fancyhdr}
-\pagestyle{fancy}
-\end{verbatim}
-and let \textsf{fancyhdr} take care of everything.  On the
-pages where new chapters start, we get a centered page number in
-the footer; there is no header, and there are no decorative lines.
-
-On an even page, we get the layout:
-
-\begin{fblock}
-\noindent\makebox[\textwidth]{\textsl{1.2  EVALUATION}\hfill
- CHAPTER 1. INTRODUCTION}
-\noindent\makebox[\textwidth]{\hrulefill}\\[\baselineskip]
-\noindent\makebox[\textwidth]{\hfill page body\hfill}\\[\baselineskip]
-\noindent\makebox[\textwidth]{\hrulefill}
-\noindent\makebox[\textwidth]{\hfill4\hfill}
-\end{fblock}
-
-On an odd page, we get the layout:
-
-\begin{fblock}
-\noindent\makebox[\textwidth]{\textsl{CHAPTER 1. INTRODUCTION}\hfill
- 1.2  EVALUATION}
-\noindent\makebox[\textwidth]{\hrulefill}\\[\baselineskip]
-\noindent\makebox[\textwidth]{\hfill page body\hfill}\\[\baselineskip]
-\noindent\makebox[\textwidth]{\hrulefill}
-\noindent\makebox[\textwidth]{\hfill
-3\hfill }
-\end{fblock}
-
-\noindent where the header text is slanted uppercase.
-
-This default layout is produced by the following commands:
-\CmdIndex{rightmark}
-\CmdIndex{leftmark}
-\begin{verbatim}
-\fancyhead[LE,RO]{\textsl{\rightmark}}
-\fancyhead[LO,RE]{\textsl{\leftmark}}
-\fancyfoot[C]{\thepage}
-\end{verbatim}
-
-The following settings are used for the decorative lines:
-
-\begin{tabbing}
-\CmdIndex{headrulewidth}
-\noindent \Cmd{headrulewidth}\qquad \qquad \qquad \=0.4\=pt\\
-\CmdIndex{footrulewidth}
-\Cmd{footrulewidth}\>0\>pt
-\end{tabbing}
-
-The header text is turned into all uppercase in \verb|book.cls|.
-
-\section{The scoop on \latex/'s marks}\label{sec:custom}
-
-Usually, for documents of class \verb|book| and \verb|report|, you may
-want to use chapter and section information in the headings (chapter only
-for one-sided printing), and for documents of class \verb|article|,
-section and subsection information (section only for one-sided
-printing).  \latex/ uses a marker mechanism to remember the chapter and
-section (section and subsection) information for a page; this is
-discussed in detail in the
-\latex/ \emph{Companion}, Section 4.3.1.
-
-There are two ways you can use and change the higher- and lower-level
-sectioning information available to you.  The macros:
-\CmdIndex{rightmark}
-\CmdIndex{leftmark}
-\Cmd{leftmark}
-(higher-level) and \Cmd{rightmark} (lower-level) contain the information
-processed by \latex/, and you can use them directly as shown in 
-Section~\ref{default}.
-
-The \Cmd{leftmark} contains the Left argument of the \emph{Last}
-\Cmd{markboth} on the page, the \Cmd{rightmark} contains the Right
-argument of the \emph{fiRst} \Cmd{markboth} or the only argument of the
-\emph{fiRst} \Cmd{markright} on the page. If no marks are present on a
-page they are ``inherited'' from the previous page.
-
-You can influence how chapter, section, and subsection
-information (only two of them!) is displayed by redefining the
-\CmdIndex{chaptermark}
-\Cmd{chaptermark},
-\CmdIndex{sectionmark}
-\CmdIndex{subsectionmark}
-\Cmd{sectionmark}, and \Cmd{subsectionmark} commands\footnote{There are
-  similar commands for \texttt{paragraph} and \texttt{subparagraph} but
-  they are seldom used.}. You must put the redefinition
-after the first call of \Cmd{pagestyle\{fancy\}} as this
-sets up the defaults.
-
-Let us illustrate this with chapter info. It is made up of three parts:
-\begin{itemize}
-\CmdIndex{thechapter}
-\item  the number (say, 2), displayed by the macro \Cmd{thechapter}
-\item  the name (in English, Chapter), displayed by the macro
-\CmdIndex{chaptername}
-   \Cmd{chaptername}
-\item  the title, contained in the  argument of
-   \Cmd{chaptermark}.
-\end{itemize}
-
-Figure~\ref{fig:markers} shows some variants for ``Chapter 2.\ Do it now''
-(the last example is appropriate in some non-English languages). The \%
-signs at the end of the lines are to prevent unwanted space. Normally you
-would continue the lines and remove these \% signs\footnote{the \texttt{\bs
-    MakeUppercase} command is used in \LaTeXe{} to generate uppercase text,
-  while in \LaTeX{} 2.09 \Cmd{uppercase} is used. The difference is
-  that \Cmd{MakeUppercase} also deals with non-ASCII letters.
-  Fancyhdr defines \Cmd{MakeUppercase} to be an alias for
-  \Cmd{uppercase} if it isn't defined.}.
-
-\begin{figure}[tb]
-\CmdIndex{chaptermark}
-\CmdIndex{uppercase}
-\CmdIndex{MakeUppercase}
-\setlength{\columnsep}{20pt}\small
-\begin{multicols}{2}
-\noindent Code:\\
-\mbox{}\\
-\verb|\renewcommand{\chaptermark}[1]{%|\\
-\verb| \markboth{\chaptername|\\
-\verb| \ \thechapter.\ #1}{}}|\\
-\mbox{}\\
-\verb|\renewcommand{\chaptermark}[1]{%|\\
-\verb| \markboth{\MakeUppercase{%|\\
-\verb| \chaptername}\ \thechapter.%|\\
-\verb| \ #1}{}}|\\
-\mbox{}\\
-\verb|\renewcommand{\chaptermark}[1]{%|\\
-\verb| \markboth{\MakeUppercase{%|\\
-\verb| \chaptername\ \thechapter.%|\\
-\verb| \ #1}}{}}|\\
-\mbox{}\\
-\verb|\renewcommand{\chaptermark}[1]{%|\\
-\verb| \markboth{#1}{}}|\\
-\mbox{}\\
-\verb|\renewcommand{\chaptermark}[1]{%|\\
-\verb| \markboth{\thechapter.\ #1}{}}|\\
-\mbox{}\\
-\verb|\renewcommand{\chaptermark}[1]{%|\\
-\verb| \markboth{\thechapter.%|\\
-\verb| \ \chaptername.\ #1}{}}|\\
-Prints:\\
-\mbox{}\\
-Chapter 2.\ Do it now\\
-\mbox{}\\
-\mbox{}\\
-\mbox{}\\
-CHAPTER 2.\ Do it now\\
-\mbox{}\\
-\mbox{}\\
-\mbox{}\\
-\mbox{}\\
-CHAPTER 2.\ DO IT NOW\\
-\mbox{}\\
-\mbox{}\\
-\mbox{}\\
-\mbox{}\\
-Do it now\\
-\mbox{}\\
-\mbox{}\\
-2.\ Do it now\\
-\mbox{}\\
-\mbox{}\\
-2.\ Chapter.\ Do it now\\
-\mbox{}\\
-\end{multicols}
-\caption{Marker variants}\label{fig:markers}
-\end{figure}
-
-
-For the lower-level sectioning information, do the same with
-\Cmd{markright}.
-
-So if ``Section 2.2.\ First steps'' is the current section,
-then
-
-\begin{verbatim}
-\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
-\end{verbatim}
-will give
-   ``2.2.\ First steps''
-
-Redefining the \Cmd{chaptermark} and \Cmd{sectionmark} commands may
-not eliminate all uppercaseness. E.g.\ the bibliography will have a title
-\CmdIndex{uppercase}
-\index{BIBLIOGRAPHY}
-of \textsc{bibliography} in the header, as the \Cmd{MakeUppercase} is
-explicitly given in the definition of \Cmd{thebibliography}. Similar for
-\index{INDEX}
-\textsc{index} etc.\ If you don't want to redefine these commands, you can
-use the \Cmd{nouppercase} command that \textsf{fancyhdr} makes available in the header
-and footer fields. Note that this may screw other things, like uppercase
-roman numerals in your headers, so it should be used with care. Essentially
-this command typesets its argument in an environment where
-\Cmd{MakeUppercase} and \Cmd{uppercase} are changed into do-nothing operations.
-
-
-\begin{verbatim}
-\lhead{\nouppercase{\rightmark}}
-\rhead{\nouppercase{\leftmark}}
-\end{verbatim}
-
-
-It should be noted that the \latex/ marking mechanism works fine with
-chapters (which always start on a new page) and sections (which are
-reasonably long).  It does not work quite as well with short sections and
-subsections.  This is a problem with \latex/, not with
-\textsf{fancyhdr}.
-
-As an example let's take a page layout where the leftmarks are generated by
-the sections and the rightmarks by the subsections (as is default in the
-\texttt{article} class). Take a page with some short sections, e.g. 
-
-\begin{samepage}
-\noindent Section 1.\\
-subsection 1.1\\
-subsection 1.2\\
-Section 2.  
-\end{samepage}
-
-As the leftmark contains the \emph{last} mark of the page it will be
-``Section 2.'', and the rightmark will be ``subsection 1.1'' as it will be
-the \emph{first} mark of the page. So the page header info will combine 
-section 2 with subsection 1.1 which isn't very nice.
-The best you can do in these cases is use only the \Cmd{rightmark}s and
-redefine \Cmd{sectionmark} accordingly. A \latex/ command
-\CmdIndex{firstleftmark}
-\Cmd{firstleftmark} would also be a nice addition (see the 
-\texttt{extramarks} package in section~\ref{sec:xmarks}).
-
-Another problem with the marks in the standard \latex/ classes is that the
-higher level sectioning commands (e.g. \Cmd{chapter}) call
-\Cmd{markboth} with an empty right argument. This means that on the first
-page of a chapter (or a section in article style) the \Cmd{rightmark}
-will be empty. If this is a problem you must manually insert extra
-\Cmd{markright} commands or redefine the \Cmd{chaptermark}
-(\Cmd{sectionmark}) commands to issue a \Cmd{markboth} command with
-two decent parameters.
-
-As a final remark you should also note that the \verb|*| forms of the
-\Cmd{chapter} etc.\ commands do \emph{not} call the mark commands. So if
-you want your preface to set the header info but not be numbered nor be put in
-the table of contents, you must issue the \Cmd{markboth} command
-yourself, e.g.
-
-\begin{verbatim}
-\chapter*{Preface\markboth{Preface}{}}
-\end{verbatim}
-
-Entering the \Cmd{markboth} command inside the \Cmd{chapter*} insures
-that the mark will not be separated from the title by a page break. Of
-course with \Cmd{chapter*} this wouldn't be  a problem if you put the mark
-command after the chapter title, as the \Cmd{chapter*} command starts at a
-new page. However with a \Cmd{section*} it could be dangerous to say:
-
-\begin{verbatim}
-\section*{Preface}
-\markboth{Preface}{}
-\end{verbatim}
-as a page break may occur between the two commands.
-
-\section{Dictionary style headers}
-
-\index{dictionary}
-\index{concordance}
-Dictionaries and concordances usually have a header containing the first
-word defined on the page or both the first and the last words. This can
-easily be accomplished with \textsf{fancyhdr} and \latex/'s
-\texttt{mark} mechanism. Of course if you use the marks for dictionary
-style headers, you cannot use them for chapter and section information, so
-if there are also chapters and sections present, you must redefine the
-\Cmd{chaptermark} and \Cmd{sectionmark} to make them harmless:
-
-\begin{verbatim}
-\renewcommand{\chaptermark}[1]{}
-\renewcommand{\sectionmark}[1]{}
-\end{verbatim}
-
-Now you do a \Cmd{markboth\{\#1\}\{\#1\}} for each dictionary or concordance
-entry \verb|#1| and use \Cmd{rightmark} for the first entry defined on
-the page and \Cmd{leftmark} for the last one.
-
-If you want to use a header entry of the form \textsf{firstword--lastword}
-it would be nice if this would be reduced to just the form
-\textsf{firstword} if both are the same. This could happen if there is just
-one entry on the page. In this case a test must be made to check if the
-marks are the same.  However, \tex/'s marks are strange beasts, which
-cannot be compared out of the box with the plain \tex/ \Cmd{if} commands.
-\TTindex{ifthen}
-Fortunately the \texttt{ifthen} package works well:
-
-\begin{verbatim}
-\newcommand{\mymarks}{
-  \ifthenelse{\equal{\leftmark}{\rightmark}}
-    {\rightmark} % if equal
-    {\rightmark--\leftmark}} % if not equal
-\fancyhead[LE,RO]{\mymarks}
-\fancyhead[LO,RE]{\thepage}
-\end{verbatim}
-
-\section{Fancy layouts}
-
-\index{multi-line}
-You can make a multi-line field with the \Cmd{\bs} command.  It is also
-possible to put extra space in a field with the \Cmd{vspace} command.
-Note that if you do this you will probably have to increase the height of
-\CmdIndex{headheight}
-\CmdIndex{footskip}
-the header (\Cmd{headheight}) and/or of the footer (\Cmd{footskip}),
-\index{Overfull \verb+\vbox+ \ldots}
-otherwise you may get error messages ``Overfull \Cmd{vbox} \ldots has
-occurred while \Cmd{output} is active''%
-\footnote{If you use \texttt{11pt} or \texttt{12pt} you will probably also
-  have to do this, because \LaTeX's defaults are quite small}.
-See Section 4.1 of the \latex/ \emph{Companion} for detail.
-
-For instance, the following code will place  the section title and the
-subsection title of an article in two lines in the upper right hand
-corner:
-
-\begin{verbatim}
-\documentclass{article}
-\usepackage{fancyhdr}
-\pagestyle{fancy}
-\addtolength{\headheight}{\baselineskip}
-\renewcommand{\sectionmark}[1]{\markboth{#1}{}}
-\renewcommand{\subsectionmark}[1]{\markright{#1}}
-\rhead{\leftmark\\\rightmark}
-\end{verbatim}
-
-You can also customize the decorative lines.  You can make the decorative
-line in the header quite thick with
-
-\CmdIndex{headrulewidth}
-\begin{verbatim}
-\renewcommand{\headrulewidth}{0.6pt}
-\end{verbatim}
-or you can make the decorative line in the footer disappear with
-\CmdIndex{footrulewidth}
-\begin{verbatim}
-\renewcommand{\footrulewidth}{0pt}
-\end{verbatim}
-
-The decorative lines, themselves, are defined in the two macros
-\Cmd{headrule} and \Cmd{footrule}.  For instance,
-if you want a dotted line rather than a solid line in the header,
-redefine the command \Cmd{headrule}:
-
-\begin{verbatim}
-\renewcommand{\headrule}{\vbox to 0pt{\hbox
-    to\headwidth{\dotfill}\vss}}
-\end{verbatim}
-
-As an alternative to changing \Cmd{headrulewidth} to 0 to have the rule disappear, you can also make it empty with
-\begin{verbatim}
-\renewcommand{\headrule}{}
-\end{verbatim}
-Visually this make no difference, but it is more difficult to restore it later to its default value.
-
-Finally, let us make a real `decorative' line\footnote{Based upon an idea by Wayne Chan.}.
-\begin{verbatim}
-\usepackage{fourier-orns}
-...
-\renewcommand\headrule{\hrulefill
-\raisebox{-2.1pt}[10pt][10pt]{\quad\decofourleft\decotwo\decofourright\quad}\hrulefill}
-\end{verbatim}
-This gives us the following headrule:
-
-\noindent\makebox[\textwidth]{\hrulefill \raisebox{-2.1pt}[10pt][10pt]{\quad\decofourleft\decotwo\decofourright\quad}\hrulefill}
-
-\CmdIndex{footruleskip}
-There is one additional parameter that you can set: \Cmd{footruleskip}. It
-defines the distance between the decorative line in the footer and the top
-of the footer text line. By default it is set to 30\% of the normal line
-distance. You may want to adjust it if you use unusally large or small
-fonts in the footer. Change it with \Cmd{renewcommand}.
-
-\section{Two book examples}
-The following definitions give an approximation of the style
-used in L. Lamport's \latex/ book.
-
-Lamport's header overhangs the outside margin.  This is done as follows.
-
-The width of headers and footers is \Cmd{headwidth}, which by default
-equals the width of the text: \Cmd{textwidth}. You can make the width
-\CmdIndex{headwidth}
-wider (or narrower) by redefining \Cmd{headwidth} with the
-\Cmd{setlength} and \Cmd{addtolength} commands.
-To overhang the outside margin where the marginal notes are
-\CmdIndex{marginparsep}
-\CmdIndex{marginparwidth}
-printed, add both \Cmd{marginparsep} and \Cmd{marginparwidth} to
-\Cmd{headwidth} with the commands:
-
-\begin{verbatim}
-\addtolength{\headwidth}{\marginparsep}
-\addtolength{\headwidth}{\marginparwidth}
-\end{verbatim}
-
-\begin{flushleft}
-You must issue these commands \emph{after} the first
-\Cmd{pagestyle\{fancy\}} command as this
-will establish the default for \Cmd{headwidth}\footnote{In version 2 of
-  \textsf{fancyhdr} it is usually safe to do it before, but it is still
-  advised to do after.}.
-\end{flushleft}
-
-And now a complete definition of Lamport's book style:
-
-\begin{verbatim}
-\documentclass{book}
-\usepackage{fancyhdr}
-\pagestyle{fancy}
-\addtolength{\headwidth}{\marginparsep}
-\addtolength{\headwidth}{\marginparwidth}
-\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
-\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
-\fancyhf{}
-\fancyhead[LE,RO]{\textbf{\thepage}}
-\fancyhead[LO]{\textbf{\rightmark}}
-\fancyhead[RE]{\textbf{\leftmark}}
-\fancypagestyle{plain}{%
-   \fancyhead{} % get rid of headers
-   \renewcommand{\headrulewidth}{0pt} % and the line
-}
-\end{verbatim}
-\PSindex{plain}
-
-Notice that the \Cmd{chaptermark} and \Cmd{sectionmark} commands have
-been redefined to eliminate the chapter numbers and the uppercaseness.
-
-For more control about the horizontal position of the headers and/or footers, \textsf{fancyhdr} has additional commands to specify the offset of the header and/or footer elements. Use \Cmd{fancyhfoffset[place]\{length\}} 
-\CmdIndex{fancyhfoffset} 
-to offset one or more elements. The \texttt{place} parameter is like the optional parameter of \Cmd{fancyhf}, like \texttt{L R E O}, except that \texttt{C} cannot be used. It specifies for which elements the offset should be applied. The \texttt{length} parameter specifies the actual offset. Positive values move the element outward (into the margin), negative values inward. There are also specialised commands \Cmd{fancyheadoffset} and \Cmd{fancyfootoffset}, which have the \texttt{H} and \texttt{F} parameter pre-applied, respectively.
-\CmdIndex{fancyheadoffset} 
-\CmdIndex{fancyfootoffset} 
-
-When you use these commands, \latex/ will recalculate \Cmd{headwidth}, based on the given parameters.
-
-So the above example could also have been done with (N.B. You can only use such an expression as a length parameter if the \textsf{calc} package is used):
-
-\begin{verbatim}
-\fancyheadoffset[LE,RO]{\marginparsep+\marginparwidth}
-\end{verbatim}
-
-For the second example, we take the \amslatex/ book.% \cite{gG93B}.
-% George Gratzer, Math into LaTeX, An Introduction to LaTeX and AMS-LaTeX,
-% Birkhauser Boston, ISBN 0-8176-3805-9
-
-Chapter pages have no headers or footers.  So we declare
-
-\begin{verbatim}
-\thispagestyle{empty}
-\end{verbatim}
-for every chapter page, and we do not need to redefine plain.
-
-Chapter and section titles appear in the form: 2.\ DO IT NOW, so we have
-to redefine \Cmd{chaptermark} and \Cmd{sectionmark} as follows (see
-Section~\ref{sec:custom}):
-
-\begin{verbatim}
-\renewcommand{\chaptermark}[1]%
-   {\markboth{\MakeUppercase{\thechapter.\ #1}}{}}
-\renewcommand{\sectionmark}[1]%
-   {\markright{\MakeUppercase{\thesection.\ #1}}}
-\end{verbatim}
-
-In an even-header, the page number is printed as the LeftHeader and
-the chapter info as the RightHeader; in an odd-header, the section info
-is printed as the LeftHeader and the page number as the RightHeader.  The
-CenteredHeaders are empty.  There are no footers.
-
-There is a decorative line in the header.  It is 0.5pt wide, so we need
-the commands:
-
-\begin{verbatim}
-\renewcommand{\headrulewidth}{0.5pt}
-\renewcommand{\footrulewidth}{0pt}
-\end{verbatim}
-
-The font used in the headers is 9 pt bold Helvetica.  The \PSNFSS\ system
-by Sebastian Rahtz uses the short (Karl Berry) name \verb|phv| for
-Helvetica, so this font is selected with the commands:
-\begin{verbatim}
-\fontfamily{phv}\fontseries{b}\fontsize{9}{11}\selectfont
-\end{verbatim}
-(See Sections 7.6.1 and 11.9.1 of the \latex/ \emph{Companion}.)
-Let us define a shorthand for this:
-\begin{verbatim}
-\newcommand{\helv}{%
-   \fontfamily{phv}\fontseries{b}\fontsize{9}{11}\selectfont}
-\end{verbatim}
-
-Now we are ready for the page layout:
-
-\begin{verbatim}
-\documentclass{book}
-\usepackage{fancyhdr}
-\pagestyle{fancy}
-\renewcommand{\chaptermark}[1]%
-   {\markboth{\MakeUppercase{\thechapter.\ #1}}{}}
-\renewcommand{\sectionmark}[1]%
-   {\markright{\MakeUppercase{\thesection.\ #1}}}
-\renewcommand{\headrulewidth}{0.5pt}
-\renewcommand{\footrulewidth}{0pt}
-\newcommand{\helv}{%
-   \fontfamily{phv}\fontseries{b}\fontsize{9}{11}\selectfont}
-\fancyhf{}
-\fancyhead[LE,RO]{\helv \thepage}
-\fancyhead[LO]{\helv \rightmark}
-\fancyhead[RE]{\helv \leftmark}
-\end{verbatim}
-
-
-\section{Special page layout for float pages}
-\label{sec:float}
-
-\index{float page}
-Some people want to have a special layout for float pages (pages only
-containing floats). As these pages
-are generated autonomically by \latex/, the user doesn't have any control
-over them. There is no \Cmd{thispagestyle} for float pages and any change
-of the page style will at least also affect the page before the float page.
-With \textsf{fancyhdr}, however, you can specify in each of
-the header- or footer fields
-
-\Cmd{iffloatpage\{}value for float page\verb|}{|value for other pages\verb|}|
-
-You can even use this to get rid of the decorative line on float pages only
-by defining:
-
-\begin{verbatim}
-\renewcommand{\headrulewidth}{\iffloatpage{0pt}{0.4pt}}
-\end{verbatim}
-
-Sometimes you may want to change the layout also for pages that contain a
-float on the top of the page, a float on the bottom of the page or a footnote on the bottom of the page.
-
-\textsf{fancyhdr} gives you the commands \Cmd{iftopfloat}, \Cmd{ifbotfloat} and \Cmd{iffootnote}
-similar to \Cmd{iffloatpage}.
-
-Note: Marks in floats will not be visible in \latex/'s output routine, so
-it is not useful to put marks in floats. So there is currently no way to
-let a float (e.g.\ a figure caption) influence the page header or footer.
-
-\section{Those blank pages}
-\label{sec:blank}
-
-In the \texttt{book} class when the \texttt{openany} option is not given or
-in the \texttt{report} class when the \texttt{openright} option is given,
-chapters start at odd-numbered pages, half of the time causing a blank page
-to be inserted. Some people prefer this page to be completely empty, i.e.\ 
-without headers and footers. This cannot be done with \Cmd{thispagestyle}
-as this command would have to be issued on the \emph{previous} page. There
-is, however, no magic necessary to get this done:
-
-\PSindex{empty}
-\CmdIndex{clearpage}
-\CmdIndex{cleardoublepage}
-\begin{verbatim}
-\clearpage{\pagestyle{empty}\cleardoublepage}
-\end{verbatim}
-
-As the \Cmd{pagestyle\{empty\}} is enclosed in a group it only affects the
-page that may be generated by the \Cmd{cleardoublepage}.  You can of
-course put the above in a private command. If you want to have this done
-automatically at each chapter start or when you want some other text on the
-page then you must redefine the \Cmd{cleardoublepage} command.
-\index{blank page}
-\begin{verbatim}
-\makeatletter
-\def\cleardoublepage{\clearpage\if at twoside \ifodd\c at page\else
-  \hbox{}
-  \vspace*{\fill}
-  \begin{center}
-    This page intentionally contains only this sentence.
-  \end{center}
-  \vspace{\fill}
-  \thispagestyle{empty}
-  \newpage
-  \if at twocolumn\hbox{}\newpage\fi\fi\fi}
-\makeatother
-\end{verbatim}
-
-\section{\textsf{N} of \textsf{M} style page numbers}
-\label{sec:nofm}
-
-Some document writers prefer the pages to be numbered as \textsf{n} of
-\textsf{m} where \textsf{m} is the number of pages in the document. There is a package \texttt{lastpage}
-available which you can use with \textsf{fancyhdr} as follows:
-
-\begin{verbatim}
-\usepackage{lastpage}
-...
-\cfoot{\thepage\ of \pageref{LastPage}}
-\end{verbatim}
-
-The value of the \texttt{LastPage} label can be used to
-make different headers or footers on the last page of a document. E.g.\ if
-you want the footer of every odd page, except if it is the last one, to
-contain the text ``please turn over'', this can be done as
-follows:
-
-\begin{verbatim}
-\usepackage{lastpage}
-\usepackage{ifthen}
-...
-\rfoot{\ifthenelse{\isodd{\value{page}} \and \not
-    \value{page}=\pageref{LastPage}{please turn over}{}}
-\end{verbatim}
-
-\section{Chapter or section related page numbers}
-
-In technical documentation very often page numbers are used of the form
-2-10 where the first number is the chapter number and the second is the
-pagenumber relative to the chapter. Sometimes section is used rather than
-chapter. The package \textsf{chappg} can be used to get this format. 
-
-Basically this package redefines \Cmd{thepage} as 
-\Cmd{thechapter}\Cmd{chappgsep}\Cmd{arabic\{page\}}, where \Cmd{chappgsep} by default is ``-''. If you want do use a different separator, you must redefine \Cmd{chappgsep}, for example to use an en-dash:
-
-\begin{verbatim}
-\renewcommand{\chappgsep}{--}
-\end{verbatim}
-
-To use a different prefix, for example the section number, use the \Cmd{pagenumbering\{bychapter\}} command with an optional argument specifying the prefix.
-\CmdIndex{pagenumbering}
-
-\begin{verbatim}
-\pagenumbering[\thesection]{bychapter}
-\end{verbatim}
-
-What the package also does is reset the page number to 1 at the beginning
-of each chapter.
-
-There is a caveat when you have appendixes in your document. Before the
-\Cmd{appendix} command you should give a \Cmd{clearpage} or
-\Cmd{cleardoublepage}. See the \textsf{chappg} documentation for
-details.
-
-There is a fundamental difference between the page numbering of the style
-``\emph{m} of \emph{n}'' as described in the previous section and the
-current one. The \emph{m} of \emph{n} style is only used in the page header
-or footer, but not in the table of contents, index, or references like
-``\emph{See page \emph{xx}}''. Therefore it does not change the command
-\Cmd{thepage}. The page numbering style ``2-10'', however should be used
-in all references to the page number, therefore it must be done by redefining
-\Cmd{thepage}. 
-
-
-\section{When to change the headers and footers?}
-\label{sec:change}
-
-Sometimes you want to change the header or footer layout in the course of a
-document. Some of these changes can be accomplished by using the mark
-mechanism as may be seen in section~\ref{sec:custom} and \ref{sec:xmarks}.
-However, sometimes we want a more drastic change, e.g to change the page
-numbering from roman to arabic (with \Cmd{pagenumbering}), to change one of
-\index{page style!changes}
-the \textsf{fancyhdr} fields or to change to another page style.
-Sometimes you may be surprised to find the change to occur too early. In
-general the above mentioned changes take effect immediately, i.e.\ on the
-page that is currently being built. If you want the change to take effect
-at the next page you must make sure that the current page is finished. In
-\CmdIndex{clearpage}
-most cases this can be done by issuing a \Cmd{clearpage} command before
-any of the above mentioned changes. If this is not possible you can use the 
-\TTindex{afterpage.sty}
-\texttt{afterpage} package with:\\
-\Cmd{afterpage\{}\Cmd{lhead\{new value\}\}} or
-\CmdIndex{pagenumbering}
-\Cmd{afterpage\{}\Cmd{pagenumbering\{roman\}\}}. You cannot use \Cmd{afterpage}
-to change the \Cmd{pagestyle} as the commands issued by \Cmd{afterpage}
-are local in a group, and the \Cmd{pagestyle} command makes only local
-changes. The \Cmd{pagenumbering} and the \textsf{fancyhdr} commands
-make global changes so they will work, as will the \Cmd{thispagestyle}
-command. 
-
-It should be noted that although the \textsf{fancyhdr} commands like
-\Cmd{fancyhead} take effect immediately, this does not mean that any
-``variables'' used in these commands get the value they have at the place
-where these commands are given. E.g.\ if \Cmd{fancyfoot[C]\{}\Cmd{thepage\}} is given
-the page number that will be inserted in the footer is not the page number
-of the page where this command is given, but rather the page number of
-the actual page where the footer is constructed. Of course for the page
-number this is what you expect, but it is also true for other commands.
-
-So if you have a book where each chapter is written by a different author
-and you want the name of the author in the lower left-hand corner you can
-use the following commands:
-
-\begin{verbatim}
-\newcommand{\TheAuthor}{}
-\newcommand{\Author}[1]{\renewcommand{\TheAuthor}{#1}}
-\lfoot{\TheAuthor}
-\end{verbatim}
-
-\noindent and start each chapter with the command 
-\Cmd{Author\{Real Name\}}.
- If however, the author name would be changed before a page is
-completed the wrong author could come in the footer. This would be the case
-if you gave the above command \emph{before} the \Cmd{chapter} command
-rather than after it. 
-Another source of problems is the fact that \tex/'s output routine processes
-commands ahead, so it may already have processed some commands that produce
-text that will appear on the next page. See the next section for an example.
-
-\section{Headers and footers induced by the text}
-\label{sec:xmarks}
-
-We have seen how we can use \LaTeX's marks to get information from the
-document contents to the headers and footers. The marks mechanism is the
-only reliable mechanism that you can use to get changing information to the
-headers or footers. This is because \latex/ may be processing your document
-ahead before deciding to break the page. 
-
-Sometimes the two marks that \latex/ offers are not enough. An example is
-the following:
-\begin{quote}
- If a solution to an exercise goes across a page break, then I would like
- to have ``(Continued on next page\ldots)'' at the bottom of the
-\index{Continued\ldots}
- first page and ``(Continued\ldots)'' at the top in the margin of the next page.
-\end{quote}
-
-You cannot use \latex/'s mark mechanisms for this if you also want to use
-chapter and section information.
-
-The \textsf{extramarks} package gives you
-two extra marks that can be used in this situation.
-Here is a way to use this package:
-
-\begin{verbatim}
-\usepackage{extramarks}
-...
-\pagestyle{fancy}
-\lhead{\firstxmark}
-\rfoot{\lastxmark}
-...
-\extramarks{}{Continued on next page\ldots}
-Some text that may or may not cross a page boundary...
-\extramarks{Continued\ldots}{}
-\end{verbatim}
-
-\CmdIndex{extramarks}
-Note that the \Cmd{extramarks} command must be close to the text, i.e no
-empty lines (paragraph boundaries) should intervene. Otherwise the page may
-be broken at that boundary and the extramarks would come on the wrong page.
-
-There are two new marks that can be used in the page layout with this
-package: If commands of the form
-\verb|\extramarks{|$m_1$\verb|}{|$m_2$\verb|}| are given
-\CmdIndex{firstxmark}
-\CmdIndex{lastxmark}
-\Cmd{firstxmark} gives you the first $m_1$ value and
-\Cmd{lastxmark} gives you the last $m_2$ value
-of the current page.
-
-In case you want the last  $m_1$ value or the first  $m_2$ value, you can use the \Cmd{lastleftxmark} or \Cmd{firstrightxmark}, respectively. For symmetry reasons there are also commands \Cmd{firstleftxmark} (=\Cmd{firstxmark}), \Cmd{lastrightxmark} (=\Cmd{lastxmark}), \Cmd{topleftxmark} (=\Cmd{topxmark}) and \Cmd{toprightxmark}. The top-marks are basically the last-marks of the previous page.
-\CmdIndex{lastleftxmark}
-\CmdIndex{firstrightxmark}
-\CmdIndex{firstleftxmark}
-\CmdIndex{lastrightxmark}
-\CmdIndex{topleftxmark}
-\CmdIndex{toprightxmark}
-
-The package also gives you the \Cmd{firstleftmark} and \Cmd{lastrightmark}
-commands that complement the standard \latex/ marks.
-\CmdIndex{firstleftmark}
-\CmdIndex{lastrightmark}
-
-To stress the point that marks are the correct way to do this, let me
-give you a ``solution'' that will not work\footnote{Actually there is
-  another way but it requires two \latex/ passes: you can put \Cmd{label}
-  commands before and after the text and compare the \Cmd{pageref}s.}:
-
-\begin{verbatim}
-\lhead{Continued}
-\rfoot{Continued on next page\ldots}
-Some text that may or may not cross a page boundary...
-\lhead{}
-\rfoot{}
-\end{verbatim}
-
-You may be tempted to think that the first \Cmd{lhead} and \Cmd{rfoot}
-will be in effect when \tex/ breaks the page in the middle of the text,
-and the last ones when the page breaks after the text. This is not true as
-the whole paragraph (including the last definitions) will be processed
-\index{page break}
-before \tex/ considers the page break, so at the time of the page break the
-last definitions are effective, whether the page break occurs inside the text
-or outside of it. Putting a paragraph boundary between the
-text and the last definitions will not work either, because you don't want
-the first definitions to be in effect when \tex/ decides to break the page
-exactly at this boundary. Actually the marks mechanism was invented to get
-rid of these kinds of problems.
-
-In the above example the text ``Continued'' appears in the page header. It
-\index{margin}
-may be nicer to put it in the  margin. This can be easily
-accomplished by positioning it at a fixed place relative to the page header.
-In plain \tex/ you would use a concoction of \Cmd{hbox to 0pt},
-\Cmd{vbox to 0pt}, \Cmd{hskip},\Cmd{vskip}, \Cmd{hss} and
-\Cmd{vss} but fortunately 
-\latex/'s \texttt{picture} environment gives a much cleaner way to do this.
-In order not to disturb the normal header layout we put the text in a zero-sized
-\texttt{picture}. Generally this is the best way to position things on fixed
-places on the page. You can then also use the normal headings. See also
-section~\ref{sec:thumb} for another example of 
-this technique.
-
-\TTindex{picture}
-\begin{verbatim}
-\lhead{\setlength{\unitlength}{\baselineskip}%
-\begin{picture}(0,0)
-  \put(-2,-3){\makebox(0,0)[r]{\firstxmark}}
-  \end{picture}\leftmark}
-\end{verbatim}
-
-This solution can of course also be used for the footer. Make sure you put the
-\texttt{picture} as the first thing in left-handside entries and last in right-handside
-ones.
-
-Finally you may want to put ``(Continued\ldots)'' in the \emph{text}
-rather than in the header or the margin. Then you have to use the
-\TTindex{afterpage.sty}
-\texttt{afterpage} package. We also decide to make a separate
-environment for it.
-
-\begin{verbatim}
-\newenvironment{continued}{\par
-  \extramarks{}{Continued on next page\ldots}
-  \afterpage{\noindent\firstxmark\vspace{1ex}}
-  }{\extramarks{(Continued\ldots)}{}\par}
-\end{verbatim}
-
-It is a bit dangerous to use \Cmd{firstxmark} outside the page layout
-routine, but apparently with \Cmd{afterpage} this works. If you would
-need the information further on in the page you must remember the state of
-the marks in your own variable. You can set this in one of the
-\textsf{fancyhdr} fields. For example if you want to add something
-\emph{after} the broken piece of text you can use the following:
-
-\begin{verbatim}
-\newcommand{\mysaved}{}
-
-\newenvironment{continued}{\par
-  \extramarks{}{Continued on next page\ldots}
-  }{\extramarks{(Continued\ldots)}{}\par\vspace{1ex}\mysaved}
-\lhead{\leftmark}
-\chead{\ifthenelse{\equal{\lastxmark}{}}
-  {\gdef\mysaved{}}
-  {\gdef\mysaved{\noindent[Continued from previous page]}}}
-\end{verbatim}
-
-If you want to include one of the marks or other varying information in the
-saved text, you must use \Cmd{xdef} rather than \Cmd{gdef}.
-
-
-\section{A movie}
-\label{sec:movie}
-
-\index{movie}
-\TTindex{picture}
-If you put at each page on the same place a picture that slightly changes
-from page to page you can get a movie-like effect by flipping through the
-pages. You can create such a movie easily with fancyhdr. For
-simplicity we assume that each picture is in a postscript (EPS) file called
-\texttt{pic}$\langle n\rangle$.\texttt{ps} where $\langle n\rangle$ is the page number and that we use
-the \texttt{graphics} or  \texttt{graphicx} package\footnote{If you use an older version of
-  \LaTeX{} you could use the \texttt{epsf} or \texttt{epsfig} package.}. 
-\TTindex{graphics}
-\TTindex{graphicx}
-\TTindex{epsf}
-\TTindex{epsfig}
-To put the movie in the  righthandside bottom corner the following will work:
-
-\begin{verbatim}
-\rfoot{\setlength{\unitlength}{1mm}
-  \begin{picture}(0,0)
-    \put(5,0){\includegraphics{pic\thepage.ps}}
-  \end{picture}}
-\end{verbatim}
-
-Notice that the \Cmd{unitlength} parameter should
-be set locally in the fancyhdr field in order to avoid unwanted
-interference with its value in the text.
-
-\section{Thumb-indexes}
-\label{sec:thumb}
-
-\index{bible}
-Some railroad guides and expensive bibles have so called
-\index{thumb-index}
-\emph{thumb-indexes}, i.e.\ there are marks on the sides of the pages that
-indicate where the chapters are. You can create these by printing black
-blobs in the margin of the pages. The vertical position should be
-determined by the chapter number or some other counter. As the position is
-independent of the contents of the page, we print these blobs as part of
-the header in a zero-sized \texttt{picture} as described in the previous
-section.
-
-Of course we have to take care of two-sided printing, and we may want to
-have an index page with all the blobs in the correct position. The solution
-requires some hand-tuning to get the blobs nicely spaced out vertically.
-For the application that I had there were 12 sections, so I made the blobs
-18 mm apart, i.e. 9~mm blob separated by 9~mm whitespace. In order to avoid
-calculations they are set in a \texttt{picture} environment with the
-\Cmd{unitlength} set to 18~mm. Page numbers are set in the headers at the
-outer sides, and the blobs are attached to these. In this example the
-section numbers are used to position the blobs, but you can replace this
-with any numeric value. 
-See figure~\ref{fig:overview} for the resulting
-overview page and figure~\ref{fig:thumb} for the code.
-
-\begin{figure}[htbp]
-\setlength{\unitlength}{9mm}
-\newcommand{\blob}{\rule[-.2\unitlength]{1\unitlength}{.5\unitlength}}
-\newcounter{line}
-\newcommand{\secname}[1]{\addtocounter{line}{1}%
-  \put(1,-\value{line}){\blob}
-  \put(-7.5,-\value{line}){\arabic{line}}
-  \put(-7,-\value{line}){#1}}
-
-\newcommand{\overview}{1
-  \begin{picture}(0,0)
-    \secname{Introduction}
-    \secname{The first year}
-    \secname{Specialisation}
-  \end{picture}}
- 
-  \begin{center}
-    \leavevmode
-    \begin{picture}(11.3,5)
-      \put(0,0){\framebox(11.3,5)[tr]{}}
-      \put(9,4.5){\overview}
-    \end{picture}
-  \end{center}
-  \caption{Thumb-index overview page}
-  \label{fig:overview}
-\end{figure}
-\begin{figure}[hp]\small
-\begin{verbatim}
-\setlength{\unitlength}{18mm}
-\newcommand{\blob}{\rule[-.2\unitlength]{2\unitlength}{.5\unitlength}}
-
-\newcommand\rblob{\thepage
-  \begin{picture}(0,0)
-    \put(1,-\value{section}){\blob}
-  \end{picture}}
-
-\newcommand\lblob{%
-  \begin{picture}(0,0)
-    \put(-3,-\value{section}){\blob}
-  \end{picture}%
-  \thepage}
-
-\pagestyle{fancy}
-\cfoot{}
-
-\newcounter{line}
-\newcommand{\secname}[1]{\addtocounter{line}{1}%
-  \put(1,-\value{line}){\blob}
-  \put(-7.5,-\value{line}){\Large \arabic{line}}
-  \put(-7,-\value{line}){\Large #1}}
-
-\newcommand{\overview}{\thepage
-  \begin{picture}(0,0)
-    \secname{Introduction}
-    \secname{The first year}
-    \secname{Specialisation}
-...etc...
-  \end{picture}}
-
-\begin{document}
-\fancyhead[R]{\overview}\mbox{}\newpage % This produces the overview page
-\fancyhead[R]{} % Front matter may follow here
-\clearpage
-\fancyhead[RE]{\rightmark}
-\fancyhead[RO]{\rblob}
-\fancyhead[LE]{\lblob}
-\fancyhead[LO]{{\leftmark}
-...
-\end{verbatim}
-  \caption{Thumb-index code}
-  \label{fig:thumb}
-\end{figure}
-
-\section{Float placement}
-
-Floats are page elements that float with respect to the rest of the
-document. Standard floats are tables and figures, but with the
-\textsf{float} package you can easily make new ones, like algorithms. Most
-of the time floats work satisfactory, but sometimes \LaTeX{} seems too
-stubborn to do what you want. This section describes how you can influence
-\LaTeX{} so that it will do most of the time what you want. There might,
-however be some pathological cases where it is impossible to convince
-\LaTeX{} to do things your way. In the following we will use figures as an
-example but everything applies to other floats as well.
-
-The most encountered problems with floats are:
-\begin{enumerate}
-\item You want a float at a certain position in the text, but \LaTeX{}
-  moves it, usually to the next page.
-\item From a certain point, \LaTeX{} moves all your floats to the end of
-  the document or the end of a chapter.
-\item \LaTeX{} complains about ``Too many floats''.
-\end{enumerate}
-
-In the first two cases you must first check if you have given the correct
-``placement'' parameter to you float, e.g. \Cmd{begin\{figure\}[htp]}
-specifies that your figure may be placed either: Here (i.e. in the text
-position where the command is given), on the Top of a page (which may be
-the page where you put the command), or on a separate Page of floats. You
-could also have specified ``b'' for Bottom of the page. The order of the
-letters is insignificant, you cannot force \LaTeX{} to try Bottom first
-and then Top by specifying \texttt{[bt]}.
-
-If \LaTeX{} doesn't put the float at the place where you expected it, it is
-usually caused by the following:
-\begin{enumerate}
-\item The float didn't fit on the page. In this case it has to move to the
-  next page or even further. If you didn't specify either \texttt{[t]} or
-  \texttt{[b]} in the position parameter, \latex/ must save it until it has
-  enough for a page of floats. So don't specify only \texttt{[h]}. If you
-  want to give \latex/ a chance to put the float on a page of floats, you
-  must also specify ``p''.
-\item The placement would violate the constraints imposed by \latex/'s
-  float placement parameters. This is one of the most occurring causes and
-  it can easily be corrected by changing the parameters. Here is a list of
-  them:
-\end{enumerate}
-\begin{center}
-\CmdIndex{topfraction}
-\CmdIndex{bottomfraction}
-\CmdIndex{textfraction}
-\CmdIndex{floatpagefraction}
-\TTindex{topnumber}
-\TTindex{bottomnumber}
-\TTindex{totalnumber}
-  \begin{tabular}{>{\tt}llc}
-    \hline
-    \multicolumn{3}{c}{Counters -- change with \Cmd{setcounter}}\\
-    \hline
-    topnumber & max. number of floats at top of page & 2 \\
-    bottomnumber & max. number of floats at bottom of page & 1 \\
-    totalnumber &  max. number of floats on a page & 3\\
-    \hline
-    \multicolumn{3}{c}{Other -- change with \Cmd{renewcommand}}\\
-    \hline
-    \bs topfraction & max fraction of page for floats at top & 0.7 \\
-    \bs bottomfraction & max fraction of page for floats at bottom & 0.3 \\
-    \bs textfraction & min fraction of page for text & 0.2 \\
-    \bs floatpagefraction & min fraction of floatpage that should have
-    floats  & 0.5 \\ 
-    \hline
-  \end{tabular}
-\end{center}
-
-There are also some others for double column floats in two-column documents.
-
-The values in the righthand column are the defaults for the standard
-\latex/ classes. Other classes could use different defaults. As you see
-with the default values a float will not be put in the bottom of a page if
-its height is more than 30\% of the page height. So if you specify [hb] for
-a float which is taller it has to move to a float page. But if it is less
-than 50\% of the page height it will have to wait until some more floats
-are given before a float page can be filled to satisfy the
-\Cmd{floatpagefraction} parameter. If you have this kind of behaviour you
-can easily adapt the parameters, e.g. with:
-\begin{verbatim}
-\renewcommand{\textfraction}{0.05}
-\renewcommand{\topfraction}{0.95}
-\renewcommand{\bottomfraction}{0.95}
-\renewcommand{\floatpagefraction}{0.35}
-\setcounter{totalnumber}{5}
-\end{verbatim}
-You may want to be careful not to make \Cmd{floatpagefraction} too small,
-otherwise you may get too many small floatpages.
-
-You can force \latex/ to ignore most of the parameters for one specific float
-occurrence by
-including an exclamation mark (!) in the placement parameters, e.g.
-\begin{verbatim}
-\begin{figure}[!htb]
-\end{verbatim}
-
-Floats which contain a ``\texttt{t}'' in the position parameter could be
-placed before the place where they are referenced (but on the same page).
-This is normal behaviour for \latex/ but some people just don't like it.
-There are a number of ways to prevent this: 
-\begin{enumerate}
-\item Of course deleting the ``\texttt{t}'' will help, but in general this is
-  undesirable, as you may want the float to be placed at the top of the
-  next page.
-\item use the \texttt{flafter} package which causes floats never to be
-  placed ``backwards''.
-\item use the command \Cmd{suppressfloats[t]}.  This
-  command will cause floats for the top position \emph{on this page} to be
-  moved to the next page. This can also be done with \texttt{[b]} or
-  without parameter for all floats on this page.
-\end{enumerate}
-
-If in spite of all your attempts \latex/ still moves your floats to the end
-of the document or the end of a chapter, you can insert a \Cmd{clearpage}
-command. This will start a new page and insert all pending floats before
-continueing. If it is undesirable to have a pagebreak you can use the
-\textsf{afterpage} package and the following command:
-\begin{verbatim}
-\afterpage{clearpage}
-\end{verbatim}
-
-This will wait until the current page is finished and then flush all
-outstanding floats. In some pathological circumstances \texttt{afterpage}
-may give strange results, however.
-
-Finally, if you want a float only at the place where you define it, without
-\latex/ moving it whatsoever, you can use the \textsf{float} package and
-give the command:
-\begin{verbatim}
-\restylefloat{figure}
-\end{verbatim}
- in the preamble. Now you will be able to
-specify \texttt{[H]} as the position parameter, which will mean ``HERE and only
-HERE''. This may cause an unwanted page break however. 
-If you want to avoid the unwanted pagebreak, i.e. let
-\LaTeX{} move the float only if it doesn't fit on the page, then use the
-\textsf{afterpage} package with:
-\begin{verbatim}
-\afterpage{\clearpage \begin{figure}[H] ... \end{figure}}
-\end{verbatim}
-
-Complaints from \latex/ about ``Too many floats'' are usually caused by one
-of the above problems: floats not being able to be placed and \latex/
-collecting too many of them. The solutions given above, especially those
-with \Cmd{clearpage} in them will usually help. In some cases there
-really are too many floats, as \latex/ has a limited number of ``boxes'' to
-store the floats. The package \textsf{morefloats} can be used to increase
-this number. If you need still more then you must edit a private copy of
-this file, but even then there will be some limit that you cannot pass.
-Then your only resort will be to change your document.
-
-\section{Multipage Floats}
-
-\LaTeX's floats cannot be split across pages. Sometimes, however, you want
-to have a table or figure that doesn't fit on one page. The easiest way is
-to split these into multiple table or figure environments, but this has a
-number of undesirable effects:
-\begin{itemize}
-\item Where do you split it? This is in general more difficult for tables
-  than for figures.
-\item How do you keep them together?
-\item You don't want more than one entry in the list of figures/tables.
-\end{itemize}
-
-Although these problems are not fully solvable in all cases, here are a
-couple of suggestions:
-
-
-\subsection{Tables}
-
-For tables longer than a page you can use the \texttt{longtable} package.
-\TTindex{longtable}
-This package defines a \texttt{longtable} environment that is a kind of
-amalgamation of \texttt{table} and \texttt{tabular}. It has approximately
-the same syntax as the  \texttt{tabular} environment, but it adds some
-features of \texttt{table}, like captions. Longtables will be automatically
-split when they don't fit on the page. And they will be entered in the list
-of tables when a caption is given. They will not float, however, and cannot
-be used inside a float environment. This could mean that another
-\texttt{table} environment, which was defined before the
-\texttt{longtable}, will float past it, and therefore the numbers may get
-out of order. Another problem could be that the \texttt{longtable} starts
-rather far down the page, which isn't a pleasant sight. If you want the
-\texttt{longtable} to start at the top of the page, the best thing to do is
-to include it in an \Cmd{afterpage} command (using the \texttt{afterpage}
-package). As a \texttt{longtable} is by definition large, it is best to put
-it in a separate file, and \Cmd{input} it in the \Cmd{afterpage} command:
-\CmdIndex{afterpage}
-\begin{verbatim}
-\afterpage{\input{mytable}}
-\end{verbatim}
-\begin{verbatim}
-\afterpage{\clearpage\input{mytable}}
-\end{verbatim}
-The last form has the additional advantage that most of the outstanding
-floats will be printed first.
-
-
-\subsection{Figures}
-
-There isn't an equivalent \texttt{longfigure} solution, so for figures you
-will usually have to split it yourself. In general this is less of a
-problem. However, the problem you get now is how to keep them together,
-i.e. how to get the parts on subsequent pages, and how to get a single
-entry in the list of figures.
-
-You will have to split the figure into pieces and put each part
-in a separate \texttt{figure} environment. To keep them together it is best
-to use only the \texttt{[p]} placement, so that they will be put on
-floatpages. As they are bigger than a page this is appropriate. The first
-part would then get a \Cmd{caption}, the subsequent parts would be used
-without a caption. If you want to add a caption-like text, enter it as
-normal text rather than a \Cmd{caption}, so that it will not be entered in
-the list of figures. It may also be desirable to issue a \Cmd{clearpage}
-first, just like we did for the \texttt{longtable}, and to encapsulate this
-in the \Cmd{afterpage} command. E.g.
-\begin{verbatim}
-\afterpage{\clearpage\input{myfigure}}
-\end{verbatim}
-where \texttt{myfigure.tex} contains:
-\begin{verbatim}
-\begin{figure}[p]
-\includegraphics{myfig1.eps}
-\caption{This is a multipage figure}
-\label{fig:xxx}
-\end{figure}
-\begin{figure}[p]
-\includegraphics{myfig2.eps}
-\begin{center}
-Figure~\ref{fig:xxx} (continued)
-\end{center}
-\end{figure}
-\end{verbatim}
-
-You have to make sure that the last part is big enough, otherwise \LaTeX{}
-could decide to postpone it until it has collected some more floats. This
-can be done either by making the figure big enough (e.g. by adding some
-\Cmd{vspace}), or by tweaking the \Cmd{floatpagefraction} 
-\CmdIndex{floatpagefraction} parameter.
-
-If you want your multipage figure to start at a lefthand-side
-(even-numbered) page you can use a test in the \Cmd{afterpage} command
-(using the \texttt{ifthen} package):
-\begin{verbatim}
-\afterpage{\clearpage
-\ifthenelse{\isodd{\value{page}}{\afterpage{\input{myfigure}}} % odd page
-    {\input{myfigure}}}} % even page
-\end{verbatim}
-If there are too many floats on the skipped page, this may still fail to
-start your multipage figure on an even page, however.
-
-\section{Contact information}
-
-Piet van Oostrum\\
-E-mail: piet at vanoostrum.org \\
-WWW: http://piet.vanoostrum.org
-
-\section{Version information}
-\begin{itemize}
-\item  Version 1.0. March 11,  2003. This is the version that was distributed for a 
-  long time on CTAN. Version history before this has been lost. 
-\item Version 2.0. August 27, 2016:
-  \begin{itemize}
-  \item Removed references to fixmarks.sty as that is no longer used.
-  \item References to older \LaTeX{} versions removed.
-  \item Removed obsolete source code of \texttt{extramarks.sty}
-  \item Changed font commands to \Cmd{textbf} and \Cmd{textsl}.
-  \item Added description of the \Cmd{fancy\ldots offset} commands.
-  \item Added various \Cmd{\ldots xmark} commands from \texttt{extramarks.sty}.
-  \item Various corrections applied.
-  \item Updated contact information.
-  \item Added Version information. :)
-  \end{itemize}
-\item Version 2.1. August 28...., 2016:
-  \begin{itemize}
-  \item Explain what the top-marks are.
-  \end{itemize}
-\item Version 2.1. Sept. 6, 2016
-  \begin{itemize}
-  \item Add \verb|\string| to special indexing commands to get a neater index file.
-  \item Add a decorative headrule example
-  \end{itemize}
-
-\end{itemize}
-
-\printindex
-
-\end{document}
-
-
-% Local Variables:
-% mode: latex
-% TeX-master: t
-% End:

Added: trunk/Master/texmf-dist/source/latex/fancyhdr/fancyhdr.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/fancyhdr/fancyhdr.dtx	                        (rev 0)
+++ trunk/Master/texmf-dist/source/latex/fancyhdr/fancyhdr.dtx	2019-01-31 22:39:45 UTC (rev 49886)
@@ -0,0 +1,3535 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 2016 by Piet van Oostrum <piet at vanoostrum.org>
+% -------------------------------------------------------
+% 
+% This file may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in:
+%
+%    http://www.latex-project.org/lppl.txt
+%
+% and version 1.3 or later is part of all distributions of LaTeX 
+% version 2005/12/01 or later.
+%
+% \fi
+%
+% \iffalse
+%<*driver>
+\ProvidesFile{\jobname.dtx}
+%</driver>
+%
+%    \begin{macrocode}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\NeedsTeXFormat{LaTeX2e}
+%<fancyhdr>\ProvidesPackage{fancyhdr}%
+%<fancyheadings>\ProvidesPackage{fancyheadings}
+%<extramarks>\ProvidesPackage{extramarks}
+%<fancyhdr|fancyheadings|extramarks>           [2019/01/31 v3.10
+%<fancyhdr>                  Extensive control of page headers and footers]%
+%<fancyheadings>                  Legacy package to call fancyhdr]
+%<extramarks>                  Extra marks for LaTeX]
+%<fancyhdr|extramarks>% Copyright (C) 1994-2019 by Piet van Oostrum <piet at vanoostrum.org>
+%<fancyheadings>% Public domain
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%    \end{macrocode}
+%
+%<*driver>
+\documentclass[a4paper]{ltxdoc}
+\usepackage{multicol}
+\usepackage{float}
+\usepackage{makeidx}
+\usepackage{layout}
+\usepackage{array}
+\usepackage{booktabs}
+\usepackage{boxedminipage}
+\usepackage{fourier-orns}
+\usepackage[T1]{fontenc}
+\usepackage{url}
+\usepackage[fit]{truncate}
+\usepackage{fancyhdr}
+\GetFileInfo{fancyhdr.sty}
+\def\latex/{\protect\LaTeX{}}
+\def\tex/{\TeX}
+\def\ams/{\protect\pAmS}
+\def\pAmS{{\the\textfont2
+        A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}
+\def\amslatex/{\ams/-\latex/}
+\newcommand{\PSNFSS}{{\sf
+    PSNFSS}}
+\newcommand{\bs}{\symbol{'134}}
+\let\environment\texttt
+\let\Package\textsf
+\renewcommand{\partname}{Part}
+\DisableCrossrefs
+\CodelineIndex
+\RecordChanges
+\newcommand\bsbs{\cs{\char`\\}}
+\newcommand{\Cmd}[1]{\texttt{\def\{{\char`\{}\def\}{\char`\}}\bs#1}}
+\newcommand{\CmdIndex}[1]{\index{#1=\string\texttt{\bs#1}}}
+\newcommand{\TTindex}[1]{\index{#1=\string\texttt{#1}}}
+\newcommand{\PSindex}[1]{\index{page style>#1=\string\texttt{#1}}}
+\renewcommand{\topfraction}{0.9}
+\renewcommand{\bottomfraction}{0.9}
+\renewcommand{\textfraction}{0.05}
+\setlength{\emergencystretch}{4em}
+\addtolength{\textheight}{-0.5in} % make it print better on US letter paper
+\makeatletter
+\renewcommand\l at section      {\@dottedtocline{1}{1.5em}{2.3em}}
+\makeatother
+\newenvironment{block}{\vspace{8pt}\noindent\begin{minipage}{\textwidth}}{\end{minipage}\vspace{8pt}}
+\newenvironment{fblock}{\vspace{8pt}\noindent\begin{boxedminipage}{\textwidth}}{\end{boxedminipage}\vspace{8pt}}
+\newcommand{\showrule}{\\[-1.5ex]\noindent\makebox[\textwidth]{\hrulefill}\\[\baselineskip]}
+\newenvironment{xvspace}{\vspace{1ex}}{{\vspace{1ex}}}
+\setcounter{tocdepth}{1}
+
+\begin{document}
+  \DeleteShortVerb{\|}
+  \DocInput{\jobname.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \CheckSum{1045}
+%
+% \CharacterTable
+%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+%   Digits        \0\1\2\3\4\5\6\7\8\9
+%   Exclamation   \!     Double quote  \"     Hash (number) \#
+%   Dollar        \$     Percent       \%     Ampersand     \&
+%   Acute accent  \'     Left paren    \(     Right paren   \)
+%   Asterisk      \*     Plus          \+     Comma         \,
+%   Minus         \-     Point         \.     Solidus       \/
+%   Colon         \:     Semicolon     \;     Less than     \<
+%   Equals        \=     Greater than  \>     Question mark \?
+%   Commercial at \@     Left bracket  \[     Backslash     \\
+%   Right bracket \]     Circumflex    \^     Underscore    \_
+%   Grave accent  \`     Left brace    \{     Vertical bar  \|
+%   Right brace   \}     Tilde         \~}
+%
+% \DoNotIndex{\#,\$,\%,\&,\@,\\,\{,\},\^,\_,\~,\ }
+% \DoNotIndex{\@ne}
+% \DoNotIndex{\advance,\begingroup,\catcode,\closein}
+% \DoNotIndex{\closeout,\day,\def,\edef,\else,\empty,\endgroup}
+%
+% \title{The \Package{fancyhdr} and \Package{extramarks}
+% packages\\{\normalsize version \fileversion.}}
+% \author{Piet van Oostrum\thanks{A considerable part of this documentation was
+%     written by  George
+%     Gr\"atzer (University of Manitoba) in \emph{Notices Amer. Math. Soc.}
+%     Thanks, George!}\\
+%     Dept.\ of Computer Science\thanks{This was my employer at the time I developed this package.
+% I am now retired.}\\
+%   Utrecht University}
+%
+% \maketitle
+% \begin{abstract}
+%   This document describes how to customize the page layout of your LaTeX
+%   documents, i.e how to change page margings and sizes, 
+%   headers and footers, and the
+%   proper placement of figures and tables (collectively called floats) on
+%   the page. 
+% 
+%   This documentation describes version 3.10 or later of the
+% \Package{fancyhdr} and \Package{extramarks} packages. The user
+% documentation is valid for the versions 3.8 or later of the
+% \Package{fancyhdr} package and version 2.1 or later of the
+% \Package{extramarks} package.
+% 
+% \end{abstract}
+% \tableofcontents
+%
+%\part{Introduction}
+% 
+% This document contains four parts:
+%
+% Part I is a short documentation on
+% the user commands of the \Package{fancyhdr} and \Package{extramarks} packages.
+%
+% Part II contains elaborate documentation on page layout in \latex/.
+% This used to be the complete documentation of \Package{fancyhdr} and
+% \Package{extramarks} for several years.
+%
+% Part III contains Questions and Answers.
+%
+% Part IV contains the annotated implementation.
+%
+% \section{Installation}
+% \label{sec:installation}
+% 
+% The preferred way to install this package is with a package installer.
+% If you want to install it by hand, then first run the command
+% \verb+tex fancyhdr.ins+ and then move the files \texttt{fancyhdr.sty},
+% \texttt{extramarks.sty} and \texttt{fancyheadings.sty} to a place
+% where \latex/ can find it, preferably in a directory similar to
+% \texttt{.../texmf/tex/latex/fancyhdr/} in your \tex/ directory tree.
+% 
+% \section{Using \Package{fancyhdr}}
+%
+% The package \Package{fancyhdr} gives you several commands to define
+% headers and footers of the pages in a \latex/ document.
+%
+% \DescribeMacro{\fancyhead}
+% \DescribeMacro{\fancyfoot}
+% \DescribeMacro{\fancyhf}
+% \begin{verbatim}
+% \fancyhead[places]{field}
+% \fancyfoot[places]{field}
+% \fancyhf[places]{field}
+% \end{verbatim}
+% Here \texttt{places} is a comma-separated list of places where
+% \texttt{field} will be placed. There are 12 places defined: Left,
+% Center and Right Headers and Footers, and both can be on Even or Odd
+% pages. Each place therefore has 3 coordinates which are the inital
+% letters of the above description: (1) \texttt{E} or \texttt{O}, (2) \texttt{L}, \texttt{C} or
+% \texttt{R}, (3) \texttt{H} or \texttt{F}. So a place is given with 3
+% letters, like \texttt{EOH}. A missing coordinate means: all
+% possibilities, except for \cs{fancyhead} where \texttt{H} is implied
+% and \cs{fancyfoot} where \texttt{F} is implied.
+% \DescribeMacro{\fancyheadoffset}
+% \DescribeMacro{\fancyfootoffset}
+% \DescribeMacro{\fancyhfoffset}
+% \begin{verbatim}
+% \fancyheadoffset[places]{field}
+% \fancyfootoffset[places]{field}
+% \fancyhfoffset[places]{field}
+% \end{verbatim}
+% These define offsets to let the headers stick into the margin (or to
+% the inside if negative). Places cannot contain the \texttt{C}
+% specifier. See section~\ref{sec:book-examples} for more details.
+% 
+% \DescribeMacro{\headrulewidth}
+% \DescribeMacro{\headrulewidth}
+% \DescribeMacro{\headrule}
+% \DescribeMacro{\footrule}
+% \DescribeMacro{\headwidth}
+% \begin{verbatim}
+% \headrulewidth
+% \footrulewidth
+% \headrule
+% \footrule
+% \headwidth
+% \end{verbatim}
+%
+% \cs{headrulewidth} and \cs{headrulewidth} are macros to define the
+% thickness of a line under the header and above the footer.
+% \cs{headrule} and \cs{footrule} are macros to completely redefines
+% these lines. And \cs{headwidth} is a length parameter that defines the
+% total width of the headers and footers. See sections~\ref{sec:simple},
+% \ref{sec:fancy} and \ref{sec:book-examples} for more details.
+%
+% \DescribeMacro{\iftopfloat}
+% \DescribeMacro{\ifbotfloat}
+% \DescribeMacro{\iffloatpage}
+% \DescribeMacro{\iffootnote}
+% \begin{verbatim}
+% \iftopfloat
+% \ifbotfloat
+% \iffloatpage
+% \iffootnote
+% \end{verbatim}
+%
+% These are macros to detect if there is a float on the top or the bottom
+% of the page, or the page is a float page, or if there is a footnote at
+% the bottom of the page. These can be used to choose different headers
+% and/or footers if these conditions are met. See
+% section~\ref{sec:float} for more details.
+% 
+% \DescribeMacro{\fancypagestyle}
+% \begin{verbatim}
+% \fancypagestyle{pagestyle}{commands}
+% \end{verbatim}
+% This command lets you (re)define page styles for use in special
+% situations. See section~\ref{sec:pagestyle-plain} for more details.
+%
+% \section{Using extramarks}
+% \label{sec:using-extramarks}
+% 
+% The \Package{extramarks} gives you some extra marks in \latex/,
+% besides the normal \cs{leftmark} and \cs{rightmark}, that are defined
+% by the \cs{markboth} and \cs{markright} commands.
+%
+% \DescribeMacro{\firstleftmark}
+% \DescribeMacro{\firstleftmark}
+% \DescribeMacro{\firstrightmark}
+% \DescribeMacro{\lastleftmark}
+% \begin{verbatim}
+% \firstleftmark
+% \lastrightmark
+% \firstrightmark
+% \lastleftmark
+% \end{verbatim}
+%
+% Standard \latex/ has two marks: a left and a right one. The standard
+% command \cs{leftmark} gives you the last left mark on a page, and
+% \cs{rightmark} gives you the first right one. These macros give you
+% also the other combinations, where \cs{firstrightmark} =
+% \cs{rightmark} and \cs{lastleftmark} = \cs{leftmark}. As with the
+% standard marks, these are meant to be used in headers and footers. In
+% other places they will not work properly.
+% \begin{verbatim}
+% \extramarks{aa}{bb}
+% \firstleftxmark
+% \firstrightxmark
+% \topleftxmark
+% \toprightxmark
+% \lastleftxmark
+% \lastrightxmark
+% \firstxmark
+% \lastxmark
+% \topxmark
+% \end{verbatim}
+% The command \Cmd{extramarks\{aa\}\{bb\}} defines two extra marks,
+% similar to the standard ones by \latex/, where \texttt{aa} is the left
+% one and \texttt{bb} is the right one. The other commands are to
+% extract these in the headers and footers, similar to the ones without
+% the \texttt{x}. See sections~\ref{sec:scoop} and \ref{sec:xmarks} for more details.
+%
+% \newpage
+% \part{Page Layout in \LaTeX}
+%
+% \section{Introduction}
+% \label{sec:intro}
+% 
+% A page in a \LaTeX{} document is built from various elements as shown in
+% figure \ref{fig:layout}. 
+% \begin{figure}[htbp]
+%   \begin{center}
+%     \leavevmode
+%     \layout
+%     \vspace{1.5cm}
+%     \caption{Page elements. The values shown are those in effect in the current document, not the defaults.}
+%     \label{fig:layout}
+%   \end{center}
+% \end{figure}
+% \thispagestyle{plain}
+% The body contains the main text of the document
+% together with the so called floats (tables and figures). 
+% 
+% The pages are constructed by \LaTeX's output routine, which is quite
+% complicated and should therefore not be modified. Some of the packages
+% described in this paper contains small modifications to the output routine
+% to accomplish things that cannot be done in another way. You should use
+% these packages to get the desired result rather than fiddling with the
+% output routine yourself.
+% 
+% There are a number of things that you must be aware of:
+% \begin{enumerate}
+% \item The margins on the left are not called \cs{leftmargin}, but
+%   \cs{evensidemargin} (on even-numbered pages) and \cs{oddsidemargin}
+%   (on odd-numbered pages). In one-sided documents 
+%   \cs{oddsidemargin} is used for either.  \cs{leftmargin} is also a valid
+%   \latex/ parameter but it has a different use (namely the indentation of
+%   lists). 
+% \item Most of the parameters should not be changed in the middle of a
+%   document. Some changes might work at a pagebreak. If you want to change
+%   the height of a single page, you can use the \cs{enlargethispage}
+%   command. 
+% \end{enumerate}
+% 
+% The margin notes
+% area contains small pieces of information created by the \cs{marginpar}
+% command. On twosided documents the margin notes appear on the left and right
+% alternatively. The margin notes are not on fixed places with respect to the
+% paper but at approximately the same height as the paragraph in which they
+% appear. Due to the algorithm used to decide the placement of margin notes,
+% in a twosided document unfortunately 
+% they may appear on the wrong side if they are close
+% to a page break.
+% If you want to put information on fixed places in the margins you may use
+% the technique described in sections \ref{sec:movie} and \ref{sec:thumb}.
+% 
+% The first part of this paper describes how to change the header and footer
+% areas. The last part describes how to get your floats at the desired place.
+% 
+% \section{Page headers and footers}
+% 
+% The page headers and footers in \LaTeX{} are defined by the
+% \cs{pagestyle} and \cs{pagenumbering} commands. \cs{pagestyle}
+% defines the general contents of the headers and footers (e.g. where the
+% page number will be printed), while
+% \cs{pagenumbering} defines the format of the page number.
+% \LaTeX{} has four standard page styles:
+% 
+% \begin{center}
+% \noindent
+%   \begin{tabular}{>{\tt}lp{9cm}}
+%   \toprule
+%     empty & no headers or footers \\
+%     plain & no header, footer contains page number centered \\
+%     headings & no footer, header contains name of chapter/section and/or
+%     subsection and page number \\
+%     myheadings & no footer, header contains page number and user
+%     supplied information \\
+%     \bottomrule
+% \end{tabular}
+% \end{center}
+% 
+% Although these are useful styles, they are quite limited. Additional page
+% styles can be defined by defining commands of the form \cs{ps at xxx}. This
+% command is executed when a \Cmd{pagestyle\{xxx\}} is given in the document.
+% The  \cs{ps at xxx} command should define the following 
+% commands for the contents of the headers and footers:
+% 
+% \begin{center}
+%   \noindent
+%   \begin{tabular}{lp{9cm}}
+%   \toprule
+% \cs{@oddhead} & header on odd numbered pages in two-sided documents
+% (on all pages in one-sided) \\
+% \cs{@evenhead} & header on even numbered pages in two-sided documents \\
+% \cs{@oddfoot} & footer on odd numbered pages in two-sided documents
+% (on all pages in one-sided) \\
+% \cs{@evenfoot} & footer on even numbered pages in two-sided documents \\
+% \bottomrule
+% \end{tabular}
+% \end{center}
+% 
+% These are not user commands, but rather ``variables'' that are used by
+% \latex/'s output routine.
+% As the command names contain the character '\texttt{@}', they should
+% be defined in a package file, or otherwise be sandwiched between the commands
+% \cs{makeatletter} and \cs{makeatother}.
+% 
+% The \cs{pagenumbering} command defines the layout of the page number. It
+% has a parameter from the following list:
+% 
+% \begin{center}
+%   \begin{tabular}{>{\tt}ll}
+%   \toprule
+% arabic & arabic numerals \\
+% roman & lower case roman numerals \\
+% Roman & upper case roman numerals \\
+% alph & lower case letter \\
+% Alph & upper case letter \\
+% \bottomrule
+% \end{tabular}
+% \end{center}
+% 
+% The  \Cmd{pagenumbering\{xxx\}} defines the command \cs{thepage} to be the
+% expansion of the page number in the given notation \texttt{xxx}. 
+% The pagestyle command
+% then would include \cs{thepage} in the appropriate place. Additionally
+% the  \cs{pagenumbering} command resets the page number to~1.
+% The  \cs{pagestyle} and  \cs{pagenumbering} apply to the page that is
+% being constructed, so they should be used at a location where it is clear
+% to what page they apply (see section \ref{sec:change}).
+% 
+% 
+% \section{What is \Package{fancyhdr}}
+% 
+% The \Package{fancyhdr} macro package allows you to customize
+% in \latex/ your page headers and footers in an easy way.  You can
+% define:
+% \begin{itemize}
+% \item three-part headers and footers
+% \item decorative lines in headers and footers
+% \item headers and footers wider than the width of the text
+% \item multi-line headers and footers
+% \item separate headers and footers for even and odd pages
+% \item different headers and footers for chapter pages
+% \item different headers and footer on pages with floats
+% \end{itemize}
+% 
+% Of course, you also have complete control over fonts, uppercase
+% and lowercase displays, etc.
+% 
+% \section{Simple use of \Package{fancyhdr}}  To use this package
+% install it is a place where \latex/ can find it (see
+% section~\ref{sec:installation})\footnote{In most modern \tex/
+% installation the package is already included.}, and include in the preamble of your document
+% the commands: 
+% 
+% \PSindex{fancy}
+% \begin{verbatim}
+% \usepackage{fancyhdr}
+% \pagestyle{fancy}
+% \end{verbatim}
+% 
+% We can visualize the page layout we can create with \Package{fancyhdr}
+% as follows:
+% 
+% \begin{fblock}
+% \noindent\makebox[\textwidth]{LeftHeader\hfill
+% CenteredHeader\hfill RightHeader}\showrule
+% \noindent\makebox[\textwidth]{\hfill page body\hfill}\\[\baselineskip]
+% \noindent\makebox[\textwidth]{\hrulefill}
+% \noindent\makebox[\textwidth]{LeftFooter\hfill
+% CenteredFooter\hfill RightFooter}
+% \end{fblock}
+% 
+% The LeftHeader and LeftFooter are left justified; the
+% CenteredHeader and CenteredFooter are centered; the
+% RightHeader and RightFooter are right justified.
+% 
+% We define each of the six ``fields'' and the two decorative lines
+% separately.
+% 
+% \section{A simple example}
+% \label{sec:simple}
+% 
+% K. Grant is writing a report to Dean
+% A. Smith, on ``The performance of new graduates'' with the
+% following page layout:
+% 
+% \begin{fblock}
+% \noindent\makebox[\textwidth]{\hfill\textbf{The performance of new
+% graduates}}\showrule
+% \noindent\makebox[\textwidth]{\hfill page body\hfill}\\[\baselineskip]
+% \noindent\makebox[\textwidth]{\hrulefill}
+% \noindent\makebox[\textwidth]{From: K. Grant\phantom{3}\hfill
+% To: Dean A. Smith\hfill \phantom{From: K. Grant}3}
+% \end{fblock}
+% 
+% \noindent where ``3'' is the page number.  The title: ``The
+% performance of new graduates'' is bold.
+% 
+% This is accomplished by these commands following
+% \Cmd{pagestyle\{fancy\}}\footnote{Note that version 1 of fancyheadings
+% used the \cs{setlength} command to change the \texttt{\bs...rulewidth} parameters.}:
+% \CmdIndex{fancyhead}
+% \CmdIndex{fancyfoot}
+% \CmdIndex{headrulewidth}
+% \CmdIndex{footrulewidth}
+% \begin{verbatim}
+% \fancyhead[L,C]{}
+% \fancyhead[R]{\textbf{The performance of new graduates}}
+% \fancyfoot[L]{From: K. Grant}
+% \fancyfoot[C]{To: Dean A. Smith}
+% \fancyfoot[R]{\thepage}
+% \renewcommand{\headrulewidth}{0.4pt}
+% \renewcommand{\footrulewidth}{0.4pt}
+% \end{verbatim}
+% (The \cs{thepage} macro displays the current page number.
+% \cs{textbf} puts it in bold face.)
+% 
+% This is now fine, except that the first page does not need
+% all these headers and footers.  To eliminate all but the
+% centered page number, issue the command
+% 
+% \CmdIndex{thispagestyle}
+% \begin{verbatim}
+% \thispagestyle{plain}
+% \end{verbatim}
+% after the
+% \Cmd{begin\{document\}}
+% and the
+% \CmdIndex{maketitle}
+% \cs{maketitle}
+% commands.
+% 
+% Alternatively, issue
+% \begin{verbatim}
+% \thispagestyle{empty}
+% \end{verbatim}
+% if you do not want any headers or footers.
+% 
+% In fact the standard \latex/ classes have the command \cs{maketitle}
+% defined in such a way that a \Cmd{thispagestyle\{plain\}} is automatically
+% issued. So if you \emph{do} want the fancy layout on a page containing
+% \cs{maketitle} you must issue a \Cmd{thispagestyle\{fancy\}} after the
+% \cs{maketitle}.
+% 
+% \section{An example of two-sided printing}\label{two-sided}
+% 
+% \TTindex{twoside}
+% Some document classes, such as \verb|book.cls|, print two-sided by default: the even
+% pages and the odd pages have different layouts; other document classes
+% use the \verb|twoside| option to print two-sided.
+% 
+% Now let us print the report two-sided.  Let the above page
+% layout be used for the odd (right-side) pages, and the
+% following for the even (left-side) pages:
+% 
+% \begin{fblock}
+% 
+% \noindent\makebox[\textwidth]{\textbf{The performance of new
+% graduates}\hfill}\showrule
+% \noindent\makebox[\textwidth]{\hfill page body\hfill}\\[\baselineskip]
+% \noindent\makebox[\textwidth]{\hrulefill}
+% \noindent\makebox[\textwidth]{4\phantom{To: Dean A. Smith}\hfill
+%  From: K. Grant\hfill \phantom{4}To: Dean A. Smith}
+% 
+% \end{fblock}
+% \noindent where ``4'' is the page number.
+% 
+% Here are the commands:
+% 
+% \begin{verbatim}
+% \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}
+% \renewcommand{\headrulewidth}{0.4pt}
+% \renewcommand{\footrulewidth}{0.4pt}
+% \end{verbatim}
+% 
+% \CmdIndex{fancyhead}
+% \CmdIndex{fancyfoot}
+% The commands \cs{fancyhead} and \cs{fancyfoot}
+% have an additional parameter between square brackets that specifies
+% for which pages and/or parts of the header/footer they apply. The first
+% \cs{fancyhead} command omits this parameter, and thus applies to all
+% header fields. In general this is only useful to get rid of the defaults or
+% a previous definition, as is done here. Similar the \cs{fancyfoot} command
+% without square brackets clears all footer fields. In this particular
+% example it could be omitted as all footer fields have a value specified.
+% The selectors that can be used
+% between the square brackets are given in figure~\ref{fig:sel}. Selectors can be combined so
+% \Cmd{fancyhead[LE,RO]\{text\}}
+% will define the field for both the left header on even pages and the right
+% header on odd pages. If you don't give an \texttt{E} or \texttt{O} the definition applies to
+% both. Similar for \texttt{LRC}. 
+% The selectors may be given as uppercase or lowercase letters.
+% \begin{figure}[htb]
+%   \begin{center}
+%     \leavevmode
+%     \begin{tabular}{|l|l|}
+%       \hline
+%       E & Even page         \\
+%       O & Odd page          \\
+%       \hline
+%       L & Left field        \\
+%       C & Center field      \\
+%       R & Right field       \\
+%       \hline
+%       H & Header            \\
+%       F & Footer            \\
+%       \hline
+%     \end{tabular}
+%   \end{center}
+%   \caption{Selectors}
+%   \label{fig:sel}
+% \end{figure}
+% 
+% \CmdIndex{fancyhf}
+% There is also a more general command \cs{fancyhf} that you can use to
+% combine the specifications for headers and footers. This allows additional
+% selectors \texttt{H} (header) and \texttt{F} (footer). In fact  \cs{fancyhead} and
+% \cs{fancyfoot} are just  \cs{fancyhf} with \texttt{H} and \texttt{F} pre-specified, respectively.
+% 
+% Again, you may
+% use  \Cmd{thispagestyle\{plain\}} for a simple page layout for
+% page~1.
+% 
+% \section{Redefining page style \texttt{plain}}
+% \label{sec:pagestyle-plain}
+% 
+% Some \latex/ commands, like \cs{chapter}, use the \cs{thispagestyle}
+% command to automatically switch to the \texttt{plain} page style, thus
+% ignoring the page style currently in effect.
+%
+% They do this by issuing a \verb+\thispagestyle{plain}+ command. The most
+% well-known places where this could happen are:
+% \begin{itemize}
+% \item The first pages of chapters in the \texttt{book} and \texttt{report} class
+% \item The first page of a document in the \texttt{article} class when \cs{maketitle} is used
+% \item The first page of an index
+% \end{itemize}
+% but it could happen at other places depending on the class and the packages used.
+%
+% To customize even such pages you must redefine the \texttt{plain}
+% page style. As we indicated before you could do this by defining the
+% \cs{ps at plain} command, but \Package{fancyhdr} gives you an easier way
+% with the \cs{fancypagestyle} command. This command can be used to
+% redefine existing page styles (like \texttt{plain}) or to define new ones,
+% e.g. if part of your document is to use a different page style. This command
+% has two parameters: the first one is the name of the page style to be defined, the
+% second consists of commands that change the headers and/or footers, i.e.
+% \verb|fancyhead| etc. Also allowed are changes to \cs{headrulewidth} and
+% \cs{footrulewidth} or even \cs{headrule} and \cs{footrule}.
+% The (re)defined page style uses the standard
+% \texttt{fancy} definitions, amended by the definitions in the second
+% parameter. In other words, those parts that are not redefined in the
+% second parameter get their value from the \texttt{fancy} definition that
+% is current. In particular, if the second parameter is empty, i.e. given
+% as \verb+{}+, then the new page style is equal to page style
+% \texttt{fancy}.
+%
+%  As an example, let us redefine the \texttt{plain} style so that it will
+% be the same as page style \texttt{fancy}:
+% \begin{verbatim}
+% \fancypagestyle{plain}{}
+% \end{verbatim}
+% Now when these special pages use the \texttt{plain} page style, they use your redefined version.
+%
+% As another example, let us 
+% redefine the \texttt{plain} style for the report in Section~\ref{two-sided} by
+% making the page number bold. 
+% \PSindex{plain}
+% 
+% \begin{verbatim}
+% \fancypagestyle{plain}{%
+% \fancyhf{} % clear all header and footer fields
+% \fancyfoot[C]{\textbf{\thepage}} % except the center
+% \renewcommand{\headrulewidth}{0pt}
+% \renewcommand{\footrulewidth}{0pt}}
+% \end{verbatim}
+% 
+% 
+% \section{The default layout}\label{default}
+% Let us use the \verb|book.cls| documentclass and the default settings for
+% \Package{fancyhdr}; so we only issue the commands
+% 
+% \begin{verbatim}
+% \usepackage{fancyhdr}
+% \pagestyle{fancy}
+% \end{verbatim}
+% and let \Package{fancyhdr} take care of everything.  On the
+% pages where new chapters start, we get a centered page number in
+% the footer; there is no header, and there are no decorative lines.
+% 
+% On an even page, we get the layout:
+% 
+% \begin{fblock}
+% \noindent\makebox[\textwidth]{\textsl{1.2  EVALUATION}\hfill
+%  \textsl{CHAPTER 1. INTRODUCTION}}\showrule
+% \noindent\makebox[\textwidth]{\hfill page body\hfill}\\[\baselineskip]
+% \noindent\makebox[\textwidth]{\hrulefill}
+% \noindent\makebox[\textwidth]{\hfill4\hfill}
+% \end{fblock}
+% 
+% On an odd page, we get the layout:
+% 
+% \begin{fblock}
+% \noindent\makebox[\textwidth]{\textsl{CHAPTER 1. INTRODUCTION}\hfill
+%  \textsl{1.2  EVALUATION}}\showrule
+% \noindent\makebox[\textwidth]{\hfill page body\hfill}\\[\baselineskip]
+% \noindent\makebox[\textwidth]{\hrulefill}
+% \noindent\makebox[\textwidth]{\hfill
+% 3\hfill }
+% \end{fblock}
+% 
+% \noindent where the header text is slanted uppercase.
+% 
+% This default layout is produced by the following commands:
+% \CmdIndex{rightmark}
+% \CmdIndex{leftmark}
+% \begin{verbatim}
+% \fancyhead[LE,RO]{\textsl{\rightmark}}
+% \fancyhead[LO,RE]{\textsl{\leftmark}}
+% \fancyfoot[C]{\thepage}
+% \end{verbatim}
+% 
+% The following settings are used for the decorative lines:
+% 
+% \begin{tabbing}
+% \CmdIndex{headrulewidth}
+% \noindent \cs{headrulewidth}\qquad \qquad \qquad \=0.4\=pt\\
+% \CmdIndex{footrulewidth}
+% \Cmd{footrulewidth}\>0\>pt
+% \end{tabbing}
+% 
+% The header text is turned into all uppercase in \verb|book.cls|.
+% 
+% \section{The scoop on \latex/'s marks}\label{sec:custom}
+% \label{sec:scoop}
+% 
+% Usually, for documents of class \verb|book| and \verb|report|, you may
+% want to use chapter and section information in the headings (chapter only
+% for one-sided printing), and for documents of class \verb|article|,
+% section and subsection information (section only for one-sided
+% printing).  \latex/ uses a marker mechanism to remember the chapter and
+% section (section and subsection) information for a page; this is
+% discussed in detail in \textit{The \latex/ Companion}, Section 4.3.1, or 
+% \textit{The \latex/ Companion, Second Edition}, Section 4.3.4.
+% 
+% There are two ways you can use and change the higher- and lower-level
+% sectioning information available to you.  The macros:
+% \CmdIndex{rightmark}
+% \CmdIndex{leftmark}
+% \cs{leftmark}
+% (higher-level) and \cs{rightmark} (lower-level) contain the information
+% processed by \latex/, and you can use them directly as shown in 
+% Section~\ref{default}.
+% 
+% The \cs{leftmark} contains the \textbf{L}eft argument of the \emph{\textbf{L}ast}
+% \cs{markboth} on the page, the \cs{rightmark} contains the \textbf{R}ight
+% argument of the \emph{fi\textbf{R}st} \cs{markboth} or the only argument of the
+% \emph{fi\textbf{R}st} \cs{markright} on the page. If no marks are present on a
+% page they are ``inherited'' from the previous page.
+% 
+% You can influence how chapter, section, and subsection
+% information (only two of them!) is displayed by redefining the
+% \CmdIndex{chaptermark}
+% \cs{chaptermark},
+% \CmdIndex{sectionmark}
+% \CmdIndex{subsectionmark}
+% \cs{sectionmark}, and \cs{subsectionmark} commands\footnote{There are
+%   similar commands for \texttt{paragraph} and \texttt{subparagraph} but
+%   they are seldom used.}. You must put the redefinition
+% after the first call of \Cmd{pagestyle\{fancy\}} as this
+% sets up the defaults.
+% 
+% Let us illustrate this with chapter info. It is made up of three parts:
+% \begin{itemize}
+% \CmdIndex{thechapter}
+% \item  the number (say, 2), displayed by the macro \cs{thechapter}
+% \item  the name (in English, Chapter), displayed by the macro
+% \CmdIndex{chaptername}
+%    \cs{chaptername}
+% \item  the title, contained in the  argument of
+%    \cs{chaptermark}.
+% \end{itemize}
+% 
+% Figure~\ref{fig:markers} shows some variants for ``Chapter 2.\ Do it now''
+% (the last example is appropriate in some non-English languages). The \%
+% signs at the end of the lines are to prevent unwanted space. Normally you
+% would continue the lines and remove these \% signs\footnote{the \texttt{\bs
+%     MakeUppercase} command is used in \latex/ to generate uppercase text,
+%   while in \LaTeX{} 2.09 \cs{uppercase} is used. The difference is
+%   that \cs{MakeUppercase} also deals with non-ASCII letters.
+%   Fancyhdr defines \cs{MakeUppercase} to be an alias for
+%   \cs{uppercase} if it isn't defined.}.
+% 
+% \begin{figure}[tb]
+% \CmdIndex{chaptermark}
+% \CmdIndex{uppercase}
+% \CmdIndex{MakeUppercase}
+% \setlength{\columnsep}{20pt}\small
+% \begin{multicols}{2}
+% \noindent Code:\\
+% \mbox{}\\
+% \verb|\renewcommand{\chaptermark}[1]{%|\\
+% \verb| \markboth{\chaptername|\\
+% \verb| \ \thechapter.\ #1}{}}|\\
+% \mbox{}\\
+% \verb|\renewcommand{\chaptermark}[1]{%|\\
+% \verb| \markboth{\MakeUppercase{%|\\
+% \verb| \chaptername}\ \thechapter.%|\\
+% \verb| \ #1}{}}|\\
+% \mbox{}\\
+% \verb|\renewcommand{\chaptermark}[1]{%|\\
+% \verb| \markboth{\MakeUppercase{%|\\
+% \verb| \chaptername\ \thechapter.%|\\
+% \verb| \ #1}}{}}|\\
+% \mbox{}\\
+% \verb|\renewcommand{\chaptermark}[1]{%|\\
+% \verb| \markboth{#1}{}}|\\
+% \mbox{}\\
+% \verb|\renewcommand{\chaptermark}[1]{%|\\
+% \verb| \markboth{\thechapter.\ #1}{}}|\\
+% \mbox{}\\
+% \verb|\renewcommand{\chaptermark}[1]{%|\\
+% \verb| \markboth{\thechapter.%|\\
+% \verb| \ \chaptername.\ #1}{}}|\\
+% Prints:\\
+% \mbox{}\\
+% Chapter 2.\ Do it now\\
+% \mbox{}\\
+% \mbox{}\\
+% \mbox{}\\
+% CHAPTER 2.\ Do it now\\
+% \mbox{}\\
+% \mbox{}\\
+% \mbox{}\\
+% \mbox{}\\
+% CHAPTER 2.\ DO IT NOW\\
+% \mbox{}\\
+% \mbox{}\\
+% \mbox{}\\
+% \mbox{}\\
+% Do it now\\
+% \mbox{}\\
+% \mbox{}\\
+% 2.\ Do it now\\
+% \mbox{}\\
+% \mbox{}\\
+% 2.\ Chapter.\ Do it now\\
+% \mbox{}\\
+% \end{multicols}
+% \caption{Marker variants}\label{fig:markers}
+% \end{figure}
+% 
+% 
+% For the lower-level sectioning information, do the same with
+% \cs{markright}.
+% 
+% So if ``Section 2.2.\ First steps'' is the current section,
+% then
+% 
+% \begin{verbatim}
+% \renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
+% \end{verbatim}
+% will give
+%    ``2.2.\ First steps''
+% 
+% Redefining the \cs{chaptermark} and \cs{sectionmark} commands may
+% not eliminate all uppercaseness. E.g.\ the bibliography will have a title
+% \CmdIndex{uppercase}
+% \index{BIBLIOGRAPHY}
+% of \textsc{bibliography} in the header, as the \cs{MakeUppercase} is
+% explicitly given in the definition of \cs{thebibliography}. Similar for
+% \index{INDEX}
+% \textsc{index} etc.\ If you don't want to redefine these commands, you can
+% use the \cs{nouppercase} command that \Package{fancyhdr} makes available in the header
+% and footer fields. Note that this may screw other things, like uppercase
+% roman numerals in your headers, so it should be used with care. Essentially
+% this command typesets its argument in an environment where
+% \cs{MakeUppercase} and \cs{uppercase} are changed into do-nothing operations.
+% 
+% 
+% \begin{verbatim}
+% \fancyhead[L]{\nouppercase{\rightmark}}
+% \fancyhead[R]{\nouppercase{\leftmark}}
+% \end{verbatim}
+% 
+% 
+% It should be noted that the \latex/ marking mechanism works fine with
+% chapters (which always start on a new page) and sections (which are
+% reasonably long).  It does not work quite as well with short sections and
+% subsections.  This is a problem with \latex/, not with
+% \Package{fancyhdr}.
+% 
+% As an example let's take a page layout where the leftmarks are generated by
+% the sections and the rightmarks by the subsections (as is default in the
+% \texttt{article} class). Take a page with some short sections, e.g. 
+% 
+% \begin{samepage}
+% \noindent Section 1.\\
+% subsection 1.1\\
+% subsection 1.2\\
+% Section 2.  
+% \end{samepage}
+% 
+% As the leftmark contains the \emph{last} mark of the page it will be
+% ``Section 2.'', and the rightmark will be ``subsection 1.1'' as it will be
+% the \emph{first} mark of the page. So the page header info will combine 
+% section 2 with subsection 1.1 which isn't very nice.
+% The best you can do in these cases is use only the \cs{rightmark}s and
+% redefine \cs{sectionmark} accordingly. A \latex/ command
+% \CmdIndex{firstleftmark}
+% \cs{firstleftmark} would also be a nice addition (see the 
+% \Package{extramarks} package in section~\ref{sec:xmarks}).
+% 
+% Another problem with the marks in the standard \latex/ classes is that the
+% higher level sectioning commands (e.g. \cs{chapter}) call
+% \cs{markboth} with an empty right argument. This means that on the first
+% page of a chapter (or a section in article style) the \cs{rightmark}
+% will be empty. The underlying problem is that the \tex/ machinery has
+% only one \cs{mark}. All the marks must be packed together in
+% this one. So there are no independent left or right marks. That also
+% applies to the extra marks as described in section~\ref{sec:xmarks}.
+% If this is a problem you must manually insert extra
+% \cs{markright} commands or redefine the \cs{chaptermark}
+% (\cs{sectionmark}) commands to issue a \cs{markboth} command with
+% two decent parameters.
+% 
+% As a final remark you should also note that the \verb|*| forms of the
+% \cs{chapter} etc.\ commands do \emph{not} call the mark commands. So if
+% you want your preface to set the header info but not be numbered nor be put in
+% the table of contents, you must issue the \cs{markboth} command
+% yourself, e.g.
+% 
+% \begin{verbatim}
+% \chapter*{Preface\markboth{Preface}{}}
+% \end{verbatim}
+% 
+% Entering the \cs{markboth} command inside the \cs{chapter*} insures
+% that the mark will not be separated from the title by a page break. Of
+% course with \cs{chapter*} this wouldn't be  a problem if you put the mark
+% command after the chapter title, as the \cs{chapter*} command starts at a
+% new page. However with a \cs{section*} it could be dangerous to say:
+% 
+% \begin{verbatim}
+% \section*{Preface}
+% \markboth{Preface}{}
+% \end{verbatim}
+% as a page break may occur between the two commands. Therefore to be
+% safe, put the \cs{mark...} command inside the \cs{section} command.
+%
+% You have to be careful, however, if you do this with a non-starred
+% sectioning command. These will be put in the Table of Contents (if you
+% have one), and this means the entries are ``moving'' (they move to the
+% Table of Contents). The \cs{mark...} commands are ``fragile'',
+% which means they will break when moved. Therefore they must be
+% \DescribeMacro{\protect}
+% \CmdIndex{protect}
+% protected with the \cs{protect} command, for example
+% 
+% \begin{verbatim}
+% \chapter{Preface\protect\markboth{Preface}{Preface}}
+% \end{verbatim}
+% In this example we give \cs{markboth} two non-empty arguments
+% otherwise it would make no sense to use the \cs{markboth} command
+% inside the \cs{chapter} command. It is harmless to use the
+% \cs{protect} command when it is not really necessary.
+% 
+% \section{Dictionary style headers}
+% 
+% \index{dictionary}
+% \index{concordance}
+% Dictionaries and concordances usually have a header containing the first
+% word defined on the page or both the first and the last words. This can
+% easily be accomplished with \Package{fancyhdr} and \latex/'s
+% \texttt{mark} mechanism. Of course if you use the marks for dictionary
+% style headers, you cannot use them for chapter and section information, so
+% if there are also chapters and sections present, you must redefine the
+% \cs{chaptermark} and \cs{sectionmark} to make them harmless:
+% 
+% \begin{verbatim}
+% \renewcommand{\chaptermark}[1]{}
+% \renewcommand{\sectionmark}[1]{}
+% \end{verbatim}
+% 
+% Now you do a \Cmd{markboth\{\#1\}\{\#1\}} for each dictionary or concordance
+% entry \verb|#1| and use \cs{rightmark} for the first entry defined on
+% the page and \cs{leftmark} for the last one.
+% 
+% If you want to use a header entry of the form \textsf{firstword--lastword}
+% it would be nice if this would be reduced to just the form
+% \textsf{firstword} if both are the same. This could happen if there is just
+% one entry on the page. In this case a test must be made to check if the
+% marks are the same.  However, \tex/'s marks are strange beasts, which
+% cannot be compared out of the box with the plain \tex/ \cs{if} commands.
+% \TTindex{ifthen}
+% Fortunately the \Package{ifthen} package works well:
+% 
+% \begin{verbatim}
+% \newcommand{\mymarks}{
+%   \ifthenelse{\equal{\leftmark}{\rightmark}}
+%     {\rightmark} % if equal
+%     {\rightmark--\leftmark}} % if not equal
+% \fancyhead[LE,RO]{\mymarks}
+% \fancyhead[LO,RE]{\thepage}
+% \end{verbatim}
+% 
+% \section{Fancy layouts}
+% \label{sec:fancy}
+% 
+% \index{multi-line}
+% You can make a multi-line field with the \bsbs{} command.  It is also
+% possible to put extra space in a field with the \cs{vspace} command.
+% Note that if you do this you will probably have to increase the height of
+% \CmdIndex{headheight}
+% \CmdIndex{footskip}
+% the header (\cs{headheight}) and/or of the footer (\cs{footskip}),
+% \index{Overfull \verb+\vbox+ \ldots}
+% otherwise you may get error messages ``Overfull \cs{vbox} \ldots has
+% occurred while \cs{output} is active''^^A
+% \footnote{If you use \texttt{11pt} or \texttt{12pt} you will probably also
+%   have to do this, because \LaTeX's defaults are quite small}.
+% See Section 4.1 of the \latex/ \emph{Companion} for detail.
+% 
+% For instance, the following code will place  the section title and the
+% subsection title of an article in two lines in the upper right hand
+% corner:
+% 
+% \begin{verbatim}
+% \documentclass{article}
+% \usepackage{fancyhdr}
+% \pagestyle{fancy}
+% \addtolength{\headheight}{\baselineskip}
+% \renewcommand{\sectionmark}[1]{\markboth{#1}{}}
+% \renewcommand{\subsectionmark}[1]{\markright{#1}}
+% \fancyhead[R]{\leftmark\\\rightmark}
+% \end{verbatim}
+% 
+% You can also customize the decorative lines.  You can make the decorative
+% line in the header quite thick with
+% 
+% \CmdIndex{headrulewidth}
+% \begin{verbatim}
+% \renewcommand{\headrulewidth}{0.6pt}
+% \end{verbatim}
+% or you can make the decorative line in the footer disappear with
+% \CmdIndex{footrulewidth}
+% \begin{verbatim}
+% \renewcommand{\footrulewidth}{0pt}
+% \end{verbatim}
+% 
+% The decorative lines, themselves, are defined in the two macros
+% \cs{headrule} and \cs{footrule}.  For instance,
+% if you want a dotted line rather than a solid line in the header,
+% redefine the command \cs{headrule}:
+% 
+% \begin{verbatim}
+% \renewcommand{\headrule}{\vbox to 0pt{\hbox
+%     to\headwidth{\dotfill}\vss}}
+% \end{verbatim}
+%
+% The redefined \cs{headrule} should preferably take up no vertical space, as in the example above, and as in the standard definition. If it does take vertical space, the header may come too close to the text, or even intrude in the text. In that case \Package{fancyhdr} will give you a warning that \cs{headheight} is too small. Like
+% \begin{verbatim}
+% Package Fancyhdr Warning: \headheight is too small (12.0pt):
+% Make it at least 14.0pt.
+% We now make it that large for the rest of the document.
+% This may cause the page layout to be inconsistent, however.
+% \end{verbatim}
+% As the warning says, \Package{fancyhdr} will change the
+% \cs{headheight} itself, but this is too late for the current page. For
+% subsequent pages it will have effect, but now the text on these pages
+% will come out lower than on this page. So you are strongly advised to
+% redefine \cs{headheight} in the preamble, like this:
+% \begin{verbatim}
+% \setlength\headheight{14pt}
+% \end{verbatim}
+% A similar change would be necessary for \cs{footskip} if the footer comes out too tall.
+%
+% As an alternative to changing \cs{headrulewidth} to 0 to have the rule
+% disappear, you can also make it empty with
+% \begin{verbatim}
+% \renewcommand{\headrule}{}
+% \end{verbatim}
+% Visually this makes no difference, but it is more difficult to restore
+% it later to its default value.
+% 
+% Finally, let us make a real `decorative' line\footnote{Based upon an idea by Wayne Chan.}.
+% \begin{verbatim}
+% \usepackage{fourier-orns}
+% ...
+% \renewcommand\headrule{%
+%       \hrulefill
+%       \raisebox{-2.1pt}
+%           {\quad\decofourleft\decotwo\decofourright\quad}%
+%       \hrulefill}
+% \end{verbatim}
+% This gives us the following headrule:
+% 
+% \noindent\makebox[\textwidth]{\hrulefill
+% \raisebox{-2.1pt}[10pt][10pt]{\quad\decofourleft\decotwo\decofourright\quad}\hrulefill}
+%
+% Note that we haven't taken care to make this decorative line occupy
+% zero vertical space. The consequence is that it will extend towards
+% the text and that we will get the warning about \cs{headheight} too small. So we
+% should change \cs{headheight} as given above. Another problem is that
+% the distance between the line and the header text is quite big. We can
+% reduce this by putting a negative \cs{vspace} above it, like
+% \begin{verbatim}
+% \renewcommand\headrule{%
+%       \vspace{-6pt}
+%       \hrulefill
+%       \raisebox{-2.1pt}
+%           {\quad\decofourleft\decotwo\decofourright\quad}%
+%       \hrulefill}
+% \end{verbatim}
+%
+% We can use the same code for the \cs{footrule}, but we wouldn't need
+% the \cs{vspace}. If you want to change the distance between that
+% decorative line and the footer text you need to adjust the
+% \CmdIndex{footruleskip}
+% \DescribeMacro{\footruleskip}
+% parameter \cs{footruleskip}. It
+% defines the distance between the decorative line in the footer and the top
+% of the footer text line. By default it is set to 30\% of the normal line
+% distance. You may want to adjust it if you use unusally large or small
+% fonts in the footer. Change it with \cs{renewcommand}.
+% 
+% \section{Two book examples}
+% \label{sec:book-examples}
+% 
+% The following definitions give an approximation of the style
+% used in L. Lamport's \latex/ book.
+% 
+% Lamport's header overhangs the outside margin.  This is done as follows.
+% 
+% The width of headers and footers is \cs{headwidth}, which by default
+% equals the width of the text: \cs{textwidth}. You can make the width
+% \CmdIndex{headwidth}
+% wider (or narrower) by redefining \cs{headwidth} with the
+% \cs{setlength} and \cs{addtolength} commands.
+% To overhang the outside margin where the marginal notes are
+% \CmdIndex{marginparsep}
+% \CmdIndex{marginparwidth}
+% printed, add both \cs{marginparsep} and \cs{marginparwidth} to
+% \cs{headwidth} with the commands:
+% 
+% \begin{verbatim}
+% \addtolength{\headwidth}{\marginparsep}
+% \addtolength{\headwidth}{\marginparwidth}
+% \end{verbatim}
+% 
+% \begin{flushleft}
+% You must issue these commands \emph{after} the first
+% \Cmd{pagestyle\{fancy\}} command as this
+% will establish the default for \cs{headwidth}\footnote{In version 2 or
+% later of \Package{fancyhdr} it is usually safe to do it before, but it is still
+%   advised to do after.}.
+% \end{flushleft}
+% 
+% And now a complete definition of Lamport's book style:
+% 
+% \begin{verbatim}
+% \documentclass{book}
+% \usepackage{fancyhdr}
+% \pagestyle{fancy}
+% \addtolength{\headwidth}{\marginparsep}
+% \addtolength{\headwidth}{\marginparwidth}
+% \renewcommand{\chaptermark}[1]{\markboth{#1}{}}
+% \renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
+% \fancyhf{}
+% \fancyhead[LE,RO]{\textbf{\thepage}}
+% \fancyhead[LO]{\textbf{\rightmark}}
+% \fancyhead[RE]{\textbf{\leftmark}}
+% \fancypagestyle{plain}{%
+%    \fancyhead{} % get rid of headers
+%    \renewcommand{\headrulewidth}{0pt} % and the line
+% }
+% \end{verbatim}
+% \PSindex{plain}
+% 
+% Notice that the \cs{chaptermark} and \cs{sectionmark} commands have
+% been redefined to eliminate the chapter numbers and the uppercaseness.
+% 
+% For more control about the horizontal position of the headers and/or
+% footers, \Package{fancyhdr} has additional commands to specify the
+% offset of the header and/or footer elements. Use
+% \Cmd{fancyhfoffset[place]\{length\}}  
+% \CmdIndex{fancyhfoffset} 
+% to offset one or more elements. The \texttt{place} parameter is like
+% the optional parameter of \cs{fancyhf}, like \texttt{L R E O}, except
+% that \texttt{C} cannot be used. It specifies for which elements the
+% offset should be applied. The \texttt{length} parameter specifies the
+% actual offset. Positive values move the element outward (into the
+% margin), negative values inward. There are also specialised commands
+% \cs{fancyheadoffset} and \cs{fancyfootoffset}, which have the
+% \texttt{H} and \texttt{F} parameter pre-applied, respectively. 
+% \CmdIndex{fancyheadoffset} 
+% \CmdIndex{fancyfootoffset} 
+% 
+% When you use these commands, \latex/ will recalculate \cs{headwidth},
+% based on the given parameters. 
+% 
+% So the above example could also have been done with (N.B. You can only
+% use such an expression as a length parameter if the \Package{calc}
+% package is used): 
+% 
+% \begin{verbatim}
+% \fancyheadoffset[LE,RO]{\marginparsep+\marginparwidth}
+% \end{verbatim}
+% 
+% For the second example, we take the \amslatex/ book\footnote{George Gratzer,
+% \textit{Math into LaTeX, An Introduction to \LaTeX{} and \amslatex/}, Birkhauser, Boston.}.
+% 
+% Chapter pages have no headers or footers.  So we declare
+% 
+% \begin{verbatim}
+% \thispagestyle{empty}
+% \end{verbatim}
+% for every chapter page, and we do not need to redefine plain.
+% 
+% Chapter and section titles appear in the form: 2.\ DO IT NOW, so we have
+% to redefine \cs{chaptermark} and \cs{sectionmark} as follows (see
+% Section~\ref{sec:custom}):
+% 
+% \begin{verbatim}
+% \renewcommand{\chaptermark}[1]%
+%    {\markboth{\MakeUppercase{\thechapter.\ #1}}{}}
+% \renewcommand{\sectionmark}[1]%
+%    {\markright{\MakeUppercase{\thesection.\ #1}}}
+% \end{verbatim}
+% 
+% In an even-header, the page number is printed as the LeftHeader and
+% the chapter info as the RightHeader; in an odd-header, the section info
+% is printed as the LeftHeader and the page number as the RightHeader.  The
+% CenteredHeaders are empty.  There are no footers.
+% 
+% There is a decorative line in the header.  It is 0.5pt wide, so we need
+% the commands:
+% 
+% \begin{verbatim}
+% \renewcommand{\headrulewidth}{0.5pt}
+% \renewcommand{\footrulewidth}{0pt}
+% \end{verbatim}
+% 
+% The font used in the headers is 9 pt bold Helvetica.  The \PSNFSS\ system
+% by Sebastian Rahtz uses the short (Karl Berry) name \verb|phv| for
+% Helvetica, so this font is selected with the commands:
+% \begin{verbatim}
+% \fontfamily{phv}\fontseries{b}\fontsize{9}{11}\selectfont
+% \end{verbatim}
+% (See Sections 7.6.1 and 11.9.1 of the \latex/ \emph{Companion}.)
+% Let us define a shorthand for this:
+% \begin{verbatim}
+% \newcommand{\helv}{%
+%    \fontfamily{phv}\fontseries{b}\fontsize{9}{11}\selectfont}
+% \end{verbatim}
+% 
+% Now we are ready for the page layout:
+% 
+% \begin{verbatim}
+% \documentclass{book}
+% \usepackage{fancyhdr}
+% \pagestyle{fancy}
+% \renewcommand{\chaptermark}[1]%
+%    {\markboth{\MakeUppercase{\thechapter.\ #1}}{}}
+% \renewcommand{\sectionmark}[1]%
+%    {\markright{\MakeUppercase{\thesection.\ #1}}}
+% \renewcommand{\headrulewidth}{0.5pt}
+% \renewcommand{\footrulewidth}{0pt}
+% \newcommand{\helv}{%
+%    \fontfamily{phv}\fontseries{b}\fontsize{9}{11}\selectfont}
+% \fancyhf{}
+% \fancyhead[LE,RO]{\helv \thepage}
+% \fancyhead[LO]{\helv \rightmark}
+% \fancyhead[RE]{\helv \leftmark}
+% \end{verbatim}
+% 
+% 
+% \section{Special page layout for float pages}
+% \label{sec:float}
+% 
+% \index{float page}
+% Some people want to have a special layout for float pages (pages only
+% containing floats). As these pages
+% are generated autonomically by \latex/, the user doesn't have any control
+% over them. There is no \cs{thispagestyle} for float pages and any change
+% of the page style will at least also affect the page before the float page.
+% With \Package{fancyhdr}, however, you can specify in each of
+% the header- or footer fields
+% 
+% \Cmd{iffloatpage\{}value for float page\verb|}{|value for other pages\verb|}|
+% 
+% You can even use this to get rid of the decorative line on float pages only
+% by defining:
+% 
+% \begin{verbatim}
+% \renewcommand{\headrulewidth}{\iffloatpage{0pt}{0.4pt}}
+% \end{verbatim}
+% 
+% Sometimes you may want to change the layout also for pages that contain a
+% float on the top of the page, a float on the bottom of the page or a footnote on the bottom of the page.
+% 
+% \Package{fancyhdr} gives you the commands \cs{iftopfloat}, \cs{ifbotfloat} and \cs{iffootnote}
+% similar to \cs{iffloatpage}.
+% 
+% Note: Marks in floats will not be visible in \latex/'s output routine, so
+% it is not useful to put marks in floats. So there is currently no way to
+% let a float (e.g.\ a figure caption) influence the page header or footer.
+% 
+% \section{Those blank pages}
+% \label{sec:blank}
+% 
+% In the \texttt{book} class when the \texttt{openany} option is not given or
+% in the \texttt{report} class when the \texttt{openright} option is given,
+% chapters start at odd-numbered pages, half of the time causing a blank page
+% to be inserted. Some people prefer this page to be completely empty, i.e.\ 
+% without headers and footers. This cannot be done with \cs{thispagestyle}
+% as this command would have to be issued on the \emph{previous} page. There
+% is, however, no magic necessary to get this done:
+% 
+% \PSindex{empty}
+% \CmdIndex{clearpage}
+% \CmdIndex{cleardoublepage}
+% \begin{verbatim}
+% \clearpage{\pagestyle{empty}\cleardoublepage}
+% \end{verbatim}
+% 
+% As the \Cmd{pagestyle\{empty\}} is enclosed in a group it only affects the
+% page that may be generated by the \cs{cleardoublepage}.  You can of
+% course put the above in a private command. If you want to have this done
+% automatically at each chapter start or when you want some other text on the
+% page then you must redefine the \cs{cleardoublepage} command.
+% \index{blank page}
+% \begin{verbatim}
+% \makeatletter
+% \def\cleardoublepage{\clearpage\if at twoside \ifodd\c at page\else
+%   \hbox{}
+%   \vspace*{\fill}
+%   \begin{center}
+%     This page intentionally contains only this sentence.
+%   \end{center}
+%   \vspace{\fill}
+%   \thispagestyle{empty}
+%   \newpage
+%   \if at twocolumn\hbox{}\newpage\fi\fi\fi}
+% \makeatother
+% \end{verbatim}
+% 
+% \section{\textsf{N} of \textsf{M} style page numbers}
+% \label{sec:nofm}
+% 
+% Some document writers prefer the pages to be numbered as \textsf{n} of
+% \textsf{m} where \textsf{m} is the number of pages in the document.
+% There is a package \Package{lastpage}
+% available which you can use with \Package{fancyhdr} as follows:
+% 
+% \begin{verbatim}
+% \usepackage{lastpage}
+% ...
+% \fancyfoot[C]{\thepage\ of \pageref{LastPage}}
+% \end{verbatim}
+% Because you want the pages with pagestyle \texttt{plain} to contain
+% the same style of page numbers, you will have to redefine this
+% pagestyle too.
+% \begin{verbatim}
+% \fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrule}{}}
+% \end{verbatim}
+% We clear all the headers including its rule. The footer will be
+% ``inherited'' from the pagestyle \texttt{fancy}.
+% 
+% The value of the \texttt{LastPage} label can be used to
+% make different headers or footers on the last page of a document. E.g.\ if
+% you want the footer of every odd page, except if it is the last one, to
+% contain the text ``please turn over'', this can be done as
+% follows:
+% 
+% \begin{verbatim}
+% \usepackage{lastpage}
+% \usepackage{ifthen}
+% ...
+% \fancyfoot[R]{\ifthenelse{\isodd{\value{page}} \and \not
+%      \(\value{page}=\pageref{LastPage}\)}{please turn over}{}}
+% \end{verbatim}
+% 
+% \section{Chapter or section related page numbers}
+% 
+% In technical documentation very often page numbers are used of the form
+% 2-10 where the first number is the chapter number and the second is the
+% pagenumber relative to the chapter. Sometimes section is used rather than
+% chapter. The package \Package{chappg} can be used to get this format. 
+% 
+% Basically this package redefines \cs{thepage} as 
+% \cs{thechapter}\cs{chappgsep}\Cmd{arabic\{page\}}, where
+% \cs{chappgsep} by default is `-'. If you want do use a different
+% separator, you must redefine \cs{chappgsep}, for example to use an
+% en-dash:
+% 
+% \begin{verbatim}
+% \renewcommand{\chappgsep}{--}
+% \end{verbatim}
+% 
+% To use a different prefix, for example the section number, use the
+% \Cmd{pagenumbering\{bychapter\}} command with an optional argument
+% specifying the prefix.
+% \CmdIndex{pagenumbering}
+% 
+% \begin{verbatim}
+% \pagenumbering[\thesection]{bychapter}
+% \end{verbatim}
+% 
+% What the package also does is reset the page number to 1 at the beginning
+% of each chapter.
+%
+% In the frontmatter of your document (for example the Table of
+% Contents) there will be no chapter numbers. Therefore a simple page
+% number will be used there. This may be confusing, so you might prefer to use roman pagenumbers
+% in the front matter. Do this by using \verb+\pagenumbering{roman}+ in
+% the beginning of the document and \verb+pagenumbering{bychapter}+
+% after the first \cs{chapter} command. If you want to do it before the
+% \cs{chapter} command you must precede it
+% by a \cs{newpage} command (see the next section).
+% \begin{verbatim}
+% \pagenumbering{roman}
+% \tableofcontents
+% \newpage
+% \pagenumbering{bychapter}
+% \chapter{Introduction}
+% \end{verbatim}
+% 
+% There is a caveat when you have appendices in your document. Before the
+% \cs{appendix} command you should give a \cs{clearpage} or
+% \cs{cleardoublepage}. See the \Package{chappg} documentation for
+% details.
+% 
+% There is a fundamental difference between the page numbering of the style
+% ``\emph{m} of \emph{n}'' as described in the previous section and the
+% current one. The \emph{m} of \emph{n} style is only used in the page header
+% or footer, but not in the table of contents, index, or references like
+% ``\emph{See page \emph{xx}}''. Therefore it does not change the command
+% \cs{thepage}. The page numbering style ``2-10'', however should be used
+% in all references to the page number, therefore it must be done by redefining
+% \cs{thepage}. 
+% 
+% 
+% \section{When to change the headers and footers?}
+% \label{sec:change}
+% 
+% Sometimes you want to change the header or footer layout in the course of a
+% document. Some of these changes can be accomplished by using the mark
+% mechanism as may be seen in section~\ref{sec:custom} and \ref{sec:xmarks}.
+% However, sometimes we want a more drastic change, e.g.\ to change the page
+% numbering from roman to arabic (with \cs{pagenumbering}), to change one of
+% \index{page style>changes}
+% the \Package{fancyhdr} fields or to change to another page style.
+% Sometimes you may be surprised to find the change to occur too early. In
+% general the above mentioned changes take effect immediately, i.e.\ on the
+% page that is currently being built. If you want the change to take effect
+% at the next page you must make sure that the current page is finished. In
+% \CmdIndex{clearpage}
+% most cases this can be done by issuing a \cs{newpage} or \cs{clearpage} command before
+% any of the above mentioned changes. If this is not possible you can use the 
+% \TTindex{afterpage.sty}
+% \Package{afterpage} package with:\\
+% \Cmd{afterpage\{}\Cmd{fancyhead[L]\{new value\}\}} or
+% \CmdIndex{pagenumbering}
+% \Cmd{afterpage\{}\Cmd{pagenumbering\{roman\}\}}. You cannot use \cs{afterpage}
+% to change the \cs{pagestyle} as the commands issued by \cs{afterpage}
+% are local in a group, and the \cs{pagestyle} command makes only local
+% changes. The \cs{pagenumbering} and the \Package{fancyhdr} commands
+% make global changes so they will work, as will the \cs{thispagestyle}
+% command. 
+% 
+% It should be noted that although the \Package{fancyhdr} commands like
+% \cs{fancyhead} take effect immediately, this does not mean that any
+% ``variables'' used in these commands get the value they have at the place
+% where these commands are given. E.g.\ if \Cmd{fancyfoot[C]\{}\Cmd{thepage\}} is given
+% the page number that will be inserted in the footer is not the page number
+% of the page where this command is given, but rather the page number of
+% the actual page where the footer is constructed. Of course for the page
+% number this is what you expect, but it is also true for other commands.
+% 
+% So if you have a book where each chapter is written by a different author
+% and you want the name of the author in the lower left-hand corner you can
+% use the following commands:
+% 
+% \begin{verbatim}
+% \newcommand{\TheAuthor}{}
+% \newcommand{\Author}[1]{\renewcommand{\TheAuthor}{#1}}
+% \fancyfoot[L]{\TheAuthor}
+% \end{verbatim}
+% 
+% \noindent and start each chapter with the command 
+% \Cmd{Author\{Real Name\}}.
+%  If however, the author name would be changed before a page is
+% completed the wrong author could come in the footer. This would be the case
+% if you gave the above command \emph{before} the \cs{chapter} command
+% rather than after it. 
+% Another source of problems is the fact that \tex/'s output routine processes
+% commands ahead, so it may already have processed some commands that produce
+% text that will appear on the next page. See the next section for an example.
+% 
+% \section{Headers and footers induced by the text}
+% \label{sec:xmarks}
+% 
+% We have seen how we can use \LaTeX's marks to get information from the
+% document contents to the headers and footers. The marks mechanism is the
+% only reliable mechanism that you can use to get changing information to the
+% headers or footers. This is because \latex/ may be processing your document
+% ahead before deciding to break the page. 
+% 
+% Sometimes the two marks that \latex/ offers are not enough. An example is
+% the following:
+% \begin{quote}
+%  If a solution to an exercise goes across a page break, then I would like
+%  to have ``(Continued on next page\ldots)'' at the bottom of the
+% \index{Continued\ldots}
+%  first page and ``(Continued\ldots)'' at the top in the margin of the next page.
+% \end{quote}
+% 
+% You cannot use \latex/'s mark mechanisms for this if you also want to use
+% chapter and section information.
+% 
+% The \Package{extramarks} package gives you
+% two extra marks that can be used in this situation.
+% Here is a way to use this package:
+% 
+% \begin{verbatim}
+% \usepackage{extramarks}
+% ...
+% \pagestyle{fancy}
+% \fancyhead[L]{\firstxmark}
+% \fancyfoot[R]{\lastxmark}
+% ...
+% \extramarks{}{Continued on next page\ldots} %1
+% Some text that may or may not cross a page boundary...
+% \extramarks{Continued\ldots}{} %2
+% \extramarks{}{} %3
+% \end{verbatim}
+% 
+% \CmdIndex{extramarks}
+% Note that the \cs{extramarks} command must be close to the text, i.e no
+% empty lines (paragraph boundaries) should intervene. Otherwise the page may
+% be broken at that boundary and the extramarks would come on the wrong page.
+% The final \verb+\extramarks{}{}+ is to prevent the `Continued\ldots'
+% header to appear on the following pages.
+% 
+% Explanation: There are two new marks that can be used in the page layout with this
+% package: If commands of the form
+% \verb|\extramarks{|$m_1$\verb|}{|$m_2$\verb|}| are given
+% \CmdIndex{firstxmark}
+% \CmdIndex{lastxmark}
+% \cs{firstxmark} gives you the first $m_1$ value and
+% \cs{lastxmark} gives you the last $m_2$ value
+% of the current page. In the above example, when the complete block
+% falls on the same page, the \cs{firstxmark} will be the empty
+% parameter of the first \cs{extramarks} command (indicated by \texttt{\%1}), and
+% the \cs{lastxmark} will be the empty parameter from the last
+% \cs{extramarks} command (indicated by \texttt{\%3}).
+%
+% However, when the page break falls in the block, the mark generated by
+% \%1 will be the last one on the first page. Therefore on that page
+% \cs{lastxmark} will be `Continued on next page\ldots'. On the second
+% page, the first mark will be \texttt{\%2}, therefore \cs{firstxmark} will be `Continued\ldots'.
+% On all the following pages the values of \texttt{\%3} will be used,
+% i.e. empty ones. Of course in real life you would leave out the \texttt{\%} indicators.
+% 
+% In case you want the last $m_1$ value or the first $m_2$ value, you
+% can use the \cs{lastleftxmark} or \cs{firstrightxmark}, respectively.
+% For symmetry reasons there are also commands \cs{firstleftxmark}
+% (=\cs{firstxmark}), \cs{lastrightxmark} (=\cs{lastxmark}),
+% \cs{topleftxmark} (=\cs{topxmark}) and \cs{toprightxmark}. The
+% top-marks are basically the last-marks of the previous page.
+% \CmdIndex{lastleftxmark}
+% \CmdIndex{firstrightxmark}
+% \CmdIndex{firstleftxmark}
+% \CmdIndex{lastrightxmark}
+% \CmdIndex{topleftxmark}
+% \CmdIndex{toprightxmark}
+% 
+% The package also gives you the \cs{firstleftmark} and \cs{lastrightmark}
+% commands that complement the standard \latex/ marks.
+% \CmdIndex{firstleftmark}
+% \CmdIndex{lastrightmark}
+% 
+% To stress the point that marks are the correct way to do this, let me
+% give you a ``solution'' that will not work\footnote{Actually there is
+%   another way but it requires two \latex/ passes: you can put \cs{label}
+%   commands before and after the text and compare the \cs{pageref}s.}:
+% 
+% \begin{verbatim}
+% \fancyhead[L]{Continued}
+% \fancyfoot[R]{Continued on next page\ldots}
+% Some text that may or may not cross a page boundary...
+% \fancyhead[L]{}
+% \fancyfoot[R]{}
+% \end{verbatim}
+% 
+% You may be tempted to think that the first \cs{fancyhead} and \cs{fancyfoot}
+% will be in effect when \tex/ breaks the page in the middle of the text,
+% and the last ones when the page breaks after the text. This is not true as
+% the whole paragraph (including the last definitions) will be processed
+% \index{page break}
+% before \tex/ considers the page break, so at the time of the page break the
+% last definitions are effective, whether the page break occurs inside the text
+% or outside of it. Putting a paragraph boundary between the
+% text and the last definitions will not work either, because you don't want
+% the first definitions to be in effect when \tex/ decides to break the page
+% exactly at this boundary. Actually the marks mechanism was invented to get
+% rid of these kinds of problems.
+% 
+% In the above example the text ``Continued'' appears in the page header. It
+% \index{margin}
+% may be nicer to put it in the  margin. This can be easily
+% accomplished by positioning it at a fixed place relative to the page header.
+% In plain \tex/ you would use a concoction of \Cmd{hbox to 0pt},
+% \Cmd{vbox to 0pt}, \cs{hskip},\cs{vskip}, \cs{hss} and
+% \cs{vss} but fortunately 
+% \latex/'s \texttt{picture} environment gives a much cleaner way to do this.
+% In order not to disturb the normal header layout we put the text in a zero-sized
+% \texttt{picture}. Generally this is the best way to position things on fixed
+% places on the page. You can then also use the normal headings. See also
+% section~\ref{sec:thumb} for another example of 
+% this technique.
+% 
+% \TTindex{picture}
+% \begin{verbatim}
+% \fancyhead[L]{\setlength{\unitlength}{\baselineskip}%
+% \begin{picture}(0,0)
+%   \put(-2,-3){\makebox(0,0)[r]{\firstxmark}}
+%   \end{picture}\leftmark}
+% \end{verbatim}
+% 
+% This solution can of course also be used for the footer. Make sure you put the
+% \texttt{picture} as the first thing in left-handside entries and last in right-handside
+% ones.
+% 
+% Finally you may want to put ``(Continued\ldots)'' in the \emph{text}
+% rather than in the header or the margin. Then you have to use the
+% \TTindex{afterpage.sty}
+% \Package{afterpage} package. We also decide to make a separate
+% environment for it.
+% 
+% \begin{verbatim}
+% \newenvironment{continued}{\par
+%   \extramarks{}{Continued on next page\ldots}
+%   \afterpage{\noindent\firstxmark\vspace{1ex}}
+%   }{\extramarks{(Continued\ldots)}{}\par}
+% \end{verbatim}
+% 
+% It is a bit dangerous to use \cs{firstxmark} outside the page layout
+% routine, but apparently with \cs{afterpage} this works. If you would
+% need the information further on in the page you must remember the state of
+% the marks in your own variable. You can set this in one of the
+% \Package{fancyhdr} fields. For example if you want to add something
+% \emph{after} the broken piece of text you can use the following:
+% 
+% \begin{verbatim}
+% \newcommand{\mysaved}{}
+% 
+% \newenvironment{continued}{\par
+%   \extramarks{}{Continued on next page\ldots}
+%   }{\extramarks{(Continued\ldots)}{}\par\vspace{1ex}\mysaved}
+% \fancyhead[L]{\leftmark}
+% \fancyhead[C]{\ifthenelse{\equal{\lastxmark}{}}
+%   {\gdef\mysaved{}}
+%   {\gdef\mysaved{\noindent[Continued from previous page]}}}
+% \end{verbatim}
+% 
+% If you want to include one of the marks or other varying information in the
+% saved text, you must use \cs{xdef} rather than \cs{gdef}.
+% 
+% 
+% \section{A movie}
+% \label{sec:movie}
+% 
+% \index{movie}
+% \TTindex{picture}
+% If you put at each page on the same place a picture that slightly changes
+% from page to page you can get a movie-like effect by flipping through the
+% pages. You can create such a movie easily with fancyhdr. For
+% simplicity we assume that each picture is in a postscript (EPS) file called
+% \texttt{pic}$\langle n\rangle$.\texttt{ps} where $\langle n\rangle$ is the page number and that we use
+% the \Package{graphics} or  \Package{graphicx} package\footnote{If you use an older version of
+%   \LaTeX{} you could use the \Package{epsf} or \Package{epsfig} package.}. 
+% \TTindex{graphics}
+% \TTindex{graphicx}
+% \TTindex{epsf}
+% \TTindex{epsfig}
+% To put the movie in the  righthandside bottom corner the following will work:
+% 
+% \begin{verbatim}
+% \fancyfoot[R]{\setlength{\unitlength}{1mm}
+%   \begin{picture}(0,0)
+%     \put(5,0){\includegraphics{pic\thepage.ps}}
+%   \end{picture}}
+% \end{verbatim}
+% 
+% Notice that the \cs{unitlength} parameter should
+% be set locally in the fancyhdr field in order to avoid unwanted
+% interference with its value in the text.
+% 
+% \section{Thumb-indexes}
+% \label{sec:thumb}
+% 
+% \index{bible}
+% Some railroad guides and expensive bibles have so called
+% \index{thumb-index}
+% \emph{thumb-indexes}, i.e.\ there are marks on the sides of the pages that
+% indicate where the chapters are. You can create these by printing black
+% blobs in the margin of the pages. The vertical position should be
+% determined by the chapter number or some other counter. As the position is
+% independent of the contents of the page, we print these blobs as part of
+% the header in a zero-sized \texttt{picture} as described in the previous
+% section.
+% 
+% Of course we have to take care of two-sided printing, and we may want to
+% have an index page with all the blobs in the correct position. The solution
+% requires some hand-tuning to get the blobs nicely spaced out vertically.
+% For the application that I had there were 12 sections, so I made the blobs
+% 18 mm apart, i.e. 9~mm blob separated by 9~mm whitespace. In order to avoid
+% calculations they are set in a \texttt{picture} environment with the
+% \cs{unitlength} set to 18~mm. Page numbers are set in the headers at the
+% outer sides, and the blobs are attached to these. In this example the
+% section numbers are used to position the blobs, but you can replace this
+% with any numeric value. 
+% See figure~\ref{fig:overview} for the resulting
+% overview page and figure~\ref{fig:thumb} for the code.
+% 
+% \begin{figure}[htbp]
+% \setlength{\unitlength}{9mm}
+% \newcommand{\blob}{\rule[-.2\unitlength]{1\unitlength}{.5\unitlength}}
+% \newcounter{line}
+% \newcommand{\secname}[1]{\addtocounter{line}{1}^^A
+%   \put(1,-\value{line}){\blob}
+%   \put(-7.5,-\value{line}){\arabic{line}}
+%   \put(-7,-\value{line}){#1}}
+% 
+% \newcommand{\overview}{1
+%   \begin{picture}(0,0)
+%     \secname{Introduction}
+%     \secname{The first year}
+%     \secname{Specialisation}
+%   \end{picture}}
+%  
+%   \begin{center}
+%     \leavevmode
+%     \begin{picture}(11.3,5)
+%       \put(0,0){\framebox(11.3,5)[tr]{}}
+%       \put(9,4.5){\overview}
+%     \end{picture}
+%   \end{center}
+%   \caption{Thumb-index overview page}
+%   \label{fig:overview}
+% \end{figure}
+% \begin{figure}[hp]\small
+% \begin{verbatim}
+% \setlength{\unitlength}{18mm}
+% \newcommand{\blob}{\rule[-.2\unitlength]{2\unitlength}{.5\unitlength}}
+% 
+% \newcommand\rblob{\thepage
+%   \begin{picture}(0,0)
+%     \put(1,-\value{section}){\blob}
+%   \end{picture}}
+% 
+% \newcommand\lblob{^^A
+%   \begin{picture}(0,0)
+%     \put(-3,-\value{section}){\blob}
+%   \end{picture}^^A
+%   \thepage}
+% 
+% \pagestyle{fancy}
+% \fancyfoot[C]{}
+% 
+% \newcounter{line}
+% \newcommand{\secname}[1]{\addtocounter{line}{1}^^A
+%   \put(1,-\value{line}){\blob}
+%   \put(-7.5,-\value{line}){\Large \arabic{line}}
+%   \put(-7,-\value{line}){\Large #1}}
+% 
+% \newcommand{\overview}{\thepage
+%   \begin{picture}(0,0)
+%     \secname{Introduction}
+%     \secname{The first year}
+%     \secname{Specialisation}
+% ...etc...
+%   \end{picture}}
+% 
+% \begin{document}
+% \fancyhead[R]{\overview}\mbox{}\newpage % This produces the overview page
+% \fancyhead[R]{} % Front matter may follow here
+% \clearpage
+% \fancyhead[RE]{\rightmark}
+% \fancyhead[RO]{\rblob}
+% \fancyhead[LE]{\lblob}
+% \fancyhead[LO]{{\leftmark}
+% ...
+% \end{verbatim}
+%   \caption{Thumb-index code}
+%   \label{fig:thumb}
+% \end{figure}
+% 
+% \section{Float placement}
+% 
+% Floats are page elements that float with respect to the rest of the
+% document. Standard floats are tables and figures, but with the
+% \Package{float} package you can easily make new ones, like algorithms. Most
+% of the time floats work satisfactory, but sometimes \LaTeX{} seems too
+% stubborn to do what you want. This section describes how you can influence
+% \LaTeX{} so that it will do most of the time what you want. There might,
+% however be some pathological cases where it is impossible to convince
+% \LaTeX{} to do things your way. In the following we will use figures as an
+% example but everything applies to other floats as well.
+% 
+% The most encountered problems with floats are:
+% \begin{enumerate}
+% \item You want a float at a certain position in the text, but \LaTeX{}
+%   moves it, usually to the next page.
+% \item From a certain point, \LaTeX{} moves all your floats to the end of
+%   the document or the end of a chapter.
+% \item \LaTeX{} complains about ``Too many floats''.
+% \end{enumerate}
+% 
+% In the first two cases you must first check if you have given the correct
+% ``placement'' parameter to you float, e.g. \Cmd{begin\{figure\}[htp]}
+% specifies that your figure may be placed either: Here (i.e. in the text
+% position where the command is given), on the Top of a page (which may be
+% the page where you put the command), or on a separate Page of floats. You
+% could also have specified ``b'' for Bottom of the page. The order of the
+% letters is insignificant, you cannot force \LaTeX{} to try Bottom first
+% and then Top by specifying \texttt{[bt]}.
+% 
+% If \LaTeX{} doesn't put the float at the place where you expected it, it is
+% usually caused by the following:
+% \begin{enumerate}
+% \item The float didn't fit on the page. In this case it has to move to the
+%   next page or even further. If you didn't specify either \texttt{[t]} or
+%   \texttt{[b]} in the position parameter, \latex/ must save it until it has
+%   enough for a page of floats. So don't specify only \texttt{[h]}. If you
+%   want to give \latex/ a chance to put the float on a page of floats, you
+%   must also specify ``p''.
+% \item The placement would violate the constraints imposed by \latex/'s
+%   float placement parameters. This is one of the most occurring causes and
+%   it can easily be corrected by changing the parameters. Here is a list of
+%   them:
+% \end{enumerate}
+% \begin{center}
+% \CmdIndex{topfraction}
+% \CmdIndex{bottomfraction}
+% \CmdIndex{textfraction}
+% \CmdIndex{floatpagefraction}
+% \TTindex{topnumber}
+% \TTindex{bottomnumber}
+% \TTindex{totalnumber}
+%   \begin{tabular}{>{\tt}llc}
+%     \toprule
+%     \multicolumn{3}{c}{Counters -- change with \cs{setcounter}}\\
+%     \midrule
+%     topnumber & max. number of floats at top of page & 2 \\
+%     bottomnumber & max. number of floats at bottom of page & 1 \\
+%     totalnumber &  max. number of floats on a page & 3\\
+%     \midrule
+%     \multicolumn{3}{c}{Other -- change with \cs{renewcommand}}\\
+%     \midrule
+%     \bs topfraction & max fraction of page for floats at top & 0.7 \\
+%     \bs bottomfraction & max fraction of page for floats at bottom & 0.3 \\
+%     \bs textfraction & min fraction of page for text & 0.2 \\
+%     \bs floatpagefraction & min fraction of floatpage that should have
+%     floats  & 0.5 \\ 
+%     \bottomrule
+%   \end{tabular}
+% \end{center}
+% 
+% There are also some others for double column floats in two-column documents.
+% 
+% The values in the righthand column are the defaults for the standard
+% \latex/ classes. Other classes could use different defaults. As you see
+% with the default values a float will not be put in the bottom of a page if
+% its height is more than 30\% of the page height. So if you specify [hb] for
+% a float which is taller it has to move to a float page. But if it is less
+% than 50\% of the page height it will have to wait until some more floats
+% are given before a float page can be filled to satisfy the
+% \cs{floatpagefraction} parameter. If you have this kind of behaviour you
+% can easily adapt the parameters, e.g. with:
+% \begin{verbatim}
+% \renewcommand{\textfraction}{0.05}
+% \renewcommand{\topfraction}{0.95}
+% \renewcommand{\bottomfraction}{0.95}
+% \renewcommand{\floatpagefraction}{0.35}
+% \setcounter{totalnumber}{5}
+% \end{verbatim}
+% You may want to be careful not to make \cs{floatpagefraction} too small,
+% otherwise you may get too many small floatpages.
+% 
+% You can force \latex/ to ignore most of the parameters for one specific float
+% occurrence by
+% including an exclamation mark (!) in the placement parameters, e.g.
+% \begin{verbatim}
+% \begin{figure}[!htb]
+% \end{verbatim}
+% 
+% Floats which contain a ``\texttt{t}'' in the position parameter could be
+% placed before the place where they are referenced (but on the same page).
+% This is normal behaviour for \latex/ but some people just don't like it.
+% There are a number of ways to prevent this: 
+% \begin{enumerate}
+% \item Of course deleting the ``\texttt{t}'' will help, but in general this is
+%   undesirable, as you may want the float to be placed at the top of the
+%   next page.
+% \item use the \Package{flafter} package which causes floats never to be
+%   placed ``backwards''.
+% \item use the command \cs{suppressfloats[t]}.  This
+%   command will cause floats for the top position \emph{on this page} to be
+%   moved to the next page. This can also be done with \texttt{[b]} or
+%   without parameter for all floats on this page.
+% \end{enumerate}
+% 
+% If in spite of all your attempts \latex/ still moves your floats to the end
+% of the document or the end of a chapter, you can insert a \cs{clearpage}
+% command. This will start a new page and insert all pending floats before
+% continueing. If it is undesirable to have a pagebreak you can use the
+% \Package{afterpage} package and the following command:
+% \begin{verbatim}
+% \afterpage{clearpage}
+% \end{verbatim}
+% 
+% This will wait until the current page is finished and then flush all
+% outstanding floats. In some pathological circumstances \Package{afterpage}
+% may give strange results, however.
+% 
+% Finally, if you want a float only at the place where you define it, without
+% \latex/ moving it whatsoever, you can use the \Package{float} package and
+% give the command:
+% \begin{verbatim}
+% \restylefloat{figure}
+% \end{verbatim}
+%  in the preamble. Now you will be able to
+% specify \texttt{[H]} as the position parameter, which will mean ``HERE
+% and only HERE''. This may cause an unwanted page break however.
+% If you want to avoid the unwanted pagebreak, i.e. let
+% \LaTeX{} move the float only if it doesn't fit on the page, then use the
+% \Package{afterpage} package with:
+% \begin{verbatim}
+% \afterpage{\clearpage \begin{figure}[H] ... \end{figure}}
+% \end{verbatim}
+% 
+% Complaints from \latex/ about ``Too many floats'' are usually caused by one
+% of the above problems: floats not being able to be placed and \latex/
+% collecting too many of them. The solutions given above, especially those
+% with \cs{clearpage} in them will usually help. In some cases there
+% really are too many floats, as \latex/ has a limited number of ``boxes'' to
+% store the floats. The package \Package{morefloats} can be used to increase
+% this number. If you need still more then you must edit a private copy of
+% this file, but even then there will be some limit that you cannot pass.
+% Then your only resort will be to change your document.
+% 
+% \section{Multipage Floats}
+% 
+% \LaTeX's floats cannot be split across pages. Sometimes, however, you want
+% to have a table or figure that doesn't fit on one page. The easiest way is
+% to split these into multiple table or figure environments, but this has a
+% number of undesirable effects:
+% \begin{itemize}
+% \item Where do you split it? This is in general more difficult for tables
+%   than for figures.
+% \item How do you keep them together?
+% \item You don't want more than one entry in the list of figures/tables.
+% \end{itemize}
+% 
+% Although these problems are not fully solvable in all cases, here are a
+% couple of suggestions:
+% 
+% \subsection{Tables}
+% 
+% For tables longer than a page you can use the \Package{longtable} package.
+% \TTindex{longtable}
+% This package defines a \texttt{longtable} environment that is a kind of
+% amalgamation of \texttt{table} and \texttt{tabular}. It has approximately
+% the same syntax as the  \texttt{tabular} environment, but it adds some
+% features of \texttt{table}, like captions. Longtables will be automatically
+% split when they don't fit on the page. And they will be entered in the list
+% of tables when a caption is given. They will not float, however, and cannot
+% be used inside a float environment. This could mean that another
+% \texttt{table} environment, which was defined before the
+% \texttt{longtable}, will float past it, and therefore the numbers may get
+% out of order. Another problem could be that the \texttt{longtable} starts
+% rather far down the page, which isn't a pleasant sight. If you want the
+% \texttt{longtable} to start at the top of the page, the best thing to do is
+% to include it in an \cs{afterpage} command (using the \Package{afterpage}
+% package). As a \texttt{longtable} is by definition large, it is best to put
+% it in a separate file, and \cs{input} it in the \cs{afterpage} command:
+% \CmdIndex{afterpage}
+% \begin{verbatim}
+% \afterpage{\input{mytable}}
+% \end{verbatim}
+% \begin{verbatim}
+% \afterpage{\clearpage\input{mytable}}
+% \end{verbatim}
+% The last form has the additional advantage that most of the outstanding
+% floats will be printed first.
+% 
+% 
+% \subsection{Figures}
+% 
+% There isn't an equivalent \texttt{longfigure} solution, so for figures you
+% will usually have to split it yourself. In general this is less of a
+% problem. However, the problem you get now is how to keep them together,
+% i.e. how to get the parts on subsequent pages, and how to get a single
+% entry in the list of figures.
+% 
+% You will have to split the figure into pieces and put each part
+% in a separate \texttt{figure} environment. To keep them together it is best
+% to use only the \texttt{[p]} placement, so that they will be put on
+% floatpages. As they are bigger than a page this is appropriate. The first
+% part would then get a \cs{caption}, the subsequent parts would be used
+% without a caption. If you want to add a caption-like text, enter it as
+% normal text rather than a \cs{caption}, so that it will not be entered in
+% the list of figures. It may also be desirable to issue a \cs{clearpage}
+% first, just like we did for the \texttt{longtable}, and to encapsulate this
+% in the \cs{afterpage} command. E.g.
+% \begin{verbatim}
+% \afterpage{\clearpage\input{myfigure}}
+% \end{verbatim}
+% where \texttt{myfigure.tex} contains:
+% \begin{verbatim}
+% \begin{figure}[p]
+% \includegraphics{myfig1.eps}
+% \caption{This is a multipage figure}
+% \label{fig:xxx}
+% \end{figure}
+% \begin{figure}[p]
+% \includegraphics{myfig2.eps}
+% \begin{center}
+% Figure~\ref{fig:xxx} (continued)
+% \end{center}
+% \end{figure}
+% \end{verbatim}
+% 
+% You have to make sure that the last part is big enough, otherwise \LaTeX{}
+% could decide to postpone it until it has collected some more floats. This
+% can be done either by making the figure big enough (e.g. by adding some
+% \cs{vspace}), or by tweaking the \cs{floatpagefraction} 
+% \CmdIndex{floatpagefraction} parameter.
+% 
+% If you want your multipage figure to start at a lefthand-side
+% (even-numbered) page you can use a test in the \cs{afterpage} command
+% (using the \Package{ifthen} package):
+% \begin{verbatim}
+% \afterpage{\clearpage
+% \ifthenelse{\isodd{\value{page}}{\afterpage{\input{myfigure}}} % odd page
+%     {\input{myfigure}}}} % even page
+% \end{verbatim}
+% If there are too many floats on the skipped page, this may still fail to
+% start your multipage figure on an even page, however.
+% 
+% \section{Deprecated commands}
+% \label{sec:depr}
+% 
+% This section contains the description of deprecated commands. These
+% were parts of the original implementation of \Package{fancyheadings}.
+% They continue to work for compatibility reasons, 
+% but it is recommended not to use them anymore. This description is
+% given so that you know what they mean and how to convert them to the
+% standard commands. To be honest, I use these sometimes myself in quick
+% examples, because \cs{lhead} is less typing than \Cmd{fancyhead[L]}.
+% 
+% These commands for specifying the header or footer fields and their translation to
+% the modern commands are given in table~\ref{tab:depr}.
+%
+% \begin{table}[h!t]
+% \CmdIndex{lhead}
+% \CmdIndex{chead}
+% \CmdIndex{rhead}
+% \CmdIndex{lfoot}
+% \CmdIndex{cfoot}
+% \CmdIndex{rfoot}
+%   \begin{tabular}{ll}
+%   \toprule
+%   \Cmd{lhead\{xx\}} & \Cmd{fancyhead[L]\{xx\}} \\
+%   \Cmd{lhead[xx]\{yy\}} & \Cmd{fancyhead[LE]\{xx\}} \Cmd{fancyhead[LO]\{yy\}} \\
+%   \Cmd{chead\{xx\}} & \Cmd{fancyhead[C]\{xx\}} \\
+%   \Cmd{chead[xx]\{yy\}} & \Cmd{fancyhead[CE]\{xx\}} \Cmd{fancyhead[CO]\{yy\}} \\
+%   \Cmd{rhead\{xx\}} & \Cmd{fancyhead[R]\{xx\}} \\
+%   \Cmd{rhead[xx]\{yy\}} & \Cmd{fancyhead[RE]\{xx\}} \Cmd{fancyhead[RO]\{yy\}} \\
+%   \midrule
+%   \Cmd{lfoot\{xx\}} & \Cmd{fancyfoot[L]\{xx\}} \\
+%   \Cmd{lfoot[xx]\{yy\}} & \Cmd{fancyfoot[LE]\{xx\}} \Cmd{fancyfoot[LO]\{yy\}} \\
+%   \Cmd{cfoot\{xx\}} & \Cmd{fancyfoot[C]\{xx\}} \\
+%   \Cmd{cfoot[xx]\{yy\}} & \Cmd{fancyfoot[CE]\{xx\}} \Cmd{fancyfoot[CO]\{yy\}} \\
+%   \Cmd{rfoot\{xx\}} & \Cmd{fancyfoot[R]\{xx\}} \\
+%   \Cmd{rfoot[xx]\{yy\}} & \Cmd{fancyfoot[RE]\{xx\}} \Cmd{fancyfoot[RO]\{yy\}} \\
+%   \bottomrule
+% \end{tabular}
+% \caption{Deprecated commands and their translation\label{tab:depr}}
+% \end{table}
+%
+% As you see, if there is an optional parameter, this one applies to the
+% even pages, whereas the required parameter applies to the odd pages. Of
+% course this only works if the \texttt{twoside} option is given in the
+% documentclass. If there is no optional parameter, the required
+% parameter applies to both even and odd pages.
+%
+% \CmdIndex{fancyplain}
+% \PSindex{fancyplain}
+% There was also a special pagestyle \texttt{fancyplain} that could be
+% used to define both the pagestyle \texttt{fancy} and to redefine the
+% pagestyle \texttt{plain} at the same time. In order to use that you say
+% \begin{verbatim}
+% \pagestyle{fancyplain}}
+% \end{verbatim}
+% and then in the headers/footers you use for example:
+% \begin{verbatim}
+% \fancyhead[L]{\fancyplain{value for `plain' page}{value for other pages}}}
+% \end{verbatim}
+%
+% The \cs{fancyplain} command is only useful within the pagestyle \texttt{fancyplain}.
+% Nowadays you would just redefine pagestyle \texttt{plain} with the
+% \Cmd{fancypagestyle\{plain\}\{xxxx\}} command (see section~\ref{sec:pagestyle-plain}).
+% 
+% \CmdIndex{plainheadrulewidth}
+% \CmdIndex{plainfootrulewidth}
+% There are also \cs{plainheadrulewidth} and \cs{plainfootrulewidth}
+% commands to define the values of \cs{headrulewidth} and
+% \cs{footrulewidth} to be used on `\texttt{plain}' pages. This also
+% only works with the pagestyle \texttt{fancyplain}, not when you
+% redefine pagestyle \texttt{plain} with the \cs{fancypagestyle} command.
+%
+% \section{Contact information}
+% 
+% Piet van Oostrum\\
+% E-mail: piet at vanoostrum.org \\
+% WWW: http://piet.vanoostrum.org
+% 
+% \section{Version information}
+% \begin{itemize}
+% \item  Version 1.0. March 11,  2003. This is the version that was distributed for a 
+%   long time on CTAN. Version history before this has been lost. 
+% \item Version 2.0. August 27, 2016:
+%   \begin{itemize}
+%   \item Removed references to fixmarks.sty as that is no longer used.
+%   \item References to older \LaTeX{} versions removed.
+%   \item Removed obsolete source code of \Package{extramarks.sty}
+%   \item Changed font commands to \cs{textbf} and \cs{textsl}.
+%   \item Added description of the \cs{fancy\ldots offset} commands.
+%   \item Added various \cs{\ldots xmark} commands from \Package{extramarks.sty}.
+%   \item Various corrections applied.
+%   \item Updated contact information.
+%   \item Added Version information. :)
+%   \end{itemize}
+% \item Version 2.1. August 28, 2016
+%   \begin{itemize}
+%   \item Explain what the top-marks are.
+%   \end{itemize}
+% \item Version 2.1. Sept. 6, 2016
+%   \begin{itemize}
+%   \item Add \verb|\string| to special indexing commands to get a neater index file.
+%   \item Add a decorative headrule example.
+%   \end{itemize}
+% \item Version 3.9, October 13, 2016.
+%   \begin{itemize}
+%   \item Documentation integrated in \texttt{fancyhdr.dtx}.
+%   \item Version number unified with \Package{fancyhdr.sty}.
+%   \item All deprecated commands moved to a separate section (\ref{sec:depr}).
+%   \item Documentation expanded.
+%   \end{itemize}
+% \item Version 3.9a, June 30, 2017.
+%   \begin{itemize}
+%   \item Updated contact information.
+%   \item Restore \cs{newtoks}\cs{@temptokenb}
+%   \end{itemize}
+% \item Version 3.10, Januari 25, 2019
+%   \begin{itemize}
+%   \item Distribution based on fancydhr.dtx.
+%   \item Use \cs{f at nch@ifundefined} instead of \cs{ifx} or \cs{@ifundefined}.
+%   \item Replace \cs{def} with \cs{newcommand} in several places.
+%   \item Don't use \cs{global}\cs{setlength}.
+%   \item Put \cs{footrule} in a \cs{vbox} to accommodate for flexible
+%     footrules, and then \cs{unvbox} that. Move the \cs{footruleskip}
+%     vertical space outside of the definition of \cs{footrule}.
+%   \end{itemize}
+% \end{itemize}
+%
+% \StopEventually{%
+% \PrintChanges
+% \PrintIndex}
+%
+% \part{Questions \& Answers}
+%
+% This part contains answers to questions that have been emailed to me,
+% or have been asked at various internet forums, and don't have a
+% logical place in the other documentation. It is expected to grow
+% gradually.
+%
+%
+% \section{Large chapter/section titles}
+%
+% \index{long titles}
+% Sometimes a chapter or section title is too large to fit in the header
+% or footer. It may take more than one line in the header/footer, or it
+% may overwrite other parts. How can we shorten these titles in the
+% header/footer without changing the actual title?
+%
+% Here is an example:
+% \begin{verbatim}
+% \fancyhead[LE,RO]{\nouppercase{\rightmark}} % Section title
+% \fancyhead[LO,RE]{\nouppercase{\leftmark}} % Chapter title
+% \fancyfoot[C]{\thepage}
+%  . . .
+% \chapter{This is a very long chapter title}
+%  . . .
+% \section{This is a very long section title that will not fit in the header}
+%  . . .
+% \end{verbatim}
+% With these settings the header will come out as:
+%
+% \medskip
+% {\noindent\hbox to \textwidth{^^A
+%    \rlap{\parbox[b]{\textwidth}{\raggedright Chapter 1. This is a very long chapter title}}^^A
+%    \hfill
+%    \llap{\parbox[b]{\textwidth}{\raggedleft 1.2. This is a very long
+%                   section title that will not fit in the header}}^^A
+%  }
+%  \hrule height\headrulewidth width\textwidth}
+% \bigskip
+% \noindent which isn't very nice.
+% There are basically three options to solve this problem.
+%
+% \subsection{Using optional arguments}
+%
+% As we have seen in section~\ref{sec:scoop}, the header info comes from
+% the marks. So if we want the text in the header to be smaller we have
+% to supply smaller marks. This can be done by giving these as optional
+% arguments in the \cs{chapter} and \cs{section} commands.\footnote{At
+% least in the \texttt{book} and \texttt{report} documentclasses. In the
+% \texttt{article} class this would be the \cs{section} and
+% \cs{subsection} commands.}
+% \begin{verbatim}
+% \chapter[Short chapter title]{This is a very long chapter title}
+%  . . .
+% \section[Short section title]
+%         {This is a very long section title that will not fit in the header}
+% \end{verbatim}
+% The short titles will now appear in the header. However, these will
+% also appear in the table of contents. If that is what you want than
+% you are ready. But if you want to use the long titles in the table of
+% contents, you have to use some trickery. In particular you have to
+% supply the marks yourself.
+%
+% \subsection{Using explicit marks}
+%
+% First we show how you can supply a different value for the chapter
+% title in the heading, because this is the easiest. Remember from
+% section~\ref{sec:scoop} that this mark is defined by calling
+% \cs{chaptermark}\CmdIndex{chaptermark}. Also, because it is used as \cs{leftmark}, the last
+% value of this mark on the page is used. So we can easily overrule the
+% value that is supplied by the \cs{chapter} command, by supplying an
+% additional \cs{chaptermark} command after the \cs{chapter} command,
+% like this:
+% \begin{verbatim}
+% \chapter{This is a very long chapter title that does not fit in the header}
+% \chaptermark{This is a not so long chapter title}
+% \end{verbatim}
+% For the section titles the situation is more complicated. Here we use
+% the \cs{rightmark}, which uses the first mark of its kind on the page.
+% So you might think putting a \cs{sectionmark}\CmdIndex{sectionmark} before the \cs{section}
+% command would be the solution. Unfortunately, it is not that simple.
+% In many cases, this will work, but not when there is a page break just
+% before the section title, because in that case the \cs{sectionmark}
+% will stay behind on the previous page. However, we can put the
+% \cs{sectionmark} inside the argument of the \cs{section} command.
+% Because \LaTeX{} first typesets the title (which will execute the
+% included \cs{sectionmark} command), and after that executes its own
+% \cs{sectionmark}, our \cs{sectionmark} will be the first. But
+% there is one case in which this fails: if the next page does not have any
+% \cs{sectionmark} commands, it will inherit the \textbf{last} mark from the page
+% before it, which will be the long title. To correct this we must also
+% give an additional \cs{sectionmark} with the short title
+% \textbf{after} the \cs{section} command.
+%
+% As if this isn't enough, there is still a problem with this setup. Our
+% section title is not only used to typeset the title in the text, but
+% it is also included in the table of contents. But the table of
+% contents does not accept a \cs{sectionmark} in its title. It will
+% generate an ugly error message. To prevent this we must give the long
+% title (that we want to appear in the table of contents) also as the
+% optional argument to the \cs{section} command. Of course this will
+% also generate a mark for the header, but this will be overruled by
+% our included \cs{sectionmark} commands
+%
+% So the complete code would be:
+% \begin{verbatim}
+% \section[Long title]{Long title\sectionmark{Short title}}
+% \sectionmark{Short title}
+% \end{verbatim}
+% To avoid all the repetitions, it is better to make a macro:
+% \begin{verbatim}
+% \newcommand{\Section}[2]{\section[#1]{#1\sectionmark{#2}}\sectionmark{#2}}
+%  . . .
+% \Section{Text title}{Header title}
+% \end{verbatim}
+% And if you want to use yet a different text in the table of contents,
+% you can make a macro with three parameters. The third parameter is the
+% text to be put in the table of contents. We use this parameter as the
+% optional argument for the \cs{section} command.
+% \begin{verbatim}
+% \newcommand{\Sectioniii}[3]{\section[#3]{#1\sectionmark{#2}}\sectionmark{#2}}
+%  . . .
+% \Sectioniii{Text title}{Header title}{TOC title}
+% \end{verbatim}
+% Please note that if you use the \texttt{article} class, instead of
+% \cs{chaptermark} and \cs{sectionmark}, you would probably use \cs{sectionmark}\cs{subsectionmark}.
+%
+% \subsection{Using automatic truncation}
+%
+% For this solution we use the \Package{truncate} package by Donald
+% Arseneau. This has a \cs{truncate}\CmdIndex{truncate} command that
+% truncates a text to a maximum size, when it exceeds that size. We put
+% both headers in \cs{truncate} to limit it to half the \cs{headwidth}.
+% Of course it is also possible to make asymmetric arrangements.
+% \begin{verbatim}
+% \usepackage[fit]{truncate}
+% \fancyhead[LE,RO]{\nouppercase{\truncate{0.5\headwidth}{\rightmark}}}
+% \fancyhead[LO,RE]{\nouppercase{\truncate{0.5\headwidth}{\leftmark}}}
+% \end{verbatim}
+% We don't have to make any changes to the chaper and section titles
+% because \cs{truncate} will take care of this.
+% This arrangement gives the following header when both titles are too
+% big, like in the example above:
+%
+% \medskip
+% {\noindent\hbox to \textwidth{^^A
+%    \truncate{0.5\textwidth}{Chapter 1. This is a very long chapter title that does not fit in the header}^^A
+%    \hfill
+%    \truncate{0.5\textwidth}{1.2. This is a very long section title that will not fit in the header}^^A
+%  }
+%  \hrule height\headrulewidth width\textwidth}
+% \bigskip
+%
+% Note that we have used the \texttt{[fit]} option of the
+% \Package{truncate} package. Otherwise the right header will not be
+% right aligned, but it will start at halfway the header.
+% Note also that, as each part can occupy half of the available width,
+% they could theoretically touch each other. This can be prevented by
+% making the widths slightly smaller. And when there is only one title
+% in the header, you can make the width equal to or slightly smaller
+% than \cs{headwidth}.
+%
+% \section{I lost my chapter/section titles}
+%
+% Some time ago I got a question like this (edited to get the
+% essentials):
+%
+% ``I redefined the \Cmd{pagestyle\{fancy\}} to get my own kind of headings. Also, I
+% redefined the \cs{chaptermark}.
+% I need the \texttt{fancy} style from chapter 1 and on (mainmatter part), but, until the Introduction
+% chapter (that I included into the frontmatter part) I need the \texttt{myheadings}\PSindex{myheadings} style.
+%
+% When I set the \texttt{myheadings} style into
+% the frontmatter the \texttt{fancy} style doesn't show the chapter title any more.
+%
+% What can I do in order to reestablish the right behavior of the
+% \texttt{fancy} style?''
+%
+% The solution to this problem is actually very simple. The pagestyle
+% \texttt{myheadings} (as well as \texttt{headings}\PSindex{headings}) redefines the
+% \cs{chaptermark} and \cs{sectionmark}, so when you return to pagestyle
+% \texttt{fancy}, the definitions you had given before (or the ones that
+% \Package{fancyhdr} provided) are lost. You
+% just have to repeat them at the point where you switch back to
+% pagestyle \texttt{fancy}.
+%
+% \begin{verbatim}
+% \begin{document}
+% \frontmatter
+% \pagestyle{myheadings}
+%  . . .
+% \mainmatter
+% \pagestyle{fancy}
+% \renewcommand{\chaptermark}[1]{....}
+% \end{verbatim}
+%
+%
+% \newpage
+% \part{Implementation}
+%
+% \section{fancyhdr.sty}
+%
+%<*fancyhdr>
+% \changes{fancyhdr v1.4}{1994/09/16}{Correction for use with \cs{reversemarginpar}}
+% 
+% \changes{fancyhdr v1.5}{1994/09/29}{Added the \cs{iftopfloat},
+% \cs{ifbotfloat} and \cs{iffloatpage} commands}
+% 
+% \changes{fancyhdr v1.6}{1994/10/04}{Reset single spacing in headers/footers for use with
+% \Package{setspace.sty} or \Package{doublespace.sty}}
+% 
+% \changes{fancyhdr v1.7}{1994/10/04}{Changed \cs{let}\cs{@mkboth}\cs{markboth} to
+% \texttt{\cs{def}\cs{@mkboth}\{\cs{protect}\cs{markboth}\}} to make it more robust.}
+% 
+% \changes{fancyhdr v1.8}{1994/12/05}{corrections for
+% \Package{amsbook}/\Package{amsart}: define \cs{@chapapp} and (more
+% importantly) use the \cs{chapter/sectionmark} definitions from \texttt{ps at headings} if
+% they exist (which should be true for all standard classes).}
+% 
+% \changes{fancyhdr v1.9}{1995/03/31}{The proposed 
+% \texttt{\cs{renewcommand}\{\cs{headrulewidth}\}} \texttt{\{\cs{iffloatpage}\ldots}
+% construction in the doc did not work properly with the \texttt{fancyplain} style.}
+% 
+% \changes{fancyhdr v1.91}{1995/06/01}{The definition of \cs{@mkboth} wasn't 
+% restored on subsequent \texttt{\cs{pagestyle}\{fancy\}}'s.}
+% 
+% \changes{fancyhdr v1.92}{1995/06/01}{The sequence
+% \texttt{\cs{pagestyle}\{fancyplain\} \cs{pagestyle}\{plain\}
+% \cs{pagestyle}\{fancy\}} would erroneously select the plain version.}
+% 
+% \changes{fancyhdr v1.93}{1995/06/01}{\cs{fancypagestyle} command added.}
+% 
+% \changes{fancyhdr v1.94}{1995/12/11}{(suggested by Conrad Hughes
+% \texttt{<chughes at maths.tcd.ie!>}): added \cs{footruleskip} to allow control over footrule
+% position (old hardcoded value of .3\cs{normalbaselineskip} is far too high
+% when used with very small footer fonts).}
+% 
+% \changes{fancyhdr v1.95}{1996/01/31}{call \cs{@normalsize} in the reset code if that is defined, 
+% otherwise \cs{normalsize}. This is to solve a problem with
+% \Package{ucthesis.cls}, as this doesn't define \cs{@currsize}.
+% Unfortunately for latex209 calling \cs{normalsize} doesn't
+% work as this is optimized to do very little, so there \cs{@normalsize} should
+% be called. Hopefully this code works for all versions of LaTeX known to
+% mankind.}
+% 
+% \changes{fancyhdr v1.96}{1996/04/25}{Initialize \cs{headwidth} to a
+% magic (negative) value to catch most common cases that people change
+% it before calling \texttt{\cs{pagestyle}\{fancy\}}. 
+% Note it can't be initialized when reading in this file, because
+% \cs{textwidth} could be changed afterwards. This is quite probable.
+% We also switch to \cs{MakeUppercase} rather than \cs{uppercase} and introduce a
+% \cs{nouppercase} command for use in headers. and footers.}
+% 
+% \changes{fancyhdr v1.97}{1996/05/03}{Two changes: \\
+% 1. Undo the change in version 1.8
+% (using the \texttt{\cs{pagestyle}\{headings\}} defaults 
+% for the chapter and section marks). The current version of amsbook and
+% amsart classes don't seem to need them anymore. Moreover the standard
+% \LaTeX{} classes don't use \cs{markboth} if twoside isn't selected, and this is
+% confusing as \cs{leftmark} doesn't work as expected.\\
+% 2. Include a call to \cs{ps at empty}
+% in \cs{ps@@fancy}. This is to solve a problem 
+% in the amsbook and amsart classes, that make global changes to \cs{topskip},
+% which are reset in \cs{ps at empty}. Hopefully this doesn't break other things.}
+% 
+% \changes{fancyhdr v1.98}{1996/05/07}{Added \% after the line  \cs{def}\cs{nouppercase}}
+% 
+% \changes{fancyhdr v1.99}{1996/05/07}{This is the alpha version of fancyhdr 2.0\\
+% Introduced the new commands \cs{fancyhead}, \cs{fancyfoot}, and \cs{fancyhf}.
+% Changed \cs{headrulewidth}, \cs{footrulewidth}, \cs{footruleskip} to
+% macros rather than length parameters, In this way they can be
+% conditionalized and they don't consume length registers. There is no need
+% to have them as length registers unless you want to do calculations with
+% them, which is unlikely. Note that this may make some uses of them
+% incompatible (i.e. if you have a file that uses \cs{setlength} or \cs{xxxx}!=)}
+% 
+% \changes{fancyhdr v1.99a}{1996/05/10}{Added a few more \% signs.}
+% 
+% \changes{fancyhdr v1.99b}{1996/05/10}{Changed the syntax of
+% \cs{f at nch@for} to be resistent to catcode changes of \texttt{:!=}.\protect\\
+% Removed the \texttt{[1]} from the defs of \cs{lhead} etc. because the parameter is
+% consumed by the \cs{@[xy]lhead} etc. macros.}
+% 
+% \changes{fancyhdr v1.99c}{1997/06/24}{Corrected \cs{nouppercase} to
+% also include the protected form of \cs{MakeUppercase}.\\ 
+% \cs{global} added to manipulation of \cs{headwidth}.\\
+% \cs{iffootnote} command added.\\
+% Some comments added about \cs{f at nch@head} and \cs{f at nch@foot}.}
+% 
+% \changes{fancyhdr v1.99d}{1998/08/24}{Changed the default
+% \cs{ps at empty} to \cs{ps@@empty} in order to allow
+% \texttt{\cs{fancypagestyle}\{empty\}} redefinition.}
+% 
+% \changes{fancyhdr v2.0}{2000/10/11}{Added LPPL license clause.\\
+% A check for \cs{headheight} is added. An errormessage is given (once) if the
+% header is too large. Empty headers don't generate the error even if
+% \cs{headheight} is very small or even 0pt. \\
+% Warning added for the use of '\texttt{E}' option when twoside option is not used.
+% In this case the '\texttt{E}' fields will never be used.}
+% 
+% \changes{fancyhdr v2.1beta}{2002/03/10}{New command:
+% \texttt{\cs{fancyhfoffset}[place]\{length\}} defines offsets to be applied to
+% the header/footer to let it stick into the margins (if length $!>$ 0).
+% \texttt{place} is like in \cs{fancyhead}, except that only \texttt{E,O,L,R} can be used.
+% This replaces the old calculation based on \cs{headwidth} and the marginpar
+% area.
+% \cs{headwidth} will be dynamically calculated in the headers/footers when
+% this is used.}
+% 
+% \changes{fancyhdr v2.1beta2}{2002/03/26}{\cs{fancyhfoffset} now also
+% takes \texttt{H,F} as possible letters in the argument to 
+% allow the header and footer widths to be different.\\
+% New commands \cs{fancyheadoffset} and \cs{fancyfootoffset} added comparable to
+% \cs{fancyhead} and \cs{fancyfoot}.\\
+% Errormessages and warnings have been made more informative.}
+%
+% \changes{fancyhdr v2.1x=fancyhdr v2.1}{2002/12/09}{The defaults for
+% \cs{footrulewidth}, \cs{plainheadrulewidth} and
+% \cs{plainfootrulewidth} are changed from \cs{z at skip} to 0pt. In this
+% way when someone inadvertantly uses \cs{setlength} to change any of these, the value
+% of \cs{z at skip} will not be changed, rather an errormessage will be given.}
+%
+% \changes{fancyhdr v3.0}{2004/03/03}{Release of version 3.0.}
+%
+% \changes{fancyhdr v3.1}{2004/10/07}{Added '\texttt{\cs{endlinechar}!=13}' to
+% \cs{f at nch@reset} to prevent problems with \cs{includegraphics} in
+% header/footer when \environment{verbatiminput} is active.}
+% 
+% \changes{fancyhdr v3.2}{2005/03/22}{Reset \cs{everypar} (the real one)
+% in \cs{f at nch@reset} because spanish.ldf does strange things with
+% \cs{everypar} between \guillemotleft\ and \guillemotright.}
+% 
+% \changes{fancyhdr v3.3}{2016/08/20}{Replace
+% `\texttt{\cs{@ifundefined}\{chapter\}}' with `\cs{ifx}\cs{chapter}\cs{@undefined}' 
+% because the former subtly makes \cs{chapter} equal to \cs{relax}, which may be
+% undesirable in some cases.}
+% 
+% \changes{fancyhdr v3.4}{2016/08/21}{Replace \cs{rm} by
+% \cs{normalfont}\cs{rmfamily} and \cs{sl} by \cs{normalfont}\cs{slshape}.}
+% 
+% \changes{fancyhdr v3.5}{2016/08/21}{Don't define \cs{footruleskip} if it is already defined.}
+% 
+% \changes{fancyhdr v3.6}{2016/08/27}{Added a \cs{ProvidesPackage} line.\\
+% Updated contact information.}
+% 
+% \changes{fancyhdr v3.7}{2016/08/28}{Removed \cs{normalfont} from default values, as every field
+% is already initialised with \cs{normalfont}.\\
+% Set \cs{hsize} to \cs{headwidth} in header/footer.}
+% 
+% \changes{fancyhdr v3.8}{2016/09/06}{Reset \bsbs, \cs{raggedleft},
+% \cs{raggedright} and \cs{centering} to their default values to avoid a
+% clash with the tabu package.\\
+% Move the redefinition of \cs{@makecol} to \texttt{\cs{begin}\{document\}} to
+% avoid a clash with the \Package{footmisc} package (and maybe others).\\
+% Define a working \cs{iffootnote} command.}
+%
+% \changes{fancyhdr v3.9}{2016/10/11}{Put everything in a \texttt{.dtx} file.}
+% \changes{fancyhdr v3.9}{2016/10/12}{Rename some macros to have 'f at nch@'
+% in their names, to get a more uniform naming scheme for internal macros.}
+%
+% \begin{macro}{\if at nch@mpty}
+% This macro tests if its argument is empty.
+%    \begin{macrocode}
+\def\if at nch@mpty#1{\def\temp at a{#1}\ifx\temp at a\@empty}
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\f at nch@def}
+% This macro defines another macro (usually a header or footer field).
+% Depending on the value of \cs{f at nch@gbl} the definition will be
+% global or local (the latter case is used in \cs{fancypagestyle}). If
+% the value (argument 2) is empty, a \cs{leavevmode} will be substituted.
+%  If it is not empty, a \cs{strut} will be added.
+%    \begin{macrocode}
+\def\f at nch@def#1#2{\if at nch@mpty{#2}\f at nch@gbl\def#1{\leavevmode}\else
+                                   \f at nch@gbl\def#1{#2\strut}\fi}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\f at nch@gbl}
+% Initialize \cs{f at nch@gbl} to \cs{global}.
+%    \begin{macrocode}
+\let\f at nch@gbl\global
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\f at nch@ifundefined}
+% This macro tests if a command is undefined. Older versions of
+% fancyhdr used \cs{@ifundefined}, but this had an undesired side effect
+% in the original \LaTeX{} (the command was made equal to \cs{relax} if
+% it was undefined). Another way was\\
+% \verb+\ifx\thecommand\undefined ...+ or \verb+\ifx\thecommand\@undefined ...+
+% but that could conflict with packages that use the \cs{@ifundefined}
+% method. \LaTeX{} versions later than 2018 have a definition of
+% \cs{@ifundefined} that avoids these problems, but not everybody may
+% have such a version installed. Therefore we define our own version
+% \cs{f at nch@ifundefined}.
+% This definition is copied from the \Package{tocloft} package by Peter
+% Wilson and Will Robertson.
+% \begin{macrocode}
+\newcommand{\f at nch@ifundefined}[1]{%
+  \begingroup\expandafter\expandafter\expandafter\endgroup
+  \expandafter\ifx\csname #1\endcsname\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+    \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\f at nch@errmsg}
+%   This macro generates an error message.
+% \changes{fancyhdr v3.10}{2019/01/25}{Use \cs{\f at nch@ifundefined} instead of \cs{ifx}.}
+% \changes{fancyhdr v3.10}{2019/01/25}{Use \cs{newcommand} instead of \cs{def}.}
+%    \begin{macrocode}
+\newcommand\f at nch@errmsg[1]{%
+  \f at nch@ifundefined{PackageError}{\errmessage{#1}}{\PackageError{Fancyhdr}{#1}{}}}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\f at nch@warning}
+% This macro generates a warning.
+% \changes{fancyhdr v3.10}{2019/01/25}{Use \cs{f at nch@ifundefined} instead of \cs{ifx}.}
+% \changes{fancyhdr v3.10}{2019/01/25}{Use \cs{newcommand} instead of \cs{def}.}
+%    \begin{macrocode}
+\newcommand\f at nch@warning[1]{%
+  \f at nch@ifundefined{PackageWarning}{\errmessage{#1}}{\PackageWarning{Fancyhdr}{#1}{}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\f at nch@forc}
+%   Usage: \cs{f at nch@forc} \cs{var} \texttt{\{charstring\}\{body\}}.\\
+%   Execute the body for each character in \texttt{charstring} bound
+%   to \cs{var}.
+%   This is similar to \LaTeX's \cs{@tfor}, but it expands the \texttt{charstring}.
+%    \begin{macrocode}
+% \changes{fancyhdr v3.10}{2019/01/25}{Use \cs{newcommand} instead of \cs{def}.}
+\newcommand{\f at nch@forc}[3]{\expandafter\f at rc\expandafter#1\expandafter{#2}{#3}}
+\newcommand{\f at rc}[3]{\def\temp at ty{#2}\ifx\@empty\temp at ty\else
+                                    \f at nch@rc#1#2\f at nch@rc{#3}\fi}
+\def\f at nch@rc#1#2#3\f at nch@rc#4{\def#1{#2}#4\f at rc#1{#3}{#4}}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\f at nch@for}
+%   Usage: \cs{f at nch@for}\cs{var}\texttt{\{list\}}\texttt{\{body\}} \\
+%   Execute the body for each element of the list, bound to \cs{var}.
+%   List elements are separated by commas. This is like \LaTeX's \cs{@for} but an empty
+%   list is treated as a list with an empty element.
+%
+%    \begin{macrocode}
+\newcommand{\f at nch@for}[3]{\edef\@fortmp{#2}%
+  \expandafter\@forloop#2,\@nil,\@nil\@@#1{#3}}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\f at nch@default}
+%   Usage: \cs{f at nch@default} \cs{var}\texttt{\{defaults\}\{argument\}} \\
+%   Sets \cs{var} to the characters
+%   from \texttt{defaults} appearing in \texttt{argument}, or to \texttt{defaults} if it would be
+%   empty. All characters are lowercased first.
+%
+%    \begin{macrocode}
+\newcommand\f at nch@default[3]{%
+  \edef\temp at a{\lowercase{\edef\noexpand\temp at a{#3}}}\temp at a \def#1{}%
+  \f at nch@forc\tmpf at ra{#2}%
+  {\expandafter\f at nch@ifin\tmpf at ra\temp at a{\edef#1{#1\tmpf at ra}}{}}%
+  \ifx\@empty#1\def#1{#2}\fi}
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\f at nch@ifin}
+%   Usage: \cs{f at nch@ifin} \meta{char} \meta{set} \meta{truecase} \meta{falsecase} \\
+% If \meta{char} is in \meta{set}, then \meta{truecase} else \meta{falsecase}.
+%    \begin{macrocode}
+\newcommand{\f at nch@ifin}[4]{%
+  \edef\temp at a{#2}\def\temp at b##1#1##2\temp at b{\def\temp at b{##1}}%
+  \expandafter\temp at b#2#1\temp at b\ifx\temp at a\temp at b #4\else #3\fi}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\fancyhead}
+% \changes{fancyhdr v3.9}{2016/10/12}{Let \cs{newcommand} do the
+% handling of the optional parameter.}
+% \begin{macro}{\fancyfoot}
+% \changes{fancyhdr v3.9}{2016/10/12}{Let \cs{newcommand} do the
+% handling of the optional parameter.}
+% \begin{macro}{\fancyhf}
+% \changes{fancyhdr v3.9}{2016/10/12}{Let \cs{newcommand} do the
+% handling of the optional parameter.}
+% These are the principal user macros. Pick up the parameters,
+% and supply an 'h' (\cs{fancyhead}) or 'f' (\cs{fancyfoot}).
+%    \begin{macrocode}
+\newcommand{\fancyhead}[2][]{\f at nch@fancyhf\fancyhead h[#1]{#2}}%
+\newcommand{\fancyfoot}[2][]{\f at nch@fancyhf\fancyfoot f[#1]{#2}}%
+\newcommand{\fancyhf}[2][]{\f at nch@fancyhf\fancyhf {}[#1]{#2}}%
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\fancyheadoffset}
+% \changes{fancyhdr v3.9}{2016/10/12}{Let \cs{newcommand} do the
+% handling of the optional parameter.}
+% \begin{macro}{\fancyfootoffset}
+% \changes{fancyhdr v3.9}{2016/10/12}{Let \cs{newcommand} do the
+% handling of the optional parameter.}
+% \begin{macro}{\fancyhfoffset}
+% \changes{fancyhdr v3.9}{2016/10/12}{Let \cs{newcommand} do the
+% handling of the optional parameter.}
+%   The commands for offsets.
+% Pick up the parameters,
+% and supply an 'h' (\cs{fancyheadoffset}) or 'f' (\cs{fancyfootoffset}).
+%    \begin{macrocode}
+\newcommand{\fancyheadoffset}[2][]{\f at nch@fancyhfoffs\fancyheadoffset h[#1]{#2}}%
+\newcommand{\fancyfootoffset}[2][]{\f at nch@fancyhfoffs\fancyfootoffset f[#1]{#2}}%
+\newcommand{\fancyhfoffset}[2][]{\f at nch@fancyhfoffs\fancyhfoffset {}[#1]{#2}}%
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\f at nch@fancyhf}
+% This macro interprets the parameters for the headers and footers.\\
+% Parameters:\\
+% (1) The user command that was used (like \cs{fancyhead}). This is used
+% for errors/warnings.\\
+% (2) \texttt{h} (for \cs{fancyhead}), \texttt{f} (for \cs{fancyfoot}),
+% or \texttt{\{\}} (for \cs{fancyhf}).\\
+% (3) The optional parameter that was given to these commands (default \texttt{[]}).\\
+% (4) The required parameter that was given to these commands.\\
+%   The header and footer fields are stored in command sequences with
+%   names of the form: \cs{f at nch@}\meta{x}\meta{y}\meta{z} with \meta{x} from
+%   \texttt{[eo]}, \meta{y} from \texttt{[lcr]} and \meta{z} from \texttt{[hf]}.
+%
+%    \begin{macrocode}
+\def\f at nch@fancyhf#1#2[#3]#4{%
+  \def\temp at c{}%
+  \f at nch@forc\tmpf at ra{#3}%
+  {\expandafter\f at nch@ifin\tmpf at ra{eolcrhf,EOLCRHF}%
+    {}{\edef\temp at c{\temp at c\tmpf at ra}}}%
+  \ifx\@empty\temp at c\else \f at nch@errmsg{Illegal char `\temp at c' in
+    \string#1 argument: [#3]}%
+  \fi \f at nch@for\temp at c{#3}%
+  {\f at nch@default\f at nch@@eo{eo}\temp at c \if at twoside\else \if\f at nch@@eo
+    e\f at nch@warning {\string#1's `E' option without twoside option is
+      useless}\fi\fi \f at nch@default\f at nch@@lcr{lcr}\temp at c
+    \f at nch@default\f at nch@@hf{hf}{#2\temp at c}%
+    \f at nch@forc\f at nch@eo\f at nch@@eo 
+        {\f at nch@forc\f at nch@lcr\f at nch@@lcr 
+          {\f at nch@forc\f at nch@hf\f at nch@@hf
+            {\expandafter\f at nch@def\csname
+              f at nch@\f at nch@eo\f at nch@lcr\f at nch@hf\endcsname {#4}}}}}}
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\f at nch@fancyhfoffs}
+% This macro interprets the parameters for the header and footer
+% offsets.\\
+% Parameters:\\
+% (1) The user command that was used (like \cs{fancyheadoffset}). This is used
+% for errors/warnings.\\
+% (2) \texttt{h} (for \cs{fancyheadoffset}), \texttt{f} (for \cs{fancyfootoffset}),
+% or \texttt{\{\}} (for \cs{fancyhfoffset}).\\
+% (3) The optional parameter that was given to these commands (default \texttt{[]}).\\
+% (4) The required parameter that was given to these commands.\\
+%   The header and footer offsets are stored in command sequences with
+%   names of the form: \cs{f at nch@O@}\meta{x}\meta{y}\meta{z} with \meta{x} from
+%   \texttt{[eo]}, \meta{y} from \texttt{[lr]} and \meta{z} from \texttt{[hf]}.
+% 
+%    \begin{macrocode}
+\def\f at nch@fancyhfoffs#1#2[#3]#4{%
+  \def\temp at c{}%
+  \f at nch@forc\tmpf at ra{#3}%
+  {\expandafter\f at nch@ifin\tmpf at ra{eolrhf,EOLRHF}%
+    {}{\edef\temp at c{\temp at c\tmpf at ra}}}%
+  \ifx\@empty\temp at c\else \f at nch@errmsg{Illegal char `\temp at c' in
+    \string#1 argument: [#3]}%
+  \fi \f at nch@for\temp at c{#3}%
+  {\f at nch@default\f at nch@@eo{eo}\temp at c \if at twoside\else \if\f at nch@@eo
+    e\f at nch@warning {\string#1's `E' option without twoside option is
+      useless}\fi\fi \f at nch@default\f at nch@@lcr{lr}\temp at c
+    \f at nch@default\f at nch@@hf{hf}{#2\temp at c}%
+    \f at nch@forc\f at nch@eo\f at nch@@eo 
+        {\f at nch@forc\f at nch@lcr\f at nch@@lcr
+          {\f at nch@forc\f at nch@hf\f at nch@@hf
+            {\expandafter\setlength\csname
+              f at nch@O@\f at nch@eo\f at nch@lcr\f at nch@hf\endcsname {#4}}}}}%
+  \f at nch@setoffs}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lhead}
+% \changes{fancyhdr v3.9}{2016/10/12}{Let \cs{newcommand} do the
+% handling of the optional parameter.}
+% \begin{macro}{\chead}
+% \changes{fancyhdr v3.9}{2016/10/12}{Let \cs{newcommand} do the
+% handling of the optional parameter.}
+% \begin{macro}{\rhead}
+% \changes{fancyhdr v3.9}{2016/10/12}{Let \cs{newcommand} do the
+% handling of the optional parameter.}
+% \begin{macro}{\lfoot}
+% \changes{fancyhdr v3.9}{2016/10/12}{Let \cs{newcommand} do the
+% handling of the optional parameter.}
+% \begin{macro}{\cfoot}
+% \changes{fancyhdr v3.9}{2016/10/12}{Let \cs{newcommand} do the
+% handling of the optional parameter.}
+% \begin{macro}{\rfoot}
+% \changes{fancyhdr v3.9}{2016/10/12}{Let \cs{newcommand} do the
+% handling of the optional parameter.}
+%   Fancyheadings version 1 commands. These are deprecated,
+%   but they continue to work for compatibility reasons. They have an
+%   optional parameter that is used as the value for even pages in a
+%   two-sided document. If this is not given (or if the document is not
+%   two-sided) the required parameter is used for both even and odd pages.
+%   Therefore the default value for the optional parameter is the
+%   required parameter. It is not possible to express this directly in
+%   the definition. Therefore we use a trick. Both parameters are store
+%   in a macro. For example for \cs{lhead} the parameter for even pages
+%   is stored in \cs{f at nch@elh}, and the one for odd pages in
+%   \cs{f at nch@olh}. For the others it is similar, just replace the
+%   \texttt{l} with \texttt{c} or \texttt{r}, and the \texttt{h} with
+%   \texttt{f}. In the body of the macro we first store the required
+%   parameter in \cs{f at nch@olh}, and we use this macro as default for
+%   the optional parameter. The optional parameter is then stored in
+%   \cs{f at nch@elh}. The order of the assignments is therefore important.
+%
+%    \begin{macrocode}
+\newcommand{\lhead}[2][\f at nch@olh]%
+                     {\f at nch@def\f at nch@olh{#2}\f at nch@def\f at nch@elh{#1}}
+\newcommand{\chead}[2][\f at nch@och]%
+                     {\f at nch@def\f at nch@och{#2}\f at nch@def\f at nch@ech{#1}}
+\newcommand{\rhead}[2][\f at nch@orh]%
+                     {\f at nch@def\f at nch@orh{#2}\f at nch@def\f at nch@erh{#1}}
+\newcommand{\lfoot}[2][\f at nch@olf]%
+                     {\f at nch@def\f at nch@olf{#2}\f at nch@def\f at nch@elf{#1}}
+\newcommand{\cfoot}[2][\f at nch@ocf]%
+                     {\f at nch@def\f at nch@ocf{#2}\f at nch@def\f at nch@ecf{#1}}
+\newcommand{\rfoot}[2][\f at nch@orf]%
+                     {\f at nch@def\f at nch@orf{#2}\f at nch@def\f at nch@erf{#1}}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\f at nch@headwidth}
+% Length parameter to be used for \cs{headwidth}. We use this rather
+% than defining \cs{headwidth} as a length paramater directly to protect
+% ourself to someone saying: \verb+\let\headwidth\textwidth+. 
+%    \begin{macrocode}
+\newlength{\f at nch@headwidth} \let\headwidth\f at nch@headwidth
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\f at nch@O at elh} 
+% \begin{macro}{\f at nch@O at erh} 
+% \begin{macro}{\f at nch@O at olh}
+% \begin{macro}{\f at nch@O at orh} 
+% \begin{macro}{\f at nch@O at elf} 
+% \begin{macro}{\f at nch@O at erf}
+% \begin{macro}{\f at nch@O at olf} 
+% \begin{macro}{\f at nch@O at orf}
+% Length parameters for the offsets.
+%    \begin{macrocode}
+\newlength{\f at nch@O at elh} 
+\newlength{\f at nch@O at erh} 
+\newlength{\f at nch@O at olh}
+\newlength{\f at nch@O at orh} 
+\newlength{\f at nch@O at elf} 
+\newlength{\f at nch@O at erf}
+\newlength{\f at nch@O at olf} 
+\newlength{\f at nch@O at orf}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% 
+% \begin{macro}{\headrulewidth}
+% \begin{macro}{\footrulewidth}
+%    \begin{macrocode}
+\newcommand{\headrulewidth}{0.4pt} 
+\newcommand{\footrulewidth}{0pt}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% 
+%  \begin{macro}{\footruleskip}
+%  Memoir also defines \cs{footruleskip}.
+%  Don't define \cs{footruleskip} if it is already defined.
+%    \begin{macrocode}
+\f at nch@ifundefined{footruleskip}%
+      {\newcommand{\footruleskip}{.3\normalbaselineskip}}{}
+%    \end{macrocode}
+% \end{macro}
+% 
+%  \begin{macro}{\plainheadrulewidth}
+%  \begin{macro}{\plainfootrulewidth}
+%   Fancyplain stuff shouldn't be used anymore (rather
+%   \texttt{\cs{fancypagestyle}\{plain\}} should be used), but we keep it for
+%   compatibility reasons.
+%
+%    \begin{macrocode}
+\newcommand{\plainheadrulewidth}{0pt}
+\newcommand{\plainfootrulewidth}{0pt}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% 
+% \begin{macro}{\if at fancyplain}
+% Boolean for the implementation of \cs{fancyplain}
+%    \begin{macrocode}
+\newif\if at fancyplain \@fancyplainfalse
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\fancyplain}
+% Deprecated macro
+%    \begin{macrocode}
+\def\fancyplain#1#2{\if at fancyplain#1\else#2\fi}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\headwidth}
+%   Initialize \cs{headwidth} with a magic constant.
+%    \begin{macrocode}
+\headwidth=-123456789sp
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\f at nch@raggedleft}
+% \begin{macro}{\f at nch@raggedright}
+% \begin{macro}{\f at nch@centering}
+% \begin{macro}{\f at nch@everypar}
+% Save the standard definitions of \cs{raggedleft}, \cs{raggedright},
+% \cs{centering} and \cs{everypar} so that we can reset them when we are
+% typesetting the headers and footers. Some packages change these to
+% incompatible values.
+%    \begin{macrocode}
+\let\f at nch@raggedleft\raggedleft 
+\let\f at nch@raggedright\raggedright
+\let\f at nch@centering\centering
+\let\f at nch@everypar\everypar
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\f at nch@reset}
+%   Command to reset various things in the headers: a.o. single spacing
+%   (taken from setspace.sty) and the catcode of ^^M and
+%   \cs{endlinechar} (so that epsf files
+%   in the header work if a verbatim crosses a page boundary) It also
+%   defines a \cs{nouppercase} command that disables \cs{uppercase} and
+%   \cs{Makeuppercase}. It can only be used in the headers and footers. Set
+%   \cs{hsize} to \cs{headwidth} (this helps for multicol); reset
+%   \bsbs, \cs{raggedleft}, \cs{raggedright} and \cs{centering} to
+%   their default values (for tabu), and \cs{everypar} to empty.\\
+%   The font is reset to \cs{normalfont}.
+%    \begin{macrocode}
+\def\f at nch@reset{\f at nch@everypar{}\restorecr\endlinechar=13
+  \let\\\@normalcr \let\raggedleft\f at nch@raggedleft
+  \let\raggedright\f at nch@raggedright \let\centering\f at nch@centering
+  \def\baselinestretch{1}%
+  \hsize=\headwidth
+  \def\nouppercase##1{{\let\uppercase\relax\let\MakeUppercase\relax
+      \expandafter\let\csname MakeUppercase \endcsname\relax##1}}%
+  \f at nch@ifundefined{@newbaseline} % NFSS not present; 2.09 or 2e
+  {\f at nch@ifundefined{@normalsize} {\normalsize} % for ucthesis.cls
+   {\@normalsize}}%
+  {\@newbaseline}% NFSS (2.09) present
+  }
+%    \end{macrocode}
+% \end{macro}
+%
+% Initialization of the head and foot text.
+%
+% The default values still contain \cs{fancyplain} for compatibility:
+% lefthead empty on ``plain'' pages, \cs{rightmark} on even, \cs{leftmark} on odd pages;
+% evenhead empty on ``plain'' pages, \cs{leftmark} on even, \cs{rightmark} on odd pages.
+%    \begin{macrocode}
+\fancyhf{}
+\if at twoside
+  \fancyhead[el,or]{\fancyplain{}{\slshape\rightmark}}
+  \fancyhead[er,ol]{\fancyplain{}{\slshape\leftmark}}
+\else
+  \fancyhead[l]{\fancyplain{}{\slshape\rightmark}}
+  \fancyhead[r]{\fancyplain{}{\slshape\leftmark}}
+\fi
+\fancyfoot[c]{\rmfamily\thepage} % page number
+%    \end{macrocode}
+%
+% \begin{macro}{\f at nch@vbox}
+% Make a \cs{vbox} with the header or footer. Check whether there is
+% enough space and give a warning if not.
+%   Use box 0 as a temp box and dimen 0 as temp dimen. This can be done,
+%   because this code will always be used inside another box, and
+%   therefore the changes are local.\\
+%   Parameter 1 is \cs{headheight} or \cs{footskip}, respectively.\\
+%   Parameter 2 is the contents of the box.
+%
+% \changes{fancyhdr v3.10}{2019/01/25}{Don't use \cs{global}\cs{setlength}.}
+% \changes{fancyhdr v3.10}{2019/01/26}{Use \cs{newcommand} instead of \cs{def}.}
+%    \begin{macrocode}
+\newcommand\f at nch@vbox[2]{%
+  \setbox0\vbox{#2}%
+  \ifdim\ht0>#1\relax
+    \f at nch@warning{%
+      \string#1 is too small (\the#1): ^^J%
+      Make it at least \the\ht0.^^J%
+      We now make it that large for the rest of the document.^^J%
+      This may cause the page layout to be inconsistent, however\@gobble
+    }%
+    \dimen0=#1\relax
+    \global#1=\ht0\relax
+    \ht0=\dimen0 %
+  \fi
+  \box0}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\f at nch@head}
+% \begin{macro}{\f at nch@foot}
+%   Put together a header or footer given the left, center and right
+%   text, fillers at left and right and a rule. The \cs{xlap} commands put
+%   the text into an hbox of zero size, so overlapping text does not
+%   generate an errormessage.\\ These macros have 5 parameters:\\
+%   1. LEFTSIDE BEARING.  This determines at which side the header will stick
+%   out. When \cs{fancyhfoffset} is used this calculates \cs{headwidth},
+%   otherwise it is \cs{hss} or \cs{relax} (after expansion). \\
+%   2. \cs{f at nch@olh}, \cs{f at nch@elh}, \cs{f at nch@olf} or \cs{f at nch@elf}.
+%   This is the left component. \\
+%   3. \cs{f at nch@och}, \cs{f at nch@ech}, \cs{f at nch@ocf} or \cs{f at nch@ecf}.
+%   This is the center component. \\
+%   4. \cs{f at nch@orh}, \cs{f at nch@erh}, \cs{f at nch@orf} or \cs{f at nch@erf}.
+%   This is the right component. \\
+%   5. RIGHTSIDE BEARING. This is always \cs{relax} or \cs{hss}
+%   (after expansion).
+%
+%    \begin{macrocode}
+\newcommand\f at nch@head[5]{%
+  #1%
+  \hbox to\headwidth{%
+    \f at nch@reset
+    \f at nch@vbox\headheight{%
+      \hbox{%
+        \rlap{\parbox[b]{\headwidth}{\raggedright#2}}%
+        \hfill
+        \parbox[b]{\headwidth}{\centering#3}%
+        \hfill
+        \llap{\parbox[b]{\headwidth}{\raggedleft#4}}%
+      }%
+      \headrule
+    }%
+  }%
+  #5%
+}
+%    \end{macrocode}
+%
+% \changes{fancyhdr v3.10}{2019/01/26}{Put \cs{footrule} in a \cs{vbox}
+% to accommodate for flexible footrules.}
+% \changes{fancyhdr v3.10}{2019/01/28}{Use \cs{unvbox} on the footrule \cs{vbox}
+% to preserve vertical spacing.}
+% \changes{fancyhdr v3.10}{2019/01/28}{Move \cs{footruleskip} outside of the \cs{footrule}
+% definition.}
+% We put the \cs{footrule} in a \cs{vbox} to accommodate for flexible
+% footrules (e.g. using \cs{hrulefill}), so that the \cs{headwidth} will
+% be used as the line width. But to preserve the vertical spacing we
+% then \cs{unvbox} this box.
+%
+%    \begin{macrocode}
+\newcommand\f at nch@foot[5]{%
+  #1%
+  \hbox to\headwidth{%
+    \f at nch@reset
+    \f at nch@vbox\footskip{%
+      \setbox0=\vbox{\footrule}\unvbox0
+      \vskip\footruleskip
+      \hbox{%
+        \rlap{\parbox[t]{\headwidth}{\raggedright#2}}%
+        \hfill
+        \parbox[t]{\headwidth}{\centering#3}%
+        \hfill
+        \llap{\parbox[t]{\headwidth}{\raggedleft#4}}%
+      }%
+    }%
+  }%
+  #5%
+}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\headrule}
+%    \begin{macrocode}
+\def\headrule{{\if at fancyplain\let\headrulewidth\plainheadrulewidth\fi
+    \hrule\@height\headrulewidth\@width\headwidth
+    \vskip-\headrulewidth}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\footrule}
+% \changes{fancyhdr v3.10}{2019/01/28}{Move \cs{footruleskip} outside of the \cs{footrule}
+% definition and remove useless \cs{vskip} at the top.}
+%    \begin{macrocode}
+\def\footrule{{\if at fancyplain\let\footrulewidth\plainfootrulewidth\fi
+    \hrule\@width\headwidth\@height\footrulewidth}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ps at fancy}
+% Pagestyle \texttt{fancy}
+%    \begin{macrocode}
+\def\ps at fancy{%
+  \f at nch@ifundefined{@chapapp}{\let\@chapapp\chaptername}{}% for amsbook
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\MakeUppercase}
+%   Define \MakeUppercase for old \LaTeX{}en. Note: we used \cs{def} rather
+%   than \cs{let}, so that \verb+\let\uppercase\relax+ (from the version 1
+%   documentation) will still work.
+%
+%    \begin{macrocode}
+\f at nch@ifundefined{MakeUppercase}{\def\MakeUppercase{\uppercase}}{}%
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\chaptermark}
+% \begin{macro}{\sectionmark}
+% \begin{macro}{\subsectionmark}
+% Standard definitions for \cs{chaptermark}, \cs{sectionmark} and \cs{subsectionmark}.
+% 
+%    \begin{macrocode}
+\f at nch@ifundefined{chapter}%
+ {\def\sectionmark##1{\markboth{\MakeUppercase{\ifnum \c at secnumdepth>\z@
+        \thesection\hskip 1em\relax
+      \fi ##1}}{}}%
+  \def\subsectionmark##1{\markright {\ifnum \c at secnumdepth >\@ne
+    \thesubsection\hskip 1em\relax \fi ##1}}}%
+ {\def\chaptermark##1{\markboth {\MakeUppercase{\ifnum
+      \c at secnumdepth>\m at ne \@chapapp\ \thechapter. \ \fi ##1}}{}}%
+\def\sectionmark##1{\markright{\MakeUppercase{\ifnum \c at secnumdepth >\z@
+      \thesection. \ \fi ##1}}}%
+}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% 
+% \begin{macro}{\ps at fancy}
+% Pagestyle \texttt{fancy}. \cs{ps@@fancy} is the real pagestyle
+% \texttt{fancy}, i.e. the non-plain one.
+%    \begin{macrocode}
+\ps@@fancy 
+\gdef\ps at fancy{\@fancyplainfalse\ps@@fancy}%
+%    \end{macrocode}
+% \end{macro}
+% 
+% Initialize \cs{headwidth} if the user didn't. If \cs{headwidth} ${}< 0$,
+% then the user did not initialize it, or they just added something to
+% it in the expectation that
+% it was initialized to \cs{textwidth}. We compensate this now. This loses if
+% the user intended to multiply it by a factor. But that case is more
+% likely done by saying something like \verb+\setlength{\headwidth}{1.2\textwidth}+. 
+% The documentation says you have to change \cs{headwidth} after the first call to
+% \verb+\pagestyle{fancy}+. This code is just to catch the most common cases were
+% that requirement is violated.
+%
+%    \begin{macrocode}
+\ifdim\headwidth<0sp
+    \global\advance\headwidth123456789sp\global\advance\headwidth\textwidth
+\fi}
+%    \end{macrocode}
+%
+% \begin{macro}{\ps at fancyplain}
+% The pagestyle \texttt{fancyplain} (deprecated).
+% 
+%    \begin{macrocode}
+\def\ps at fancyplain{\ps at fancy \let\ps at plain\ps at plain@fancy}
+\def\ps at plain@fancy{\@fancyplaintrue\ps@@fancy} 
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\ps@@empty}
+% Save the definition of \cs{ps at empty} (pagestyle \texttt{empty}).
+% 
+%    \begin{macrocode}
+\let\ps@@empty\ps at empty
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\ps@@fancy}
+% The actual pagestyle \texttt{fancy}. For amsbook/amsart, which do
+% strange things with \cs{topskip}, we start with \cs{ps@@empty}. We
+% construct the even and odd headers and footers from all the parts that
+% we have collected.
+%    \begin{macrocode}
+\def\ps@@fancy{%
+  \ps@@empty
+  \def\@mkboth{\protect\markboth}%
+  \def\@oddhead{\f at nch@head\f at nch@Oolh\f at nch@olh\f at nch@och\f at nch@orh\f at nch@Oorh}%
+  \def\@oddfoot{\f at nch@foot\f at nch@Oolf\f at nch@olf\f at nch@ocf\f at nch@orf\f at nch@Oorf}%
+  \def\@evenhead{\f at nch@head\f at nch@Oelh\f at nch@elh\f at nch@ech\f at nch@erh\f at nch@Oerh}%
+  \def\@evenfoot{\f at nch@foot\f at nch@Oelf\f at nch@elf\f at nch@ecf\f at nch@erf\f at nch@Oerf}%
+}
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\f at nch@Oolh}
+% \begin{macro}{\f at nch@Oorh}
+% \begin{macro}{\f at nch@Oelh}
+% \begin{macro}{\f at nch@Oerh}
+% \begin{macro}{\f at nch@Oolf}
+% \begin{macro}{\f at nch@Oorf}
+% \begin{macro}{\f at nch@Oelf}
+% \begin{macro}{\f at nch@Oerf}
+%   Default definitions for compatibility mode: These cause the
+%   header/footer to take the defined \cs{headwidth} as its width and if
+%   required to shift it in the direction of the marginpar area.
+%
+%    \begin{macrocode}
+\def\f at nch@Oolh{\if at reversemargin\hss\else\relax\fi}
+\def\f at nch@Oorh{\if at reversemargin\relax\else\hss\fi}
+\let\f at nch@Oelh\f at nch@Oorh 
+\let\f at nch@Oerh\f at nch@Oolh
+\let\f at nch@Oolf\f at nch@Oolh
+\let\f at nch@Oorf\f at nch@Oorh
+\let\f at nch@Oelf\f at nch@Oelh
+\let\f at nch@Oerf\f at nch@Oerh
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\f at nch@offsolh}
+% \begin{macro}{\f at nch@offselh}
+%   New definitions for the use of \cs{fancyhfoffset},
+%   \cs{fancyheadoffset}, \cs{fancyfootoffset}.  These calculate the
+%   \cs{headwidth} from \cs{textwidth} and the specified offsets.\\
+%   First for the header.
+%
+%    \begin{macrocode}
+\def\f at nch@offsolh{\headwidth=\textwidth\advance\headwidth\f at nch@O at olh
+                   \advance\headwidth\f at nch@O at orh\hskip-\f at nch@O at olh}
+\def\f at nch@offselh{\headwidth=\textwidth\advance\headwidth\f at nch@O at elh
+                   \advance\headwidth\f at nch@O at erh\hskip-\f at nch@O at elh}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\f at nch@offsolh}
+% \begin{macro}{\f at nch@offselh}
+% The same for the footer.
+% 
+%    \begin{macrocode}
+\def\f at nch@offsolf{\headwidth=\textwidth\advance\headwidth\f at nch@O at olf
+                   \advance\headwidth\f at nch@O at orf\hskip-\f at nch@O at olf}
+\def\f at nch@offself{\headwidth=\textwidth\advance\headwidth\f at nch@O at elf
+                   \advance\headwidth\f at nch@O at erf\hskip-\f at nch@O at elf}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\f at nch@setoffs}
+% Set the offset parts to be used in the construction of the headers and
+% footers. Depending on \cs{f at nch@gbl} it will be done globally (for
+% pagestyle \texttt{fancy}) or locally (for \cs{fancypagestyle}).
+% Just in case \verb+\let\headwidth\textwidth+ was used, we reset
+% \cs{headwidth} to the length parameter that it should be.
+%    \begin{macrocode}
+\def\f at nch@setoffs{%
+  \f at nch@gbl\let\headwidth\f at nch@headwidth
+  \f at nch@gbl\let\f at nch@Oolh\f at nch@offsolh
+  \f at nch@gbl\let\f at nch@Oelh\f at nch@offselh \f at nch@gbl\let\f at nch@Oorh\hss
+  \f at nch@gbl\let\f at nch@Oerh\hss \f at nch@gbl\let\f at nch@Oolf\f at nch@offsolf
+  \f at nch@gbl\let\f at nch@Oelf\f at nch@offself \f at nch@gbl\let\f at nch@Oorf\hss
+  \f at nch@gbl\let\f at nch@Oerf\hss
+}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\iff at nch@footnote}
+% \begin{macro}{\@makecol}
+%   Redefine \cs{@makecol} so that we can capture if there are
+%   top/bottom floats, footnotes or if we are on a float page. Because
+%   of a clash with the footmisc package we do this at
+%   \verb+\begin{document}+.\\
+%   We need a boolean \cs{iff at nch@footnote} to capture if there was a footnote.
+%
+%    \begin{macrocode}
+\newif\iff at nch@footnote 
+\AtBeginDocument{%
+  \let\latex at makecol\@makecol
+  \def\@makecol{\ifvoid\footins\f at nch@footnotefalse\else\f at nch@footnotetrue\fi
+    \let\topfloat\@toplist\let\botfloat\@botlist\latex at makecol}%
+}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% 
+% \begin{macro}{\iftopfloat}
+% \begin{macro}{\ifbotfloat}
+% \begin{macro}{\iffloatpage}
+% \begin{macro}{\iffootnote}
+% These can be used in a header/footer field to make them conditional on
+% the presence of floats and/or footnotes.
+%    \begin{macrocode}
+\newcommand\iftopfloat[2]{\ifx\topfloat\empty #2\else #1\fi}%
+\newcommand\ifbotfloat[2]{\ifx\botfloat\empty #2\else #1\fi}%
+\newcommand\iffloatpage[2]{\if at fcolmade #1\else #2\fi}%
+\newcommand\iffootnote[2]{\iff at nch@footnote #1\else #2\fi}%
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\fancypagestyle}
+%    \begin{macrocode}
+\newcommand{\fancypagestyle}[2]{%
+  \@namedef{ps@#1}{\let\f at nch@gbl\relax#2\relax\ps at fancy}}
+%    \end{macrocode}
+% \end{macro}
+%</fancyhdr>
+%
+% \section{extramarks.sty}
+%
+%<*extramarks>
+% \changes{extramarks v1.99e}{2000/10/11}{Added a few \% marks to get rid
+% of unwanted spaces, and \cs{endinput}. \\
+% Added LPPL license clause.}
+% \changes{extramarks v2.0beta}{2002/03/12}{Adapted for the new
+% implementation of marks in \LaTeX{} to solve bug latex/3203. \\
+% Added symmetric commands \cs{firstrightmark}, \cs{lastleftmark}, \cs{firstleftxmark},
+% \cs{firstrightxmark}, \cs{lastrightxmark}, \cs{lastleftxmark}, \cs{topleftxmark} and
+% \cs{toprightxmark}.}
+% \changes{extramarks v2.0x=fancyhdr v 2.0}{2004/03/03}{version 2.0 Release.}
+% \changes{extramarks v2.1}{2016/08/27}{Added a \cs{ProvidesPackage} line.\\
+% Updated contact information.}
+% \changes{extramarks v3.9}{2016/10/12}{Unify version number with \Package{fancyhdr.sty}.}
+% 
+% \changes{extramarks v3.9a}{2017/06/30}{Restore \cs{newtoks}\cs{@temptokenb}}
+% \begin{macro}{\@temptokenb}
+% A token register to store some marks information
+%    \begin{macrocode}
+\newtoks\@temptokenb
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\unrestored at protected@xdef}
+% Define this macro just in case it isn't defined (should be part of \LaTeX).
+%    \begin{macrocode}
+\providecommand\unrestored at protected@xdef{%
+  \let\protect\@unexpandable at protect \xdef}
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\markboth}
+% Our own definition of \cs{markboth}, mainly because \cs{@markboth}
+% gets more parameters.
+%    \begin{macrocode}
+\def\markboth#1#2{%
+  \begingroup
+  \let\label\relax \let\index\relax \let\glossary\relax
+  \expandafter\@markboth\@themark{#1}{#2}%
+  \@temptokena \expandafter{\@themark}%
+  \mark{\the\@temptokena}%
+  \endgroup
+  \if at nobreak\ifvmode\nobreak\fi\fi}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\markright}
+%   We use the standard definition of \cs{markright}. No use to duplicate here.
+% \end{macro}
+% 
+% \begin{macro}{\@markboth}
+%   Note: put \texttt{\#3\#4} in toks register.
+%    \begin{macrocode}
+\def\@markboth#1#2#3#4#5#6{\@temptokena{{#3}{#4}}%
+  \unrestored at protected@xdef\@themark{{#5}{#6}\the\@temptokena}}
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\@markright}
+%   Note: put \texttt{\#1} and \texttt{\#3\#4} in toks registers.
+%   Maybe I can get rid of the extra \cs{@temptokenb} by doing the expansion
+%   of \texttt{\#5} to a temp separately. But then, nowadays registers
+%   are plenty.
+%    \begin{macrocode}
+\def\@markright#1#2#3#4#5{\@temptokena{#1}\@temptokenb{{#3}{#4}}%
+  \unrestored at protected@xdef\@themark{{\the\@temptokena}{#5}\the\@temptokenb}}
+%    \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\@leftmark}
+% \begin{macro}{\@rightmark}
+% Internal macros to get the standard marks.
+%    \begin{macrocode}
+\def\@leftmark#1#2#3#4{#1} 
+\def\@rightmark#1#2#3#4{#2}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+
+% \begin{macro}{\leftmark}
+% \begin{macro}{\rightmark}
+% \begin{macro}{\firstleftmark}
+% \begin{macro}{\lastrightmark}
+% \begin{macro}{\firstrightmark}
+% \begin{macro}{\lastleftmark}
+% The standard marks + the new ones (based on the standard marks info).
+%    \begin{macrocode}
+\def\leftmark{\expandafter\@leftmark
+      \botmark\@empty\@empty\@empty\@empty}
+\def\rightmark{\expandafter\@rightmark
+      \firstmark\@empty\@empty\@empty\@empty}
+\def\firstleftmark{\expandafter\@leftmark
+      \firstmark\@empty\@empty\@empty\@empty}
+\def\lastrightmark{\expandafter\@rightmark
+      \botmark\@empty\@empty\@empty\@empty}
+\let\firstrightmark \rightmark
+\let\lastleftmark \leftmark
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+
+% \begin{macro}{\@themark}
+% This is where the marks information is stored.
+%    \begin{macrocode}
+\def\@themark{{}{}{}{}}
+%    \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\extramarks}
+% This command is used to define the extra marks.
+%    \begin{macrocode}
+\newcommand\extramarks[2]{%
+  \begingroup
+  \let\label\relax \let\index\relax \let\glossary\relax
+  \expandafter\@markextra\@themark{#1}{#2}%
+  \@temptokena \expandafter{\@themark}%
+  \mark{\the\@temptokena}%
+  \endgroup
+  \if at nobreak\ifvmode\nobreak\fi\fi}
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\@markextra}
+% Internal macro to store the extra marks in the marks storage.\\
+%   Note: Put \texttt{\#1\#2} in toks register.
+%    \begin{macrocode}
+\def\@markextra#1#2#3#4#5#6{\@temptokena {{#1}{#2}}%
+  \unrestored at protected@xdef\@themark{\the\@temptokena{#5}{#6}}}
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\firstleftxmark}
+% \begin{macro}{\firstrightxmark}
+% \begin{macro}{\topleftxmark}
+% \begin{macro}{\toprightxmark}
+% \begin{macro}{\lastleftxmark}
+% \begin{macro}{\lastrightxmark}
+% \begin{macro}{\firstxmark}
+% \begin{macro}{\lastxmark}
+% \begin{macro}{\topxmark}
+% The new extra marks.
+%    \begin{macrocode}
+\def\firstleftxmark{\expandafter\@leftxmark
+      \firstmark\@empty\@empty\@empty\@empty}
+\def\firstrightxmark{\expandafter\@rightxmark
+      \firstmark\@empty\@empty\@empty\@empty}
+\def\topleftxmark{\expandafter\@leftxmark
+      \topmark\@empty\@empty\@empty\@empty}
+\def\toprightxmark{\expandafter\@rightxmark
+      \topmark\@empty\@empty\@empty\@empty}
+\def\lastleftxmark{\expandafter\@leftxmark
+      \botmark\@empty\@empty\@empty\@empty}
+\def\lastrightxmark{\expandafter\@rightxmark
+      \botmark\@empty\@empty\@empty\@empty}
+\let\firstxmark\firstleftxmark
+\let\lastxmark\lastrightxmark
+\let\topxmark\topleftxmark
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% 
+% \begin{macro}{\@tleftxmark}
+% \begin{macro}{\@rightxmark}
+% Internal macros to extract the extra marks out of the marks storage.
+%    \begin{macrocode}
+\def\@leftxmark#1#2#3#4{#3}
+\def\@rightxmark#1#2#3#4{#4}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% 
+%</extramarks>
+%
+% \section{fancyheadings.sty}
+%
+% Fancyheadings.sty was the original style file (as they were called
+% then) to implement fancy headers and footers in \LaTeX. This was in the time
+% when MSDOS was stil quite a dominant ``Operating System''. It had a
+% nasty property (amongst others): filenames consisted of at most 8
+% characters + a 3 character extension. This meant that the name
+% '\texttt{fancyheadings.sty}' was internally truncated in MSDOS to
+% '\texttt{fancyhea.sty}', although it was perfectly OK to say
+% 'fancyheadings' in \LaTeX. However, some people started to write also
+% 'fancyhea' in \LaTeX{} documents, which made them unportable to for
+% example Unix systems, unless there a copy or link was made to
+% 'fancyhea.sty'. I found this so annoying that I decided to rename the
+% package to 'fancyhdr.sty'. This package has evolved to a version that
+% is incompatible with the original 'fancyheadings'. Fancyheadings
+% should no longer be used, therefore this package is provided that
+% issues a clear warning and then switches to fancyhdr.
+%
+%
+%<*fancyheadings>
+%    \begin{macrocode}
+\PackageWarningNoLine{fancyheadings}{%
+  Please stop using fancyheadings!\MessageBreak
+  Use fancyhdr instead.\MessageBreak
+  We will call fancyhdr with the very same\MessageBreak
+  options you passed to fancyheadings.\MessageBreak
+  \MessageBreak
+  fancyhdr is 99 percent compatible with\MessageBreak
+  fancyheadings. The only incompatibility is\MessageBreak
+  that \protect\headrulewidth\space and \protect\footrulewidth\space 
+     and\MessageBreak
+  their \protect\plain... versions are no longer length\MessageBreak
+  parameters, but normal macros (to be changed\MessageBreak
+  with \protect\renewcommand\space rather than \protect\setlength).}
+\RequirePackage{fancyhdr}
+%    \end{macrocode}
+%</fancyheadings>
+%
+%
+% \Finale
+\endinput


Property changes on: trunk/Master/texmf-dist/source/latex/fancyhdr/fancyhdr.dtx
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/source/latex/fancyhdr/fancyhdr.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/fancyhdr/fancyhdr.ins	                        (rev 0)
+++ trunk/Master/texmf-dist/source/latex/fancyhdr/fancyhdr.ins	2019-01-31 22:39:45 UTC (rev 49886)
@@ -0,0 +1,58 @@
+%%
+%% Copyright (C) 2016 by Piet van Oostrum <piet at vanoostrum.org>
+%%
+%% This file may be distributed and/or modified under the conditions of
+%% the LaTeX Project Public License, either version 1.3 of this license
+%% or (at your option) any later version.  The latest version of this
+%% license is in:
+%% 
+%%    http://www.latex-project.org/lppl.txt
+%% 
+%% and version 1.3 or later is part of all distributions of LaTeX version
+%% 2005/12/01 or later.
+%%
+
+\input docstrip.tex
+\keepsilent
+
+\usedir{tex/latex/fancyhdr}
+
+\preamble
+
+This is a generated file.
+
+This file may be distributed and/or modified under the conditions of
+the LaTeX Project Public License, either version 1.3 of this license
+or (at your option) any later version.  The latest version of this
+license is in:
+
+   http://www.latex-project.org/lppl.txt
+
+and version 1.3 or later is part of all distributions of LaTeX version
+2005/12/01 or later.
+
+\endpreamble
+
+\askforoverwritefalse
+\generate{\file{fancyhdr.sty}{\from{\jobname.dtx}{fancyhdr}}}
+\generate{\file{fancyheadings.sty}{\from{\jobname.dtx}{fancyheadings}}}
+\generate{\file{extramarks.sty}{\from{\jobname.dtx}{extramarks}}}
+
+\obeyspaces
+\Msg{*************************************************************}
+\Msg{*                                                           *}
+\Msg{* To finish the installation you have to move the following *}
+\Msg{* file into a directory searched by TeX:                    *}
+\Msg{*                                                           *}
+\Msg{*     fancyhdr.sty                                          *}
+\Msg{*     fancyheadings.sty                                     *}
+\Msg{*     extramarks.sty                                        *}
+\Msg{*                                                           *}
+\Msg{* To produce the documentation run the file \jobname.dtx    *}
+\Msg{* through LaTeX.                                            *}
+\Msg{*                                                           *}
+\Msg{* Happy TeXing!                                             *}
+\Msg{*                                                           *}
+\Msg{*************************************************************}
+
+\endbatchfile

Modified: trunk/Master/texmf-dist/tex/latex/fancyhdr/extramarks.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/fancyhdr/extramarks.sty	2019-01-31 19:27:00 UTC (rev 49885)
+++ trunk/Master/texmf-dist/tex/latex/fancyhdr/extramarks.sty	2019-01-31 22:39:45 UTC (rev 49886)
@@ -21,9 +21,9 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{extramarks}
-           [2017/06/30 v3.9a
+           [2019/01/31 v3.10
                   Extra marks for LaTeX]
-% Copyright (C) 1994-2016 by Piet van Oostrum <piet at vanoostrum.org>
+% Copyright (C) 1994-2019 by Piet van Oostrum <piet at vanoostrum.org>
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \newtoks\@temptokenb
 \providecommand\unrestored at protected@xdef{%

Modified: trunk/Master/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty	2019-01-31 19:27:00 UTC (rev 49885)
+++ trunk/Master/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty	2019-01-31 22:39:45 UTC (rev 49886)
@@ -21,22 +21,27 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{fancyhdr}%
-           [2017/06/30 v3.9a
+           [2019/01/31 v3.10
                   Extensive control of page headers and footers]%
-% Copyright (C) 1994-2016 by Piet van Oostrum <piet at vanoostrum.org>
+% Copyright (C) 1994-2019 by Piet van Oostrum <piet at vanoostrum.org>
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \def\if at nch@mpty#1{\def\temp at a{#1}\ifx\temp at a\@empty}
 \def\f at nch@def#1#2{\if at nch@mpty{#2}\f at nch@gbl\def#1{\leavevmode}\else
                                    \f at nch@gbl\def#1{#2\strut}\fi}
 \let\f at nch@gbl\global
-\def\f at nch@errmsg#1{%
-  \ifx\PackageError\undefined \errmessage{#1}\else
-  \PackageError{Fancyhdr}{#1}{}\fi}
-\def\f at nch@warning#1{%
-  \ifx\PackageWarning\undefined \errmessage{#1}\else
-  \PackageWarning{Fancyhdr}{#1}{}\fi}
-\def\f at nch@forc#1#2#3{\expandafter\f at rc\expandafter#1\expandafter{#2}{#3}}
-\def\f at rc#1#2#3{\def\temp at ty{#2}\ifx\@empty\temp at ty\else
+\newcommand{\f at nch@ifundefined}[1]{%
+  \begingroup\expandafter\expandafter\expandafter\endgroup
+  \expandafter\ifx\csname #1\endcsname\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+    \fi}
+\newcommand\f at nch@errmsg[1]{%
+  \f at nch@ifundefined{PackageError}{\errmessage{#1}}{\PackageError{Fancyhdr}{#1}{}}}
+\newcommand\f at nch@warning[1]{%
+  \f at nch@ifundefined{PackageWarning}{\errmessage{#1}}{\PackageWarning{Fancyhdr}{#1}{}}}
+\newcommand{\f at nch@forc}[3]{\expandafter\f at rc\expandafter#1\expandafter{#2}{#3}}
+\newcommand{\f at rc}[3]{\def\temp at ty{#2}\ifx\@empty\temp at ty\else
                                     \f at nch@rc#1#2\f at nch@rc{#3}\fi}
 \def\f at nch@rc#1#2#3\f at nch@rc#4{\def#1{#2}#4\f at rc#1{#3}{#4}}
 \newcommand{\f at nch@for}[3]{\edef\@fortmp{#2}%
@@ -113,7 +118,7 @@
 \newlength{\f at nch@O at orf}
 \newcommand{\headrulewidth}{0.4pt}
 \newcommand{\footrulewidth}{0pt}
-\@ifundefined{footruleskip}%
+\f at nch@ifundefined{footruleskip}%
       {\newcommand{\footruleskip}{.3\normalbaselineskip}}{}
 \newcommand{\plainheadrulewidth}{0pt}
 \newcommand{\plainfootrulewidth}{0pt}
@@ -131,11 +136,11 @@
   \hsize=\headwidth
   \def\nouppercase##1{{\let\uppercase\relax\let\MakeUppercase\relax
       \expandafter\let\csname MakeUppercase \endcsname\relax##1}}%
-  \ifx\undefined\@newbaseline % NFSS not present; 2.09 or 2e
-  \ifx\@normalsize\undefined \normalsize % for ucthesis.cls
-  \else \@normalsize \fi \else % NFSS (2.09) present
-  \@newbaseline%
-  \fi}
+  \f at nch@ifundefined{@newbaseline} % NFSS not present; 2.09 or 2e
+  {\f at nch@ifundefined{@normalsize} {\normalsize} % for ucthesis.cls
+   {\@normalsize}}%
+  {\@newbaseline}% NFSS (2.09) present
+  }
 \fancyhf{}
 \if at twoside
   \fancyhead[el,or]{\fancyplain{}{\slshape\rightmark}}
@@ -145,40 +150,74 @@
   \fancyhead[r]{\fancyplain{}{\slshape\leftmark}}
 \fi
 \fancyfoot[c]{\rmfamily\thepage} % page number
-\def\f at nch@vbox#1#2{\setbox0\vbox{#2}\ifdim\ht0>#1\f at nch@warning
-  {\string#1 is too small (\the#1): ^^J Make it at least \the\ht0.^^J We
-    now make it that large for the rest of the document.^^J This may
-    cause the page layout to be inconsistent, however\@gobble}%
-  \dimen0=#1\global\setlength{#1}{\ht0}\ht0=\dimen0\fi \box0}
-\def\f at nch@head#1#2#3#4#5{#1\hbox to\headwidth{\f at nch@reset
-    \f at nch@vbox\headheight{\hbox
-      {\rlap{\parbox[b]{\headwidth}{\raggedright#2}}\hfill
-        \parbox[b]{\headwidth}{\centering#3}\hfill
-        \llap{\parbox[b]{\headwidth}{\raggedleft#4}}}\headrule}}#5}
-\def\f at nch@foot#1#2#3#4#5{#1\hbox to\headwidth{\f at nch@reset
-    \f at nch@vbox\footskip{\footrule
-      \hbox{\rlap{\parbox[t]{\headwidth}{\raggedright#2}}\hfill
-        \parbox[t]{\headwidth}{\centering#3}\hfill
-        \llap{\parbox[t]{\headwidth}{\raggedleft#4}}}}}#5}
+\newcommand\f at nch@vbox[2]{%
+  \setbox0\vbox{#2}%
+  \ifdim\ht0>#1\relax
+    \f at nch@warning{%
+      \string#1 is too small (\the#1): ^^J%
+      Make it at least \the\ht0.^^J%
+      We now make it that large for the rest of the document.^^J%
+      This may cause the page layout to be inconsistent, however\@gobble
+    }%
+    \dimen0=#1\relax
+    \global#1=\ht0\relax
+    \ht0=\dimen0 %
+  \fi
+  \box0}
+\newcommand\f at nch@head[5]{%
+  #1%
+  \hbox to\headwidth{%
+    \f at nch@reset
+    \f at nch@vbox\headheight{%
+      \hbox{%
+        \rlap{\parbox[b]{\headwidth}{\raggedright#2}}%
+        \hfill
+        \parbox[b]{\headwidth}{\centering#3}%
+        \hfill
+        \llap{\parbox[b]{\headwidth}{\raggedleft#4}}%
+      }%
+      \headrule
+    }%
+  }%
+  #5%
+}
+\newcommand\f at nch@foot[5]{%
+  #1%
+  \hbox to\headwidth{%
+    \f at nch@reset
+    \f at nch@vbox\footskip{%
+      \setbox0=\vbox{\footrule}\unvbox0
+      \vskip\footruleskip
+      \hbox{%
+        \rlap{\parbox[t]{\headwidth}{\raggedright#2}}%
+        \hfill
+        \parbox[t]{\headwidth}{\centering#3}%
+        \hfill
+        \llap{\parbox[t]{\headwidth}{\raggedleft#4}}%
+      }%
+    }%
+  }%
+  #5%
+}
 \def\headrule{{\if at fancyplain\let\headrulewidth\plainheadrulewidth\fi
     \hrule\@height\headrulewidth\@width\headwidth
     \vskip-\headrulewidth}}
 \def\footrule{{\if at fancyplain\let\footrulewidth\plainfootrulewidth\fi
-    \vskip-\footruleskip\vskip-\footrulewidth
-    \hrule\@width\headwidth\@height\footrulewidth\vskip\footruleskip}}
+    \hrule\@width\headwidth\@height\footrulewidth}}
 \def\ps at fancy{%
-  \@ifundefined{@chapapp}{\let\@chapapp\chaptername}{}% for amsbook
-\@ifundefined{MakeUppercase}{\def\MakeUppercase{\uppercase}}{}%
-\ifx\chapter\@undefined \def\sectionmark##1{\markboth
-  {\MakeUppercase{\ifnum \c at secnumdepth>\z@ \thesection\hskip 1em\relax
+  \f at nch@ifundefined{@chapapp}{\let\@chapapp\chaptername}{}% for amsbook
+\f at nch@ifundefined{MakeUppercase}{\def\MakeUppercase{\uppercase}}{}%
+\f at nch@ifundefined{chapter}%
+ {\def\sectionmark##1{\markboth{\MakeUppercase{\ifnum \c at secnumdepth>\z@
+        \thesection\hskip 1em\relax
       \fi ##1}}{}}%
-\def\subsectionmark##1{\markright {\ifnum \c at secnumdepth >\@ne
-    \thesubsection\hskip 1em\relax \fi ##1}}%
-\else \def\chaptermark##1{\markboth {\MakeUppercase{\ifnum
+  \def\subsectionmark##1{\markright {\ifnum \c at secnumdepth >\@ne
+    \thesubsection\hskip 1em\relax \fi ##1}}}%
+ {\def\chaptermark##1{\markboth {\MakeUppercase{\ifnum
       \c at secnumdepth>\m at ne \@chapapp\ \thechapter. \ \fi ##1}}{}}%
 \def\sectionmark##1{\markright{\MakeUppercase{\ifnum \c at secnumdepth >\z@
       \thesection. \ \fi ##1}}}%
-\fi
+}
 \ps@@fancy
 \gdef\ps at fancy{\@fancyplainfalse\ps@@fancy}%
 \ifdim\headwidth<0sp

Modified: trunk/Master/texmf-dist/tex/latex/fancyhdr/fancyheadings.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/fancyhdr/fancyheadings.sty	2019-01-31 19:27:00 UTC (rev 49885)
+++ trunk/Master/texmf-dist/tex/latex/fancyhdr/fancyheadings.sty	2019-01-31 22:39:45 UTC (rev 49886)
@@ -21,7 +21,7 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{fancyheadings}
-           [2017/06/30 v3.9a
+           [2019/01/31 v3.10
                   Legacy package to call fancyhdr]
 % Public domain
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



More information about the tex-live-commits mailing list