texlive[64977] Master/texmf-dist: fancyhdr (9nov22)

commits+karl at tug.org commits+karl at tug.org
Wed Nov 9 22:07:39 CET 2022


Revision: 64977
          http://tug.org/svn/texlive?view=revision&revision=64977
Author:   karl
Date:     2022-11-09 22:07:39 +0100 (Wed, 09 Nov 2022)
Log Message:
-----------
fancyhdr (9nov22)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/fancyhdr/README
    trunk/Master/texmf-dist/doc/latex/fancyhdr/fancyhdr.pdf
    trunk/Master/texmf-dist/source/latex/fancyhdr/fancyhdr.dtx
    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

Modified: trunk/Master/texmf-dist/doc/latex/fancyhdr/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fancyhdr/README	2022-11-09 21:07:23 UTC (rev 64976)
+++ trunk/Master/texmf-dist/doc/latex/fancyhdr/README	2022-11-09 21:07:39 UTC (rev 64977)
@@ -25,7 +25,7 @@
 boxedminipage.sty (CTAN:/macros/latex/contrib/boxedminipage) and
 refcount.sty (CTAN:/macros/latex/contrib/oberdiek/) installed.
 
-This is version 4.0.3 of fancyhdr.sty and extramarks.sty. They are
+This is version 4.1 of fancyhdr.sty and extramarks.sty. They are
 described in the forthcoming third edition of The LaTeX Companion.
 Extramarks.sty has not been changed, except for the version and
 copyright information.

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

Modified: trunk/Master/texmf-dist/source/latex/fancyhdr/fancyhdr.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/fancyhdr/fancyhdr.dtx	2022-11-09 21:07:23 UTC (rev 64976)
+++ trunk/Master/texmf-dist/source/latex/fancyhdr/fancyhdr.dtx	2022-11-09 21:07:39 UTC (rev 64977)
@@ -26,7 +26,7 @@
 %<fancyhdr>\ProvidesPackage{fancyhdr}%
 %<fancyheadings>\ProvidesPackage{fancyheadings}
 %<extramarks>\ProvidesPackage{extramarks}
-%<fancyhdr|fancyheadings|extramarks>           [2022/05/18 v4.0.3
+%<fancyhdr|fancyheadings|extramarks>           [2022/11/09 v4.1
 %<fancyhdr>                  Extensive control of page headers and footers]%
 %<fancyheadings>                  Legacy package to call fancyhdr]
 %<extramarks>                  Extra marks for LaTeX]
@@ -139,22 +139,22 @@
 }
 \fancypagestyle{showstruts}{%
   \fancyhead[L]{%
-    \ifthenelse{\value{page}=\pageref{showstruts}}%
+    \ifthenelse{\value{page}=\getpagerefnumber{showstruts}}%
       {\strutheader}%
       {\rightmark}%
   }
   \fancyfoot[L]{%
-    \ifthenelse{\value{page}=\pageref{showstruts}}%
+    \ifthenelse{\value{page}=\getpagerefnumber{showstruts}}%
       {\strutfooter}%
       {}%
   }
   \fancyheadinit{%
-    \ifthenelse{\value{page}=\pageref{showstruts}}%
+    \ifthenelse{\value{page}=\getpagerefnumber{showstruts}}%
       {\renewcommand{\headruleskip}{4pt}}%
       {\renewcommand{\headruleskip}{0pt}}%
   }
   \fancyfootinit{%
-    \ifthenelse{\value{page}=\pageref{showstruts}}%
+    \ifthenelse{\value{page}=\getpagerefnumber{showstruts}}%
       {\renewcommand{\footrulewidth}{0.4pt}}%
       {\renewcommand{\footrulewidth}{0pt}}%
   }
@@ -291,6 +291,8 @@
 % \texttt{compatV3} & keep some behaviour (now considered undesirable) as in version~3 \\
 %          & (see section~\ref{sec:options} and section~\ref{sec:warning} on
 %                                              page~\pageref{page:warning}) \\
+% \texttt{twoside} & use two-sided headers and footers even in one-sided documents \\
+%          & for \Package{fancyhdr}-based pagestyles (version 4.1 or later) \\
 % \texttt{headings} & redefine the \texttt{headings} page style to be fancy-based \\
 % \texttt{myheadings} & redefine the \texttt{myheadings} page style to be fancy-based \\
 % \bottomrule
@@ -298,6 +300,7 @@
 % \end{center}
 % \OPTindex{nocheck}
 % \OPTindex{compatV3}
+% \OPTindex{twoside}
 % \OPTindex{headings}
 % \OPTindex{myheadings}
 % \DescribeMacro{\fancyhead}
@@ -353,7 +356,7 @@
 % \cs{fancyheadinit} and \cs{fancyfootinit} can be used to define
 % initialisation code for the header and footer, respectively, and
 % \cs{fancyhfinit} defines both of these. These commands are only
-% available in fancyhdr version~4.0 and later. See section~\ref{sec:change}.
+% available in \Package{fancyhdr} version~4.0 and later. See section~\ref{sec:change}.
 %
 % \DescribeMacro{\fancycenter}
 % (Only in version~4.0 and later.) The command \cs{fancycenter} packs 3
@@ -465,11 +468,11 @@
 %
 % 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
+% command. On two-sided 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
+% in a two-sided 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
@@ -571,7 +574,7 @@
 % 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
+% install it in 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:
@@ -957,7 +960,7 @@
 % \end{quote}
 % % The following options are supported:
 % \begin{center}
-% \OPTindex{nocheck}\OPTindex{compatV3}\OPTindex{headings}\OPTindex{myheadings}
+% \OPTindex{nocheck}\OPTindex{compatV3}\OPTindex{twoside}\OPTindex{headings}\OPTindex{myheadings}
 % \begin{tabular}{ l l }
 % \toprule
 % Option & Meaning \\
@@ -964,6 +967,8 @@
 % \midrule
 % \texttt{nocheck} & do not check the heights of the header and footer \\
 % \texttt{compatV3} & keep some behaviour (now considered undesirable) as in version~3 \\
+% \texttt{twoside} & use two-sided headers and footers even in one-sided documents \\
+%          & for \Package{fancyhdr}-based pagestyles (version 4.1 or later) \\
 % \texttt{headings} & redefine the \texttt{headings} page style to be fancy-based \\
 % \texttt{myheadings} & redefine the \texttt{myheadings} page style to be fancy-based \\
 % \bottomrule
@@ -996,6 +1001,13 @@
 %   The option is scheduled to disappear in version~5 of
 %   \Package{fancyhdr}.
 %
+% \item \OPTindex{twoside}Option \texttt{twoside} implements two-sided headers
+% and footers in one-sided documents (version 4.1 or later). This applies only
+% for \Package{fancyhdr}-based pagestyles. This option doesn't do anything
+% special for two-sided documents (\texttt{twoside} documentclass option), as
+% these already have that functionality. And with the \texttt{twoside}
+% documentclass option that does apply to other pagestyles as well.
+%
 % \item \PSindex{headings}\PSindex{myheadings}\OPTindex{headings}\OPTindex{myheadings}
 %   The options \texttt{headings} and \texttt{myheadings} redefine the
 %   corresponding page style with fancyhdr commands (including a
@@ -1167,7 +1179,7 @@
 % 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.
+% \cs{MakeUppercase} and \cs{uppercase} are changed into identity operations.
 %
 % ^^A \Example
 % \begin{verbatim}
@@ -1758,6 +1770,7 @@
 % 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}
+% \TTindex{lastpage}
 % available which you can use with \Package{fancyhdr} as follows:
 %
 % \begin{verbatim}
@@ -1774,18 +1787,28 @@
 % 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
+% The value of the \texttt{LastPage}\TTindex{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:
+% contain the text ``Please turn over'', this can be done by checking if
+% the page number is odd, and if it is equal to the number of the last page.
 %
+% We use the macro \cs{getpagerefnumber} from the package\TTindex{refcount}
+% \Package{refcount}, because \cs{pageref} isn't always usable in a
+% numerical context (it is meant for typesetting only). This is also done in
+% following similar examples.
+%
+% \TTindex{ifthen}\TTindex{lastpage}\TTindex{refcount}
 % \begin{verbatim}
+% \usepackage{ifthen}
 % \usepackage{lastpage}
-% \usepackage{ifthen}
+% \usepackage{refcount}
 % ...
-% \fancyfoot[R]{\ifthenelse{\isodd{\value{page}} \and \not
-%      \(\value{page}=\pageref{LastPage}\)}{please turn over}{}}
+% \fancyfoot[R]{%
+%   \ifthenelse{\isodd{\value{page}} \and
+%     \not \( \value{page}=\getpagerefnumber{LastPage} \) }%
+%       {Please turn over}{}%
+% }
 % \end{verbatim}
 %
 % In order to get the number of pages correctly used, you usually have
@@ -2022,12 +2045,14 @@
 % \end{verbatim}
 % ^^A\Example
 % we define a new pagestyle that makes the choice:
+% \TTindex{ifthen}\TTindex{refcount}
 % \begin{verbatim}
 % \usepackage{ifthen}
+% \usepackage{refcount}
 % . . .
 % \fancypagestyle{switch}{
 %   \fancyhead[LE,RO]{%
-%     \ifthenelse{\value{page}=\pageref{otherpagestyle}}
+%     \ifthenelse{\value{page}=\getpagerefnumber{otherpagestyle}}
 %       {MYFANCY SECTION}
 %       {\textsl{\rightmark}}}
 % }
@@ -2085,7 +2110,7 @@
 % \begin{verbatim}
 % %%% NOTE: This does not work %%%%
 % \renewcommand{\footrulewidth}{%
-%   \ifthenelse{\value{page}=\pageref{otherpagestyle}}{0.4pt}{0pt}%
+%   \ifthenelse{\value{page}=\getpagerefnumber{otherpagestyle}}{0.4pt}{0pt}%
 % }
 % \end{verbatim}
 % For cases like this \Package{fancyhdr} version~4.0 and later has some
@@ -2103,15 +2128,16 @@
 % \cs{footrulewidth} depending on the page number. So instead of putting
 % the test inside the definition of \cs{headruleskip}, we can put it
 % outside, and then we can use the command \cs{ifthenelse}. So we put
-% the following in \Cmd{pagestyle\{switch\}}:
+% the following in \Cmd{pagestyle\{switch\}}\footnote{Assuming we have
+% already loaded package \Package{refcount}.}:
 % \begin{verbatim}
 %   \fancyheadinit{%
-%     \ifthenelse{\value{page}=\pageref{otherpagestyle}}
+%     \ifthenelse{\value{page}=\getpagerefnumber{otherpagestyle}}
 %       {\renewcommand{\headruleskip}{4pt}}
 %       {\renewcommand{\headruleskip}{0pt}}
 %   }
 %   \fancyfootinit{%
-%     \ifthenelse{\value{page}=\pageref{otherpagestyle}}
+%     \ifthenelse{\value{page}=\getpagerefnumber{otherpagestyle}}
 %       {\renewcommand{\footrulewidth}{0.4pt}}
 %       {\renewcommand{\footrulewidth}{0pt}}
 %   }
@@ -2120,22 +2146,22 @@
 % \begin{verbatim}
 % \fancypagestyle{showstruts}{%
 %   \fancyhead[L]{%
-%     \ifthenelse{\value{page}=\pageref{showstruts}}%
+%     \ifthenelse{\value{page}=\getpagerefnumber{showstruts}}%
 %       {\strutheader}%
 %       {\rightmark}%
 %   }
 %   \fancyfoot[L]{%
-%     \ifthenelse{\value{page}=\pageref{showstruts}}%
+%     \ifthenelse{\value{page}=\getpagerefnumber{showstruts}}%
 %       {\strutfooter}%
 %       {}%
 %   }
 %   \fancyheadinit{%
-%     \ifthenelse{\value{page}=\pageref{showstruts}}%
+%     \ifthenelse{\value{page}=\getpagerefnumber{showstruts}}%
 %       {\renewcommand{\headruleskip}{4pt}}%
 %       {\renewcommand{\headruleskip}{0pt}}%
 %   }
 %   \fancyfootinit{%
-%     \ifthenelse{\value{page}=\pageref{showstruts}}%
+%     \ifthenelse{\value{page}=\getpagerefnumber{showstruts}}%
 %       {\renewcommand{\footrulewidth}{0.4pt}}%
 %       {\renewcommand{\footrulewidth}{0pt}}%
 %   }
@@ -2156,11 +2182,11 @@
 % header and/or footer, for example to get large, red text in the
 % headers and footers on this specific page:
 % \begin{verbatim}
-%   \fancyhfinit{%
-%     \ifthenelse{\value{page}=\pageref{otherpagestyle}}
-%       {\color{red}\Large}
-%       {}
-%     }
+%  \fancyhfinit{%
+%    \ifthenelse{\value{page}=\getpagerefnumber{otherpagestyle}}
+%      {\color{red}\Large}
+%      {}
+%  }
 % \end{verbatim}
 %
 % \subsection{Changing the page style of the next page}
@@ -2998,6 +3024,13 @@
 %   \item Initialize \cs{@mkboth} in \texttt{extramarks.sty} so that
 %     it will pick up changes to \cs{markboth}.
 %   \end{itemize}
+% \item Version 4.1, Sept 6-Nov 9, 2022
+%   \begin{itemize}
+%   \item Implement \texttt{twoside} package option to allow two-sided headers
+%     and footers in one-sided documents.
+%   \item Make \Package{fancyhdr} compatible with the document class \Package{newlfm}.
+%   \item Make \cs{nouppercase} compatible with newer definitions of \cs{MakeUppercase}.
+%   \end{itemize}
 % \end{itemize}
 %
 %
@@ -3305,7 +3338,7 @@
 % 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.
+% Warning added for the use of '\texttt{E}' option when \texttt{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:
@@ -3408,6 +3441,20 @@
 % \end{macro}
 % \end{macro}
 %
+% \begin{macro}{\iff at nch@twoside}
+% Boolean for the \texttt{twoside} option.
+% \changes{fancyhdr v4.1}{2022/09/06}{Implement \texttt{twoside} option.}
+% \OPTindex{twoside}
+% This is only set if the document itself is not two-sided.
+%    \begin{macrocode}
+\newif\iff at nch@twoside
+\f at nch@twosidefalse
+\DeclareOption{twoside}{%
+  \if at twoside\else\f at nch@twosidetrue\fi
+}
+%    \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
@@ -3688,8 +3735,21 @@
 % \end{macro}
 % \end{macro}
 %
+% \begin{macro}{\f at nch@fancyhf at Echeck}
+% \changes{fancyhdr v4.1}{2022/09/06}{Implement \texttt{twoside} option.}
+% Macro for warning if `E' is used without `twoside' option.
+%    \begin{macrocode}
+\def\f at nch@fancyhf at Echeck#1{%
+  \if at twoside\else
+    \iff at nch@twoside\else
+      \if\f at nch@@eo e%
+        \f at nch@warning {\string#1's `E' option without twoside option is useless.\MessageBreak
+          Please consider using the `twoside' option}%
+  \fi\fi\fi
+}
 % \begin{macro}{\f at nch@fancyhf}
 % \changes{fancyhdr v4.0.2}{2022/05/10}{Make \cs{f at nch@fancyhf} \cs{long}.}
+% \changes{fancyhdr v4.1}{2022/09/06}{Implement \texttt{twoside} option.}
 % This macro interprets the parameters for the headers and footers.\\
 % Parameters:\\
 % (1) The user command that was used (like \cs{fancyhead}). This is used
@@ -3711,9 +3771,9 @@
   \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@@eo{eo}\temp at c
+    \f at nch@fancyhf at Echeck{#1}%
+    \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
@@ -3724,6 +3784,7 @@
 % \end{macro}
 %
 % \begin{macro}{\f at nch@fancyhfoffs}
+% \changes{fancyhdr v4.1}{2022/09/06}{Implement \texttt{twoside} option.}
 % This macro interprets the parameters for the header and footer
 % offsets.\\
 % Parameters:\\
@@ -3746,9 +3807,9 @@
   \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@@eo{eo}\temp at c
+    \f at nch@fancyhf at Echeck{#1}%
+    \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
@@ -3943,14 +4004,27 @@
 %   their default values (for tabu), and \cs{everypar} to empty.\\
 %   The font is reset to \cs{normalfont}. Actually this is done in the
 %   \LaTeX{} output routine, so we don't have to do it here.
+%   \changes{fancyhdr v4.1}{2022/11/09}{Change \cs{nouppercase} to work with
+%     new definition of \cs{MakeUppercase}.}
+% \begin{macro}{\f at nch@noUppercase}
+%   We want \cs{nouppercase} to work with the various evolutionary stages of
+%   \cs{MakeUppercase}. The current version (2022/11/09) accepts an optional
+%   argument with a language specification. Therefore we define a dummy macro
+%   \cs{f at nch@noUppercase} which copies its mandatory agument, as a
+%   replacement for \cs{MakeUppercase} while \cs{nouppercase} is active.
 %    \begin{macrocode}
+\newcommand\f at nch@noUppercase[2][]{#2}
 \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}}%
+  \def\nouppercase##1{{%
+      \let\uppercase\relax\let\MakeUppercase\f at nch@noUppercase
+      \expandafter\let\csname MakeUppercase \endcsname\relax
+      \expandafter\def\csname MakeUppercase\space\space\space\endcsname
+                                                   [####1]####2{####2}%
+      ##1}}%
   \f at nch@ifundefined{@newbaseline} % NFSS not present; 2.09 or 2e
   {\f at nch@ifundefined{@normalsize} {\normalsize} % for ucthesis.cls
    {\@normalsize}}%
@@ -3958,6 +4032,7 @@
   }
 %    \end{macrocode}
 % \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\fancycenter}
 % \changes{fancyhdr v4.0}{2019/03/15}{Macro \cs{fancycenter} added}
@@ -4392,6 +4467,7 @@
 %
 % \begin{macro}{\ps at f@nch at fancycore}
 % \changes{fancyhdr v4.0}{2019/03/21}{Rename \cs{ps@@fancy} to \cs{ps at f@nch at fancycore}}
+% \changes{fancyhdr v4.1}{2022/09/06}{Implement \texttt{twoside} option.}
 % The actual implementation of pagestyle \texttt{fancy}. For amsbook/amsart, which do
 % strange things with \cs{topskip}, we start with \cs{f at nch@ps at empty}. We
 % construct the even and odd headers and footers from all the parts that
@@ -4400,8 +4476,30 @@
 \def\ps at f@nch at fancycore{%
   \f at nch@ps at 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\f at nch@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\@oddhead{%
+    \iff at nch@twoside
+      \ifodd\c at page
+        \f at nch@oddhead
+      \else
+        \@evenhead
+      \fi
+    \else
+      \f at nch@oddhead
+    \fi
+  }
+  \def\f at nch@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\@oddfoot{%
+    \iff at nch@twoside
+      \ifodd\c at page
+        \f at nch@oddfoot
+      \else
+        \@evenfoot
+      \fi
+    \else
+      \f at nch@oddfoot
+    \fi
+  }
   \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}%
 }
@@ -4567,6 +4665,30 @@
 }%
 %    \end{macrocode}
 % \end{macro}
+% \changes{fancyhdr v4.1}{202/09/16}{Support for class \Package{newlfm}.}
+% The (really outdated) document class \Package{newlfm} uses some internal
+% \Package{fancyhdr} commands that have gotten new names. So here we check if
+% that class is loaded and then we redefine the affected \Package{newlfm} macros.
+% We have to do some of the redefinitions in \cs{AtBeginDocument}, as
+% \Package{fancyhdr} is loaded before the affected macros are defined. Also
+% the macro \cs{@zfancyhead} is only called once, with wrong (outdated)
+% parameters, so instead of changing the call of the macro, we substitute the
+% right parameters inline.
+%    \begin{macrocode}
+\@ifclassloaded{newlfm}
+{
+  \let\ps@@empty\f at nch@ps at empty
+  \AtBeginDocument{%
+    \renewcommand{\@zfancyhead}[5]{\relax\hbox to\headwidth{\f at nch@reset
+      \@zfancyvbox\headheight{\hbox
+        {\rlap{\parbox[b]{\headwidth}{\raggedright\f at nch@olh}}\hfill
+          \parbox[b]{\headwidth}{\centering\f at nch@olh}\hfill
+          \llap{\parbox[b]{\headwidth}{\raggedleft\f at nch@orh}}}%
+        \zheadrule}}\relax}%
+  }
+}
+{}
+%    \end{macrocode}
 %</fancyhdr>
 %
 % \section{extramarks.sty}

Modified: trunk/Master/texmf-dist/tex/latex/fancyhdr/extramarks.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/fancyhdr/extramarks.sty	2022-11-09 21:07:23 UTC (rev 64976)
+++ trunk/Master/texmf-dist/tex/latex/fancyhdr/extramarks.sty	2022-11-09 21:07:39 UTC (rev 64977)
@@ -21,7 +21,7 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{extramarks}
-           [2022/05/18 v4.0.3
+           [2022/11/09 v4.1
                   Extra marks for LaTeX]
 % Copyright (C) 1994-2022 by Pieter van Oostrum <pieter at vanoostrum.org>
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Modified: trunk/Master/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty	2022-11-09 21:07:23 UTC (rev 64976)
+++ trunk/Master/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty	2022-11-09 21:07:39 UTC (rev 64977)
@@ -21,7 +21,7 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{fancyhdr}%
-           [2022/05/18 v4.0.3
+           [2022/11/09 v4.1
                   Extensive control of page headers and footers]%
 % Copyright (C) 1994-2022 by Pieter van Oostrum <pieter at vanoostrum.org>
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -37,6 +37,11 @@
   \let\f at nch@gbl\global
   \f at nch@compatViiitrue
 }
+\newif\iff at nch@twoside
+\f at nch@twosidefalse
+\DeclareOption{twoside}{%
+  \if at twoside\else\f at nch@twosidetrue\fi
+}
 \newcommand\f at nch@def[2]{\if at nch@mpty{#2}\f at nch@gbl\def#1{\leavevmode}\else
                                    \f at nch@gbl\def#1{#2\strut}\fi}
 \newcommand{\f at nch@ifundefined}[1]{%
@@ -148,6 +153,14 @@
 \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}}%
+\def\f at nch@fancyhf at Echeck#1{%
+  \if at twoside\else
+    \iff at nch@twoside\else
+      \if\f at nch@@eo e%
+        \f at nch@warning {\string#1's `E' option without twoside option is useless.\MessageBreak
+          Please consider using the `twoside' option}%
+  \fi\fi\fi
+}
 \long\def\f at nch@fancyhf#1#2[#3]#4{%
   \def\temp at c{}%
   \f at nch@forc\tmpf at ra{#3}%
@@ -156,9 +169,9 @@
   \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@@eo{eo}\temp at c
+    \f at nch@fancyhf at Echeck{#1}%
+    \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
@@ -173,9 +186,9 @@
   \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@@eo{eo}\temp at c
+    \f at nch@fancyhf at Echeck{#1}%
+    \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
@@ -219,13 +232,18 @@
 \let\f at nch@raggedright\raggedright
 \let\f at nch@centering\centering
 \let\f at nch@everypar\everypar
+\newcommand\f at nch@noUppercase[2][]{#2}
 \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}}%
+  \def\nouppercase##1{{%
+      \let\uppercase\relax\let\MakeUppercase\f at nch@noUppercase
+      \expandafter\let\csname MakeUppercase \endcsname\relax
+      \expandafter\def\csname MakeUppercase\space\space\space\endcsname
+                                                   [####1]####2{####2}%
+      ##1}}%
   \f at nch@ifundefined{@newbaseline} % NFSS not present; 2.09 or 2e
   {\f at nch@ifundefined{@normalsize} {\normalsize} % for ucthesis.cls
    {\@normalsize}}%
@@ -391,8 +409,30 @@
 \def\ps at f@nch at fancycore{%
   \f at nch@ps at 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\f at nch@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\@oddhead{%
+    \iff at nch@twoside
+      \ifodd\c at page
+        \f at nch@oddhead
+      \else
+        \@evenhead
+      \fi
+    \else
+      \f at nch@oddhead
+    \fi
+  }
+  \def\f at nch@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\@oddfoot{%
+    \iff at nch@twoside
+      \ifodd\c at page
+        \f at nch@oddfoot
+      \else
+        \@evenfoot
+      \fi
+    \else
+      \f at nch@oddfoot
+    \fi
+  }
   \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}%
 }
@@ -451,6 +491,19 @@
     }%
   }%
 }%
+\@ifclassloaded{newlfm}
+{
+  \let\ps@@empty\f at nch@ps at empty
+  \AtBeginDocument{%
+    \renewcommand{\@zfancyhead}[5]{\relax\hbox to\headwidth{\f at nch@reset
+      \@zfancyvbox\headheight{\hbox
+        {\rlap{\parbox[b]{\headwidth}{\raggedright\f at nch@olh}}\hfill
+          \parbox[b]{\headwidth}{\centering\f at nch@olh}\hfill
+          \llap{\parbox[b]{\headwidth}{\raggedleft\f at nch@orh}}}%
+        \zheadrule}}\relax}%
+  }
+}
+{}
 \endinput
 %%
 %% End of file `fancyhdr.sty'.

Modified: trunk/Master/texmf-dist/tex/latex/fancyhdr/fancyheadings.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/fancyhdr/fancyheadings.sty	2022-11-09 21:07:23 UTC (rev 64976)
+++ trunk/Master/texmf-dist/tex/latex/fancyhdr/fancyheadings.sty	2022-11-09 21:07:39 UTC (rev 64977)
@@ -21,7 +21,7 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{fancyheadings}
-           [2022/05/18 v4.0.3
+           [2022/11/09 v4.1
                   Legacy package to call fancyhdr]
 % Public domain
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



More information about the tex-live-commits mailing list.