texlive[73133] Master/texmf-dist: fancyhdr
commits+karl at tug.org
commits+karl at tug.org
Sun Dec 15 22:30:39 CET 2024
Revision: 73133
https://tug.org/svn/texlive?view=revision&revision=73133
Author: karl
Date: 2024-12-15 22:30:38 +0100 (Sun, 15 Dec 2024)
Log Message:
-----------
fancyhdr
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
Modified: trunk/Master/texmf-dist/doc/latex/fancyhdr/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fancyhdr/README 2024-12-15 21:15:55 UTC (rev 73132)
+++ trunk/Master/texmf-dist/doc/latex/fancyhdr/README 2024-12-15 21:30:38 UTC (rev 73133)
@@ -5,10 +5,11 @@
and footers, and for controlling their use (for example, at times when
LaTeX would automatically change the heading style in use).
-This is version 4.4 of fancyhdr.sty and extramarks.sty. They are
+This is version 4.5 of fancyhdr.sty and extramarks.sty. They are
described in the third edition of The LaTeX Companion.
-The distribution package (fancyhdr.zip) consists of the following files:
+The distribution package from CTAN (e.g. fancyhdr.zip)
+consists of the following files:
README This file
fancyhdr.dtx The complete source of the package and documentation
@@ -17,23 +18,22 @@
After processing (by tex) of fancyhdr.ins, the following package files will be generated:
-fancyhdr.sty v4.4 2024/11/20 the LaTeX package
-extramarks.sty v4.4 2024/11/20 a package for additional marks
+fancyhdr.sty v4.5 2024/12/09 the LaTeX package
+extramarks.sty v4.5 2024/12/09 a package for additional marks
fancyheadings.sty v4.1 2022/11/09 this loads fancyhdr with a warning message
-If you have a user distribution package (fancyhdr-dist-4.4.zip),
+If you have a user distribution package from github (fancyhdr-dist-4.5.zip),
then you don't have to do this processing.
-If you have a source distribution fancyhdr-4.4.zip, it will also contain
-the .sty files, but not the .pdf file.
-To recreate the .sty files run
+If you have a source distribution from github (fancyhdr-4.5.zip),
+it will also contain the .sty files, but not the .pdf file.
+To create fancyhdr.pdf, either just run the 'make' command, or:
+latexmk fancyhdr.dtx
+To recreate the .sty files run:
tex fancyhdr.ins
-To create fancyhdr.pdf, either just run the 'make' command, or
-latexmk fancyhdr.dtx
-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 package fancyheadings included here is an ancient version of fancyhdr.
+It should not be used anymore. It just loads fancyhdr with a warning message.
The documentation (fancyhdr.dtx/fancyhdr.pdf) describes both
fancyhdr.sty and extramarks.sty.
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 2024-12-15 21:15:55 UTC (rev 73132)
+++ trunk/Master/texmf-dist/source/latex/fancyhdr/fancyhdr.dtx 2024-12-15 21:30:38 UTC (rev 73133)
@@ -26,7 +26,7 @@
%<fancyhdr>\ProvidesPackage{fancyhdr}%
%<fancyheadings>\ProvidesPackage{fancyheadings}
%<extramarks>\ProvidesPackage{extramarks}
-%<fancyhdr|extramarks> [2024/11/20 v4.4
+%<fancyhdr|extramarks> [2024/12/09 v4.5
%<fancyhdr> Extensive control of page headers and footers]%
%<fancyheadings> [2022/11/09 v4.1
%<fancyheadings> Legacy package to call fancyhdr]
@@ -77,6 +77,7 @@
\renewcommand{\textfraction}{0.05}
\setlength{\emergencystretch}{4em}
\addtolength{\textheight}{-0.5in} % make it print better on US letter paper
+\setlength\IndexMin{4cm}
\makeatletter
\renewcommand\l at section {\@dottedtocline{1}{1.5em}{2.3em}}
\makeatother
@@ -205,6 +206,16 @@
% \DoNotIndex{\@ne}
% \DoNotIndex{\advance,\begingroup,\catcode,\closein}
% \DoNotIndex{\closeout,\day,\def,\edef,\else,\empty,\@empty,\endgroup}
+% \ProvideDocElement[printtype=\textit{hook},idxtype=hook,idxgroup=Hooks]{Hook}{hookdecl}%
+% \newcommand\makedate{}
+% \def\makedate#1/#2/#3/{%
+% \date{%
+% \ifcase #2\or
+% Jan\or Feb\or March\or Apr\or May\or June\or
+% July\or Aug\or Sept\or Oct\or Nov\or Dec\fi~\number #3,
+% #1}%
+% }
+% \expandafter\makedate\filedate/
%
% \title{The \Package{fancyhdr} and \Package{extramarks}
% packages\\{\normalsize version \fileversion.}}
@@ -2210,6 +2221,95 @@
% }
% \end{verbatim}
%
+% \subsection{\Package{Fancyhdr} hooks}
+% \label{sec:hooks}
+%
+% \LaTeX{} has a system of \emph{hooks}\index{hooks} since the 2020/10/01 release.
+% This allows packages and classes (and other \LaTeX{} software) to
+% define points in its code where other \LaTeX{} code can insert a piece
+% of code. For more details, see \emph{The \LaTeX{} Companion, Third
+% Edition}, part I, pp. 671ff or the documentation that can be read
+% with the command `\texttt{texdoc lthooks-doc}'.
+%
+% \Package{Fancyhdr} version 4.5 or later defines a number of hooks to be executed at the
+% beginning or end of the header and/or footer, if your \LaTeX{} version
+% supports it. The hooks are defined in
+% mirrored pairs, which means the second one of the pair is executed in the
+% reverse order compared to the first one (see the hooks documentation).
+% \begin{description}
+% \item[\texttt{fancyhdr/before}, \texttt{fancyhdr/after}]
+% \TTindex{fancyhdr/before}\TTindex{fancyhdr/after}
+% these are executed before the
+% header or footer is constructed, and after the header or footer is
+% finished, respectively.
+% \item[\texttt{fancyhdr/head/begin}, \texttt{fancyhdr/head/end}]
+% \TTindex{fancyhdr/head/begin}\TTindex{fancyhdr/head/end}
+% these are run at the
+% beginning and the end of the header construction, respectively
+% \item[\texttt{fancyhdr/foot/begin}, \texttt{fancyhdr/foot/end}]
+% \TTindex{fancyhdr/foot/begin}\TTindex{fancyhdr/foot/end}
+% these are run at the
+% beginning and the end of the footer construction, respectively
+% \end{description}
+%
+% The interaction of the hooks and the \cs{fancyhfinit} code described in
+% the previous section with the construction of the
+% header and footer is as follows: for the header construction
+% \begin{itemize}
+% \item first the \texttt{fancyhdr/before} hooks are run, then the
+% \texttt{fancyhdr/head/begin} hooks, then the \cs{fancyheadinit} code.
+% Then the header is constructed. Finally, the
+% \texttt{fancyhdr/head/end} hooks are run followed by the
+% \texttt{fancyhdr/after} hooks.
+% \item For the construction of the footer, it is similar, just replace
+% \texttt{head} by \texttt{foot}.
+% \item Note that between the construction of the header and the footer,
+% \LaTeX{} builds the body of the page. This process consists mainly of
+% putting boxes next to each other, and \Package{fancyhdr} does not
+% interfere with this, and neither should the hook code.
+% \end{itemize}
+%
+% The reason there are separate \texttt{fancyhdr/before} and
+% \texttt{fancyhdr/after} hooks and the \texttt{head} and \texttt{foot}
+% hooks, is
+% \begin{enumerate}
+% \item If you want to use the same hooks for headers and footers, use
+% the \texttt{fancyhdr/before} and \texttt{fancyhdr/after} hooks. This
+% prevents you to have to specify the same hook code twice.
+% \item If you want to have different hooks for the header and footer,
+% use the \texttt{head} and \texttt{foot} hooks.
+% \end{enumerate}
+% The \texttt{after} and \texttt{end} hooks are meant to undo changes
+% made in the \texttt{before} and \texttt{begin} hooks, respectively. If
+% the hooks make only local changes (which is recommended), the \TeX{}
+% grouping mechanism will take care of this, so you can leave out the
+% \texttt{after} and \texttt{end} hooks in that case.
+%
+% At first sight it may seem that the \cs{fancyhfinit} mechanism is no
+% longer useful with the introduction of hooks. One reason it exists is
+% that hooks were not available at the time it was introduced, and for
+% compatibility reasons it remains. However, there are some significant
+% differences between the \cs{fancyhfinit} mechanism and the hook
+% mechanism, so you should choose carefully which one to use.
+% \begin{itemize}
+% \item Hooks are global, but the \cs{fancyhfinit} declarations are
+% local. That is, if \cs{fancyhfinit} (or its siblings
+% \texttt{fancyheadinit} or \cs{fancyfootinit}) are given in a \TeX{}
+% group, they last until the end of the group. They will disappear
+% outside of the group, or be reset to the value they had outside of the group.
+% \item \cs{fancyhfinit} is meant to be used by the user who writes the
+% document, i.e. it is meant for the current document.
+% \cs{fancyhfinit} \emph{should not be used by package or class writers
+% and similar. They should use the hooks mechanism.} On the other hand
+% the user can also use hooks in the document instead of, or in addition
+% to the \cs{fancyhfinit} mechanism.
+% \item Hooks can be added multiple times, but the \cs{fancyhfinit} code
+% can only be given once (i.e. a new one overwrites the previous one).
+% \item \cs{fancyhfinit} has no corresponding \texttt{exit} function, so
+% if you need some code to be executed after the construction of the header or
+% footer, you have to use hooks.
+% \end{itemize}
+%
% \subsection{Changing the page style of the next page}
%
% If you want the change of the page style to take effect
@@ -3088,6 +3188,16 @@
% (\texttt{2e-left}) and \cs{rightmark} (\texttt{2e-right} and
% \texttt{2e-right-nonempty}) in \Package{extramarks.sty}.
% \end{itemize}
+% \item Version 4.5, Nov 21-Dec 5, 2024
+% \begin{itemize}
+% \item \Package{extramarks}: Don't redefine \cs{leftmark} and \cs{rightmark} in
+% \LaTeX{} kernel 2025-06-01 and later.
+% \item \Package{fancyhdr}: use a better method to disable paragraph
+% hooks than the v4.3 code.
+% \item \Package{extramarks}: add commands \cs{extramarksleft} and
+% \cs{extramarksright}.
+% \item \pkg{fancyhdr}: added hooks.
+% \end{itemize}
% \end{itemize}
%
%
@@ -4028,24 +4138,47 @@
% 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.
+% incompatible values.\\
+% We also disable paragraph hooks, so that no paragraph hooks will
+% intrude in \Package{fancyhdr} code. \textbf{NOTE: This is a hack, and
+% should be replaced by cleaner code as soon as the \LaTeX{} kernel
+% provides the necessary commands.}
+% \changes{fancyhdr v4.5}{2024/11/29}{We use a less fragile way to
+% disable paragraph hooks, thereby partially reverting the solution in
+% version v4.3 and v4.3.1. This is less intruding in the hook system,
+% and especially it doesn't affect kernel hooks, only user provided
+% ones. We check the kernel version to see if it support paragraph hooks.}
% \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
\ifdefined\ExplSyntaxOn
\ExplSyntaxOn
- \let\f at nch@everypar\tex_everypar:D
- \newcommand\f at nch@resetpar{%
- \f at nch@everypar{}%
- \cs_set_eq:NN \everypar\tex_everypar:D
- \cs_set_eq:NN \par \tex_par:D
- \cs_set_eq:NN \@@par \tex_par:D
- \cs_set_eq:NN \endgraf \tex_par:D
+ \providecommand\IfFormatAtLeastTF{\@ifl at t@r\fmtversion}
+ \IfFormatAtLeastTF{2021-06-01}{
+% \end{macrocode}
+% \begin{macro}{\f at nch@clear at par@hook:n}
+% Clear a (paragraph) hook locally.
+% We don't need to restore as this will be done by the \TeX{} grouping.
+% \begin{macrocode}
+ \cs_new:Npn \f at nch@clear at par@hook:n #1{
+ \tl_clear:c {__hook~#1}
+ }
+ \newcommand\f at nch@resetpar{
+ \f at nch@everypar{}
+ \f at nch@clear at par@hook:n{para/before}
+ \f at nch@clear at par@hook:n{para/begin}
+ \f at nch@clear at par@hook:n{para/end}
+ \f at nch@clear at par@hook:n{para/after}
+ }
+ }{
+ \newcommand\f at nch@resetpar{
+ \f at nch@everypar{}
}
+}
\ExplSyntaxOff
\else
- \let\f at nch@everypar\everypar
\newcommand\f at nch@resetpar{%
\f at nch@everypar{}%
}
@@ -4055,6 +4188,7 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\f at nch@noUppercase}
% We want \cs{nouppercase} to work with the various evolutionary stages of
@@ -4229,6 +4363,20 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{hookdecl}{fancyhdr/before, fancyhdr/after, fancyhdr/head/begin,
+% fancyhdr/head/end, fancyhdr/foot/begin, fancyhdr/foot/end}
+% \changes{fancyhdr v4.5}{2024/12/05}{Hooks added}
+% Here we define the \Package{fancyhdr} hooks. It will be conditional on
+% the presence of hook support in the \LaTeX{} kernel.
+% \begin{macrocode}
+\ifdefined\NewMirroredHookPair
+ \NewMirroredHookPair{fancyhdr/before}{fancyhdr/after}
+ \NewMirroredHookPair{fancyhdr/head/begin}{fancyhdr/head/end}
+ \NewMirroredHookPair{fancyhdr/foot/begin}{fancyhdr/foot/end}
+\fi
+% \end{macrocode}
+% \end{hookdecl}
+%
% \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.
@@ -4295,6 +4443,7 @@
% The \cs{leavevmode} prevents a bug when a field starts with a
% \cs{color} command. The \cs{ignorespaces} skips initial spaces in
% the parameter, as is usual in a \cs{parbox}, for backwards compatibility.}
+% \changes{fancyhdr v4.5}{2024/12/05}{Hooks added}
% 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
@@ -4309,13 +4458,23 @@
% 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).
+% (after expansion).\\
% Before constructing the header or footer, the environment is reset to
-% a known state, and then the corresponding initialisation code as given
-% in \cs{fancyheadinit} or \cs{fancyfootinit}, respectively, is run.
+% a known state, the appropriate hooks (\texttt{fancyhdr/before} and
+% \TTindex{fancyhdr/before}
+% \TTindex{fancyhdr/head/begin}\TTindex{fancyhdr/foot/begin}
+% \texttt{fancyhdr/head/begin} or \texttt{fancyhdr/foot/begin}) are
+% executed, and then the corresponding initialisation code as given in
+% \cs{fancyheadinit} or \cs{fancyfootinit}, respectively, is run.\\
+% After constructing the header or footer, the hooks for the end
+% (\texttt{fancyhdr/head/end} or \texttt{fancyhdr/foot/end} and
+% \TTindex{fancyhdr/head/end}\TTindex{fancyhdr/foot/end}
+% \TTindex{fancyhdr/after}
+% \texttt{fancyhdr/after}) are run.
% \begin{macrocode}
\newcommand\f at nch@head[5]{%
\f at nch@reset
+ \ifdefined\UseHook\UseHook{fancyhdr/before}\UseHook{fancyhdr/head/begin}\fi
\f at nch@headinit\relax
#1%
\hbox to\headwidth{%
@@ -4332,6 +4491,7 @@
}%
}%
#5%
+ \ifdefined\UseHook\UseHook{fancyhdr/head/end}\UseHook{fancyhdr/after}\fi
}
% \end{macrocode}
%
@@ -4349,6 +4509,7 @@
% The \cs{leavevmode} prevents a bug when a field starts with a
% \cs{color} command. The \cs{ignorespaces} skips initial spaces in
% the parameter, as is usual in a \cs{parbox}, for backwards compatibility.}
+% \changes{fancyhdr v4.5}{2024/12/05}{Hooks added}
% 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
@@ -4357,6 +4518,7 @@
% \begin{macrocode}
\newcommand\f at nch@foot[5]{%
\f at nch@reset
+ \ifdefined\UseHook\UseHook{fancyhdr/before}\UseHook{fancyhdr/foot/begin}\fi
\f at nch@footinit\relax
#1%
\hbox to\headwidth{%
@@ -4373,6 +4535,7 @@
}%
}%
#5%
+ \ifdefined\UseHook\UseHook{fancyhdr/foot/end}\UseHook{fancyhdr/after}\fi
}
% \end{macrocode}
% \end{macro}
@@ -4886,7 +5049,9 @@
% \end{macrocode}
% \end{macro}
% \end{macro}
-
+% \changes{extramarks v4.5}{2024/11/28}{Don't redefine \cs{leftmark}
+% and \cs{rightmark} in \LaTeX{} kernel 2025-06-01 and later.}
+%
% \begin{macro}{\leftmark}
% \begin{macro}{\rightmark}
% \begin{macro}{\firstleftmark}
@@ -4894,11 +5059,19 @@
% \begin{macro}{\firstrightmark}
% \begin{macro}{\lastleftmark}
% The standard marks + the new ones (based on the standard marks info).
+% We provide \cs{IfFormatAtLeastTF} in case we have a rather old \LaTeX{}
+% format (in which case the test will always be false).
+% If the \LaTeX{} format is 2025-06-01 or later, \cs{leftmark} and
+% \cs{rightmark} have definitions based upon the new marks, so we should
+% not redefine these in \Package{extramarks}.
% \begin{macrocode}
-\def\leftmark{\expandafter\@leftmark
+\providecommand\IfFormatAtLeastTF{\@ifl at t@r\fmtversion}
+\IfFormatAtLeastTF{2025-06-01}{}{%
+ \def\leftmark{\expandafter\@leftmark
\botmark\@empty\@empty\@empty\@empty}
-\def\rightmark{\expandafter\@rightmark
+ \def\rightmark{\expandafter\@rightmark
\firstmark\@empty\@empty\@empty\@empty}
+}
\def\firstleftmark{\expandafter\@leftmark
\firstmark\@empty\@empty\@empty\@empty}
\def\lastrightmark{\expandafter\@rightmark
@@ -4942,6 +5115,54 @@
\unrestored at protected@xdef\@themark{\the\@temptokena{#5}{#6}}}
% \end{macrocode}
% \end{macro}
+% \changes{extramarks v4.5}{2024/11/30}{Add commands
+% \cs{extramarksleft} and \cs{extramarksright} for compatibility with
+% \Package{extramarks} version 5.}
+% \begin{macro}{\extramarksleft}
+% This command is used to define the left extra mark.
+% As this is not independent from the other marks, it is not perfect.
+% \begin{macrocode}
+\def\extramarksleft#1{%
+ \begingroup
+ \let\label\relax \let\index\relax \let\glossary\relax
+ \expandafter\@markextraleft\@themark{#1}%
+ \@temptokena \expandafter{\@themark}%
+ \mark{\the\@temptokena}%
+ \endgroup
+ \if at nobreak\ifvmode\nobreak\fi\fi}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@extramarksleft}
+% Internal macro to store the left mark in the marks storage.\\
+% Note: Put \texttt{\#1\#2} and \texttt{\#4}in toks registers.
+% \begin{macrocode}
+\def\@markextraleft#1#2#3#4#5{\@temptokena {{#1}{#2}}%
+ \@temptokenb {{#4}}%
+ \unrestored at protected@xdef\@themark{\the\@temptokena{#5}\the\@temptokenb}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\extramarksright}
+% This command is used to define the right extra mark.
+% As this is not independent from the other marks, it is not perfect.
+% \begin{macrocode}
+\def\extramarksright#1{%
+ \begingroup
+ \let\label\relax \let\index\relax \let\glossary\relax
+ \expandafter\@markextraright\@themark{#1}%
+ \@temptokena \expandafter{\@themark}%
+ \mark{\the\@temptokena}%
+ \endgroup
+ \if at nobreak\ifvmode\nobreak\fi\fi}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@extramarksright}
+% Internal macro to store the right mark in the marks storage.\\
+% Note: Put \texttt{\#1\#2\#3} in toks register.
+% \begin{macrocode}
+\def\@markextraright#1#2#3#4#5{\@temptokena {{#1}{#2}{#3}}%
+ \unrestored at protected@xdef\@themark{\the\@temptokena{#5}}}
+% \end{macrocode}
+% \end{macro}
%
% \begin{macro}{\firstleftxmark}
% \begin{macro}{\firstrightxmark}
Modified: trunk/Master/texmf-dist/tex/latex/fancyhdr/extramarks.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/fancyhdr/extramarks.sty 2024-12-15 21:15:55 UTC (rev 73132)
+++ trunk/Master/texmf-dist/tex/latex/fancyhdr/extramarks.sty 2024-12-15 21:30:38 UTC (rev 73133)
@@ -21,7 +21,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{extramarks}
- [2024/11/20 v4.4
+ [2024/12/09 v4.5
Extra marks for LaTeX]
% Copyright (C) 1994-2024 by Pieter van Oostrum <pieter at vanoostrum.org>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -63,11 +63,13 @@
\def\@leftmark#1#2#3#4{#1}
\def\@rightmark#1#2#3#4{#2}
-
-\def\leftmark{\expandafter\@leftmark
+\providecommand\IfFormatAtLeastTF{\@ifl at t@r\fmtversion}
+\IfFormatAtLeastTF{2025-06-01}{}{%
+ \def\leftmark{\expandafter\@leftmark
\botmark\@empty\@empty\@empty\@empty}
-\def\rightmark{\expandafter\@rightmark
+ \def\rightmark{\expandafter\@rightmark
\firstmark\@empty\@empty\@empty\@empty}
+}
\def\firstleftmark{\expandafter\@leftmark
\firstmark\@empty\@empty\@empty\@empty}
\def\lastrightmark{\expandafter\@rightmark
@@ -87,6 +89,27 @@
\if at nobreak\ifvmode\nobreak\fi\fi}
\def\@markextra#1#2#3#4#5#6{\@temptokena {{#1}{#2}}%
\unrestored at protected@xdef\@themark{\the\@temptokena{#5}{#6}}}
+\def\extramarksleft#1{%
+ \begingroup
+ \let\label\relax \let\index\relax \let\glossary\relax
+ \expandafter\@markextraleft\@themark{#1}%
+ \@temptokena \expandafter{\@themark}%
+ \mark{\the\@temptokena}%
+ \endgroup
+ \if at nobreak\ifvmode\nobreak\fi\fi}
+\def\@markextraleft#1#2#3#4#5{\@temptokena {{#1}{#2}}%
+ \@temptokenb {{#4}}%
+ \unrestored at protected@xdef\@themark{\the\@temptokena{#5}\the\@temptokenb}}
+\def\extramarksright#1{%
+ \begingroup
+ \let\label\relax \let\index\relax \let\glossary\relax
+ \expandafter\@markextraright\@themark{#1}%
+ \@temptokena \expandafter{\@themark}%
+ \mark{\the\@temptokena}%
+ \endgroup
+ \if at nobreak\ifvmode\nobreak\fi\fi}
+\def\@markextraright#1#2#3#4#5{\@temptokena {{#1}{#2}{#3}}%
+ \unrestored at protected@xdef\@themark{\the\@temptokena{#5}}}
\def\firstleftxmark{\expandafter\@leftxmark
\firstmark\@empty\@empty\@empty\@empty}
\def\firstrightxmark{\expandafter\@rightxmark
Modified: trunk/Master/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty 2024-12-15 21:15:55 UTC (rev 73132)
+++ trunk/Master/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty 2024-12-15 21:30:38 UTC (rev 73133)
@@ -21,7 +21,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{fancyhdr}%
- [2024/11/20 v4.4
+ [2024/12/09 v4.5
Extensive control of page headers and footers]%
% Copyright (C) 1994-2024 by Pieter van Oostrum <pieter at vanoostrum.org>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -227,19 +227,28 @@
\let\f at nch@raggedleft\raggedleft
\let\f at nch@raggedright\raggedright
\let\f at nch@centering\centering
+\let\f at nch@everypar\everypar
\ifdefined\ExplSyntaxOn
\ExplSyntaxOn
- \let\f at nch@everypar\tex_everypar:D
- \newcommand\f at nch@resetpar{%
- \f at nch@everypar{}%
- \cs_set_eq:NN \everypar\tex_everypar:D
- \cs_set_eq:NN \par \tex_par:D
- \cs_set_eq:NN \@@par \tex_par:D
- \cs_set_eq:NN \endgraf \tex_par:D
+ \providecommand\IfFormatAtLeastTF{\@ifl at t@r\fmtversion}
+ \IfFormatAtLeastTF{2021-06-01}{
+ \cs_new:Npn \f at nch@clear at par@hook:n #1{
+ \tl_clear:c {__hook~#1}
+ }
+ \newcommand\f at nch@resetpar{
+ \f at nch@everypar{}
+ \f at nch@clear at par@hook:n{para/before}
+ \f at nch@clear at par@hook:n{para/begin}
+ \f at nch@clear at par@hook:n{para/end}
+ \f at nch@clear at par@hook:n{para/after}
+ }
+ }{
+ \newcommand\f at nch@resetpar{
+ \f at nch@everypar{}
}
+}
\ExplSyntaxOff
\else
- \let\f at nch@everypar\everypar
\newcommand\f at nch@resetpar{%
\f at nch@everypar{}%
}
@@ -307,6 +316,11 @@
\def\f at nch@headinit{#1}%
\def\f at nch@footinit{#1}%
}
+\ifdefined\NewMirroredHookPair
+ \NewMirroredHookPair{fancyhdr/before}{fancyhdr/after}
+ \NewMirroredHookPair{fancyhdr/head/begin}{fancyhdr/head/end}
+ \NewMirroredHookPair{fancyhdr/foot/begin}{fancyhdr/foot/end}
+\fi
\newcommand\f at nch@vbox[2]{%
\setbox0\vbox{#2}%
\ifdim\ht0>#1\relax
@@ -338,6 +352,7 @@
\box0}
\newcommand\f at nch@head[5]{%
\f at nch@reset
+ \ifdefined\UseHook\UseHook{fancyhdr/before}\UseHook{fancyhdr/head/begin}\fi
\f at nch@headinit\relax
#1%
\hbox to\headwidth{%
@@ -354,9 +369,11 @@
}%
}%
#5%
+ \ifdefined\UseHook\UseHook{fancyhdr/head/end}\UseHook{fancyhdr/after}\fi
}
\newcommand\f at nch@foot[5]{%
\f at nch@reset
+ \ifdefined\UseHook\UseHook{fancyhdr/before}\UseHook{fancyhdr/foot/begin}\fi
\f at nch@footinit\relax
#1%
\hbox to\headwidth{%
@@ -373,6 +390,7 @@
}%
}%
#5%
+ \ifdefined\UseHook\UseHook{fancyhdr/foot/end}\UseHook{fancyhdr/after}\fi
}
\f at nch@ifundefined{MakeUppercase}{\def\MakeUppercase{\uppercase}}{}%
\f at nch@ifundefined{@chapapp}{\let\@chapapp\chaptername}{}%
More information about the tex-live-commits
mailing list.