diff options
author | Norbert Preining <norbert@preining.info> | 2021-03-22 03:01:03 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2021-03-22 03:01:03 +0000 |
commit | 159aa77bf48b6a49ba55e9105f19191dce9f7862 (patch) | |
tree | 04d572f80936b9de73c104392120db705c399220 /macros/latex/contrib/scrlayer-fancyhdr/scrlayer-fancyhdr.dtx | |
parent | 86a0e007d01f87228d2363faf90a2a3b65cf758f (diff) |
CTAN sync 202103220301
Diffstat (limited to 'macros/latex/contrib/scrlayer-fancyhdr/scrlayer-fancyhdr.dtx')
-rw-r--r-- | macros/latex/contrib/scrlayer-fancyhdr/scrlayer-fancyhdr.dtx | 577 |
1 files changed, 577 insertions, 0 deletions
diff --git a/macros/latex/contrib/scrlayer-fancyhdr/scrlayer-fancyhdr.dtx b/macros/latex/contrib/scrlayer-fancyhdr/scrlayer-fancyhdr.dtx new file mode 100644 index 0000000000..a3f9765f3f --- /dev/null +++ b/macros/latex/contrib/scrlayer-fancyhdr/scrlayer-fancyhdr.dtx @@ -0,0 +1,577 @@ +% \iffalse^^A meta-comment +% ====================================================================== +% scrlayer-fancyhdr.dtx +% Copyright (c) Markus Kohm, 2021 +% +% This file is part of the LaTeX2e package `scrlayer-fancyhdr'. +% +% This work may be distributed and/or modified under the conditions of +% the LaTeX Project Public License, version 1.3c of the license. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 and of this work. +% +% This work has the LPPL maintenance status "author-maintained". +% +% The Current Maintainer and author of this work is Markus Kohm. +% +% This work consists of the files `scrlayer-fancyhdr.dtx' and +% `README.md'. +% ---------------------------------------------------------------------- +% scrlayer-fancyhdr.dtx +% Copyright (c) Markus Kohm, 2021 +% +% Diese Datei ist Teil des LaTeX2e Pakets `scrlayer-fancyhdr'. +% +% Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz, +% Version 1.3c. +% Die neuste Version dieser Lizenz ist +% http://www.latex-project.org/lppl.txt +% und Version 1.3c ist Teil aller Verteilungen von LaTeX +% Version 2005/12/01 und dieses Werks. +% +% Dieses Werk hat den LPPL-Verwaltungs-Status "author-maintained" +% (allein durch den Autor verwaltet). +% +% Der Aktuelle Verwalter und Autor dieses Werkes ist Markus Kohm. +% +% Dieses Werk besteht aus den Dateien `scrlayer-fancyhdr.dtx' und +% `README.md'. +% ====================================================================== +% +%<identify>%%% docstrip run: identify +%<init>%%% docstrip run: init +%<options>%%% docstrip run: options +%<body>%%% docstrip run: body +%<*dtx> +\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi +\ProvidesFile{scrlayer-fancyhdr.dtx}[2021-03-17 v0.2 + source of package scrlayer-scrpage] +%</dtx> +%<*package> +%<identify>\NeedsTeXFormat{LaTeX2e}[1995/12/01] +%<identify>\ProvidesPackage{scrlayer-fancyhdr}[2021-03-17 v0.2 +%<identify> combining fancyhdr with KOMA-Script's scrlayer] +%</package> +%<*dtx> +\ifx\documentclass\undefined + \input docstrip.tex + \generate{% + \file{scrlayer-fancyhdr.sty}{% + \from{scrlayer-fancyhdr.dtx}{package,identify}% + \from{scrlayer-fancyhdr.dtx}{package,init}% + \from{scrlayer-fancyhdr.dtx}{package,options}% + \from{scrlayer-fancyhdr.dtx}{package,body}% + }% + } +\else + \let\endbatchfile\relax +\fi +\endbatchfile +\documentclass{scrdoc} +\addtolength{\textwidth}{-1em} +\addtolength{\marginparwidth}{2em} +\addtolength{\oddsidemargin}{2em} +\usepackage[english]{babel} +\usepackage{csquotes} +\usepackage{biblatex} +\usepackage{listings} +\usepackage{scrhack} +\usepackage{xpatch} + +\begin{filecontents}[force]{\jobname.bib} +@Misc{ package:fancyhdr, + language= {english}, + author = {Piet van Oostrum}, + title = {{\Package{fancyhdr}}\,---\,Extensive control of page headers and + footers in {\LaTeXe}}, + date = {2021-01-28}, + edition = {4.0.1}, + url = {https://www.ctan.org/pkg/fancydr}, + urldate = {2021-02-18} +} + +@Misc{ package:koma-script, + language= {english}, + author = {Markus Kohm}, + title = {{\Package{koma-script}}\,---\,A bundle of versatile classes and + packages}, + date = {2021-03-01}, + edition = {3.33}, + url = {https://www.ctan.org/pkg/koma-script}, + urldate = {2021-03-01} +} + +@Misc{ package:scrlayer, + language= {english}, + author = {Markus Kohm}, + title = {{\Package{scrlayer}}\,---\,Manage text `layers' within + {\KOMAScript}}, + date = {2021-03-01}, + edition = {3.33}, + url = {https://www.ctan.org/pkg/koma-script}, + urldate = {2021-03-01} +} +\end{filecontents} + +\addbibresource{\jobname.bib} +\xpretocmd\DescribeMacro{\ifhmode\else\bigskip\noindent\fi}{}{} +\xpretocmd\DescribeEnv{\ifhmode\else\bigskip\noindent\fi}{}{} +\xpretocmd\DescribeOption{\ifhmode\else\bigskip\noindent\fi}{}{} + +\CodelineIndex +\RecordChanges +\GetFileInfo{scrlayer-fancyhdr.dtx} +\title{The \texttt{scrlayer} interface \texttt{scrlayer-fancyhdr}% + \footnote{This is version \fileversion\ of file \texttt{\filename}.}} +\date{\filedate} +\author{Markus Kohm} + +\newenvironment{Explain}{\par}{\par} +\newcommand*{\length}{} +\let\length\Length +\let\endlength\endLength +\let\Macro\cs +\let\Length\Macro +\let\Package\textsf +\let\Class\Package +\let\File\texttt +\let\Option\texttt +\newcommand*{\KOption}[1]{\Option{#1}\texttt{=}} +\newcommand*{\OptionValue}[2]{\Option{#1}\texttt{=}\PValue{#2}} +\let\Counter\texttt +\let\Environment\texttt +\let\ShowOutput\quote +\let\endShowOutput\endquote +\let\Pagestyle\texttt +\newcommand*{\Parameter}[1]{\texttt{\marg{#1}}\linebreak[1]} +\newcommand*{\OParameter}[1]{\texttt{\oarg{#1}}\linebreak[1]} +\newcommand*{\MParameter}[2]{\texttt{(\meta{#1},\meta{#2})}\linebreak[1]} +\providecommand\PParameter[1]{\mbox{\texttt{\{#1\}}}\linebreak[1]} +\let\PName\meta +\let\PValue\texttt +\providecommand*{\autoref}[1]{\expandafter\AUTOREF#1:} +\providecommand*{\AUTOREF}{} +\makeatletter +\def\AUTOREF#1:#2:{% + \edef\@tempa{#1}% + \edef\@tempb{tab}\ifx\@tempa\@tempb table~\fi + \edef\@tempb{sec}\ifx\@tempa\@tempb section~\fi + \ref{#1:#2}% +} +\makeatother +\providecommand*{\IndexCmd}[2][]{} +\providecommand*{\textnote}[2][]{} + +\lstnewenvironment{lstcode}{\lstset{language=[LaTeX]TeX}}{} +\sloppy% YOU SHOULD NOT DO THIS!!! + +\begin{document} +\maketitle +\tableofcontents +\DocInput{\filename} +\printbibliography +\PrintChanges +\PrintIndex +\end{document} +% \fi^^A meta-comment +% +% \changes{v0.0}{2018/09/01}{start of interface} +% \changes{v0.2}{2021/02/18}{package is no longer part of \KOMAScript} +% +% \changes{v0.0}{2018/09/05}{some user documentation} +% \section{The Purpose of this Package} +% This package has been made to give users a chance to combine the features of +% Piet van Oostrum's \Package{fancyhdr} \autocite{package:fancyhdr} with the +% features of \Package{scrlayer} \autocite{package:scrlayer}. In other words: +% It has been made to combine the page layers of \Package{scrlayer} with the +% page styles of \Package{fancyhdr}. +% +% In this combination compatibility with \Package{fancyhdr} is the first aim! +% Usability and the freedom provided by \Package{scrlayer} is only the second +% one. Compatibility with other packages or classes of \KOMAScript{} +% \cite{package:koma-script} is not a primary aim. Perhaps it will become an +% optional feature in future. Abolishing any real or virtual limitations of +% \Package{fancyhdr} other than make it possible to use layers is not an aim +% and will not be an aim in future. +% +% If you need a better combination of page styles and layers, you should +% either use the low level interface of \Package{scrlayer} to define your page +% styles or\,---\,and this is the recommendation of the author\,---\,use +% \Package{scrlayer-scrpage} instead of \Package{scrlayer-fancyhdr} or +% \Package{fancyhdr}. If you need more compatibility with other parts of +% \KOMAScript, i.\,e.\@ with the \KOMAScript{} classes, you should use +% \Package{scrlayer-scrpage} instead of \Package{scrlayer-fancyhdr} or +% \Package{fancyhdr}. +% +% +% \section{How it works} +% To combine \Package{fancyhdr} and \Package{scrlayer}, +% \Package{scrlayer-scrpage} loads both packages. After loading +% \Package{fancyhdr} it redefines page style \Pagestyle{@fancy} (up to +% \Package{fancyhdr} version 3.10) resp. \Pagestyle{f@nch@fancycore} (from +% \Package{fancyhdr} version 4) to make it a layer page style of +% \Package{scrlayer} using the newly defined layers \texttt{fancy.head.even}, +% \texttt{fancy.head.odd}, \texttt{fancy.foot.even} and +% \texttt{fancy.foot.odd}. The \texttt{\dots head\dots} layers are background +% layers like the page head of \Package{fancyhdr}'s page styles (or other +% usual page styles). The \texttt{\dots foot\dots} layers are foreground +% layers like the page footer of \Package{fancyhdr}'s page styles (or other +% usual page styles). The \texttt{\dots even} layers are restricted to even +% pages, that means left side pages in two-sided documents. The \texttt{\dots +% odd} layers are restricted to odd pages, that means right side pages in +% two-sided documents or all pages in single-sided documents. +% +% \DescribeMacro\ps@@fancy +% \DescribeMacro\ps@f@nch@fancycore +% \DescribeMacro\ps@fancyplain +% \DescribeMacro\ps@plain@fancy +% Note: Page style \Pagestyle{@fancy} (up to \Package{fancyhdr} version 3.10) +% resp. \Pagestyle{f@nch@fancycore} (from \Package{fancyhdr} version 4) is an +% internal basic page style of package \Package{fancyhdr}. It is used for the +% user page style \Pagestyle{fancy}. The user page style \Pagestyle{fancy} is +% also used for \Package{fancyhdr}'s deprecated page style +% \Pagestyle{fancyplain}, that also redefines page style \Pagestyle{plain} to +% be \Package{fancyhdr}'s internal page style \Pagestyle{plain@fancy}, that +% also uses \Pagestyle{fancy} but with \Macro{if@fancyplain} set to +% \Macro{iftrue}. There is also a deprecated command +% \Macro{fancyplain}\Parameter{plain code}\Parameter{fancy code}, that uses +% the \meta{plain code} if \Macro{if@fancyplain} is \Macro{iftrue} and +% \meta{fancy code} if \Macro{if@fancyplain} is \Macro{iffalse}. +% +% Note: Page styles defined using \Package{fancyhdr}'s command +% \Macro{fancypagestyle} also always use page style \Pagestyle{fancy} and so +% the internal basic page style \Pagestyle{@fancy} (up to \Package{fancyhdr} +% version 3.10) resp. \Pagestyle{f@nch@fancycore} (from \Package{fancyhdr} +% version 4). +% +% As a result of the two notes above, every page style of \Package{fancyhdr} +% always uses the same internal basic page style \Pagestyle{@fancy} (up to +% \Package{fancyhdr} version 3.10) resp. \Pagestyle{f@nch@fancycore} (from +% \Package{fancyhdr} version 4). As a result of redefining page style +% \Pagestyle{@fancy} (up to \Package{fancyhdr} version 3.10) +% resp. \Pagestyle{f@nch@fancycore} (from \Package{fancyhdr} version 4) to be +% a layer page style, users can add layers to or remove layers from all +% \Package{fancyhdr} page styles by adding layers to or remove layers from +% page style \Pagestyle{@fancy} (up to \Package{fancyhdr} version 3.10) +% resp. \Pagestyle{f@nch@fancycore} (from \Package{fancyhdr} version 4). You +% cannot add layers to or remove layers from \Package{fancyhdr}'s single page +% styles \Pagestyle{fancy}, \Pagestyle{fancyplain}, \Pagestyle{plain@fancy} or +% the page styles defined using \Macro{fancypagestyle} directly. So using +% layers is a all or nothing feature with \Package{scrlayer-scrpage}. However, +% you can use the second argument of \Macro{fancypagestyle} to add or remove +% layers whenever one of the \Package{fancyhdr} page styles is activated. So +% this is a move from the \Package{scrlayer} interface of adding or removing +% layers to single page styles to the \Package{fancyhdr} interface of defining +% modifications of page style \Pagestyle{fancy}. +% +% Another such movement from an \Package{scrlayer} user interface to a +% \Package{fancyhdr} user interface is the decision whether or not automatic +% running heads are used. \Package{scrlayer} provides the options +% \Option{automark} and \Option{manualmark} and commands \Macro{automark} and +% \Macro{manualmark} to do this decision and also to configure commands like +% \Macro{partmark}, \Macro{chaptermark}, \Macro{sectionmark} etc. With +% \Package{scrlayer-fancyhdr} also using page style \Pagestyle{@fancy} (up to +% \Package{fancyhdr} version 3.10) resp. \Pagestyle{f@nch@fancycore} (from +% \Package{fancyhdr} version 4) does switch to automatic running heads. The +% first activation of page style \Pagestyle{fancy} still redefines +% \Macro{chaptermark} and \Macro{sectionmark}, if a class with \Macro{chapter} +% is used, or \Macro{sectionmark} and \Macro{subsectionmark}, if a class +% without \Macro{chapter} is used. However, you still can use +% \Macro{manualmark} and \Macro{automark} after switching to a +% \Package{fancyhdr} page style to configure the running heads. So this +% movement is only partial. +% +% \DescribeMacro\ps@headings +% \DescribeMacro\ps@myheadings +% \DescribeMacro\ps@plain +% Note: Currently, neither \Package{scrlayer} nor \Package{fancyhdr} nor +% \Package{scrlayer-fancyhdr} do redefine page styles \Pagestyle{headings} or +% \Pagestyle{myheadings} by default. And neither \Package{scrlayer} nor +% \Package{fancyhdr} nor \Package{scrlayer-fancyhdr} do redefine page style +% \Pagestyle{plain} unless you are activating the deprecated +% \Package{fancyhdr} page style \Pagestyle{fancyplain}. So if you like to use +% layers on \Pagestyle{plain} pages, i.\,e. usually the first page of a +% chapter or part or the page with a title head, you have to either use +% \Package{fancyhdr}'s deprecated page style \Pagestyle{fancyplain} or +% redefine page style \Pagestyle{plain} either using \Macro{fancypagestyle} as +% documented in the \Package{fancyhdr} manual or using +% \Macro{DeclareNewPageStyleByLayers}, documented in the \KOMAScript{} manual. +% However from version 4.0 \Package{fancyhdr} provides options +% \Option{myheadings} and \Option{headings} to redefine the corresponding page +% style. \Package{scrlayer-fancyhdr} also provides these options and passes +% them to \Package{fancyhdr}. +% +% \DescribeMacro\ps@empty +% \DescribeMacro\ps@@empty +% Note: Pagestyle \Pagestyle{empty} is somehow special. \Package{scrlayer} +% redefines it to be a layer page style. And \Package{fancyhdr}'s internal +% page style \Pagestyle{@empty} is the same like \Pagestyle{empty}. So +% \Pagestyle{@empty} also uses the layers of \Pagestyle{empty} but you should +% not try to modify it directly using the interface of +% \Package{scrlayer}. Moreover, if \Package{fancyhdr} is loaded before +% \Package{scrlayer-scrpage}, \Package{fancyhdr}'s internal page style +% \Pagestyle{@empty} is not a copy of \Package{scrlayer}'s layer page style +% \Pagestyle{empty} but the original standard page style +% \Pagestyle{empty}. However, with \Package{scrlayer-fancyhdr} package +% \Package{fancyhdr} does not longer use the internal page style +% \Pagestyle{@empty}. So you would not need to know this. +% +% \section{How to use the Package} +% +% To use the package you have to load it, e.\,g., using: +%\begin{verbatim} +% \usepackage{scrlayer-fancyhdr} +%\end{verbatim} +% instead of loading \Package{scrlayer} and \Package{fancyhdr} or before or +% after loading one of these packages. However it is recommended to replace +% loading \Package{scrlayer} and \Package{fancyhdr} by loading +% \Package{scrlayer-fancyhdr} because this avoids option +% clashes. \Package{scrlayer-fancyhdr} provides all options of +% \Package{scrlayer} and \Package{fancyhdr} and passes them to +% \Package{scrlayer} resp. \Package{fancyhdr}. Nevertheless +% sometimes it may be useful to be able to additionally load +% \Package{scrlayer} or \Package{fancyhdr}. +% +% \DescribeMacro\ps@@fancy +% \DescribeMacro\ps@f@nch@fancycore +% \DescribeMacro\ps@fancy +% \DescribeMacro\ps@fancyplain +% \DescribeMacro\ps@plain@fancy +% \DescribeMacro\fancypagestyle +% After this you should be able to use the page styles and commands of +% \Package{fancyhdr} and to add layers to or remove layers from the +% \Package{fancyhdr}'s internal basic page style \Package{@fancy} (up to +% \Package{fancyhdr} version 3.10) resp. \Pagestyle{f@nch@fancycore} (from +% \Package{fancyhdr} version 4). Note, you are not able to add layers to or +% remove layers from \Package{fancyhdr}'s page styles \Pagestyle{fancy}, +% \Pagestyle{fancyplain}, \Pagestyle{plain@fancy} or page styles defined by +% \Macro{fancypagestyle}. However adding layers to or removing layers from +% \Pagestyle{@fancy} (up to \Package{fancyhdr} version 3.10) +% resp. \Pagestyle{f@nch@fancycore} (from \Package{fancyhdr} version 4) will +% always change all these page styles! +% +% \DescribeMacro\ps@plain +% \DescribeMacro\ps@headings +% \DescribeMacro\ps@myheadings +% \DescribeMacro\ps@empty +% Note: Loading \Package{scrlayer-fancyhdr} will not make page style +% \Pagestyle{plain} nor \Pagestyle{headings} nor \Pagestyle{myheadings} or any +% other page style but \Pagestyle{empty} to automatically be a layer page +% style! But if you are using option \Option{headings} or \Option{myheadings} +% package \Package{fancyhdr} redefines the corresponding page styles to be +% \Package{fancyhdr} page styles\,---\,and so become layer page styles. +% +% \section{Known Issues} +% +% Please note, the follow issues are either notes to the package author or +% notes to the user to avoid them reporting the same issues again and +% again. Listing these issues does not say they are bugs or features. +% +% \begin{itemize} +% \item +% \DescribeMacro\ps@fancy +% \DescribeMacro\ps@f@nch@fancycore +% \DescribeMacro\ps@fancyplain +% \DescribeMacro\fancypagestyle +% \DescribeMacro\ps@@fancy +% You are not able to add layers to the user level page style +% \Pagestyle{fancy} or \Pagestyle{fancyplain} or any page style defined by +% \Macro{fancypagestyle} but only to the internal page style +% \Pagestyle{@fancy} (if you are using \Package{fancyhdr} up to version +% 3.10) resp. \Pagestyle{f@nch@fancycore} (if you are using +% \Package{fancyhdr} from version 4). This is intended as explained in this +% manual. +% \item +% \DescribeMacro\ps@@empty +% Using \Package{fancyhdr}'s internal page style \Pagestyle{@empty} +% could have strange results. However, there is a simple solution for this: +% Don't use the internal \Pagestyle{@empty} but always the user level page +% style \Pagestyle{empty}! +% \item +% \DescribeMacro\ps@@fancy +% \DescribeMacro\ps@f@nch@fancycore +% The vertical position of the page header does differ a little bit, if +% \Package{scrlayer-fancyhdr} is used instead of \Package{fancyhdr}. This +% could be fixed by a modification of the layers \texttt{fancy.head.odd} and +% \texttt{fancy.head.even} using \Option{addvoffset}. More tests are needed. +% \end{itemize} +% +%\iffalse +%</dtx> +%\fi +% +% \StopEventually{} +% +% \section{Implementation of \Package{scrlayer-fancyhdr}} +% \label{sec:scrlayer-fancyhdr} +% +% \iffalse +%<*package> +% \fi +% +% This section if for developers only. +% +% We need \Package{scrlayer} at least version 2021/02/15, +% \begin{macrocode} +%<*init> +\RequirePackage{scrlayer}[2021/02/15] +%</init> +% \end{macrocode} +% Because before \cs{scrlayer@do@inherited@options} would not be defined. And +% we need it, to inherit all options of \Package{scrlayer}. +% \begin{macrocode} +%<*options> +\scrlayer@do@inherited@options{\scrlayer@inherit@option} +%</options> +% \end{macrocode} +% +% And the very first thing at the body, after definition of the options is to +% process the options. +% \begin{macrocode} +%<*body> +\KOMAProcessOptions +%</body> +% \end{macrocode} +% +% Note: The main problem of this interface is, that it tries to implement the +% user interface of package \Package{fancyhdr} by Piet van Oostrum, that is +% completely different from \Package{scrlayer} and not really compatible with +% \Package{scrlayer}, using \Package{scrlayer}. This means, that +% \Package{scrlayer-fancyhdr} never can be a drop-in replacement of +% \Package{fancyhdr}. Nevertheless it can help to let \Package{scrlayer} and +% \Package{fancyhdr} coexist. To do so +% \begin{itemize} +% \item the lowest level of \Package{fancyhdr} should not be the page style +% but a layer +% \item the page styles of \Package{fancyhdr} should be layer page styles +% \item init code of the page styles of \Package{fancyhdr} should use the +% layer page init code +% \end{itemize} +% Currently it is unsure whether it would be best to do a new implementation +% or to load original \Package{fancyhdr} and to only modify some things. First +% I'll try the second method. Currently we explicitly provide the options of +% \Package{fancyhdr}. +% \begin{macrocode} +%<*options> +\DeclareOption{nocheck}{\PassOptionsToPackage{nocheck}{fancyhdr}} +\DeclareOption{compatV3}{\PassOptionsToPackage{compatV3}{fancyhdr}} +\DeclareOption{myheadings}{\PassOptionsToPackage{myheadings}{fancyhdr}} +\DeclareOption{headings}{\PassOptionsToPackage{headings}{fancyhdr}} +%</options> +% \end{macrocode} +% \begin{macrocode} +%<*body> +\RequirePackage{fancyhdr} +%</body> +% \end{macrocode} +% +% We need at least one new layer for the new layer page style +% \Pagestyle{fancy}. However, it could be useful to have not only one but +% four layers (even side head, odd side head, even side foot, odd side foot). +% \begin{macrocode} +%<*body> +\DeclareNewLayer[% + background,oddpage, + head, + contents={\hb@xt@ \layerwidth{% + \f@nch@head\f@nch@Oolh\f@nch@olh\f@nch@och\f@nch@orh\f@nch@Oorh}} +]{fancy.head.odd} +\DeclareNewLayer[% + background,evenpage, + head, + contents={\hb@xt@ \layerwidth{% + \f@nch@head\f@nch@Oelh\f@nch@elh\f@nch@ech\f@nch@erh\f@nch@Oerh}} +]{fancy.head.even} +\DeclareNewLayer[% + foreground,oddpage, + foot, + contents={\hb@xt@ \layerwidth{% + \f@nch@foot\f@nch@Oolf\f@nch@olf\f@nch@ocf\f@nch@orf\f@nch@Oorf}} +]{fancy.foot.odd} +\DeclareNewLayer[% + foreground,evenpage, + foot, + contents={\hb@xt@ \layerwidth{% + \f@nch@foot\f@nch@Oelf\f@nch@elf\f@nch@ecf\f@nch@erf\f@nch@Oerf}} +]{fancy.foot.even} +% \end{macrocode} +% \begin{macro}{\ps@f@nch@fancycore} +% \changes{0.1.3558}{2021/02/15}{support for \Package{fancyhdr} 4} +% \begin{macro}{\ps@@fancy} +% \begin{macro}{\@mkboth} +% And have to create a layer page style from this new layers, but we do not +% redefine page style \Pagestyle{fancy} but the low level page style +% \Pagestyle{@fancy} (up to \Package{fancyhdr} version 3.10) +% resp. \Pagestyle{f@nch@fancycore} (from \Package{fancyhdr} version 4.0). +% +% \Package{fancyhdr} does some initialization at the very first call +% of \cs{pagestyle{fancy}}. To do so \Package{fancyhdr} first uses a different +% page style definition, that does the initialization and redefines the page +% style afterwards. This is still active with \Package{scrlayer-fancyhdr}. +% Additionally, \Package{fancyhdr} redefines \cs{@mkboth} at every selection +% of the internal page style \Pagestyle{@fancy} +% resp. \Pagestyle{f@nch@fancycore}. This can be adapted using the +% \Option{onselect} feature of the new layer page style \Pagestyle{@fancy} +% resp. \Pagestyle{f@nch@fancycore}. In my opinion, the +% |\let\@mkboth\markboth| used by page style \Pagestyle{headings} of, e.\,g., +% the standard classes or the \KOMAScript{} classes would be best +% here. However, \Package{fancyhdr} uses the uncommon +% |\def\@mkboth{\protect\markboth}|, which would fail if a class or package +% tests \cs{@mkboth} using |\ifx\@mkboth\markboth|. However, \KOMAScript's +% \cs{IfActiveMkBoth} (see the \Package{scrbase} chapter in the \KOMAScript{} +% manual) does also recognize the \Package{fancyhdr} definition and copying +% this is more compatible with \Package{fancyhdr}. +% \begin{macrocode} +\@ifpackagelater{fancyhdr}{2019/03/21}{% + \DeclarePageStyleByLayers[ + onselect={\def\@mkboth{\protect\markboth}}, + ]{f@nch@fancycore}{% + fancy.head.odd,fancy.head.even,fancy.foot.odd,fancy.foot.even + }% +}{% + \DeclarePageStyleByLayers[ + onselect={\def\@mkboth{\protect\markboth}}, + ]{@fancy}{% + fancy.head.odd,fancy.head.even,fancy.foot.odd,fancy.foot.even + }% +} +%</body> +% \end{macrocode} +% Note: Redefining page style \Pagestyle{@fancy} +% resp. \Pagestyle{f@nch@fancycore} instead of \Pagestyle{fancy} +% does also mean, that features like options \Option{automark} and +% \Option{manualmark} resp. \cs{automark} and \cs{manualmark} are not fully +% supported by \Package{scrlayer-fancyhdr}. Also currently the font features +% of the \KOMAScript{} classes are not supported by +% \Package{scrlayer-fancyhdr}. However you are now able to combine other +% features of \Package{scrlayer} with features of \Package{fancyhdr} and you +% can, e.g., use \Package{scrlayer-notecolumn} with +% \Package{scrlayer-fancyhdr}. +% \end{macro}%^^A \@mkboth +% \end{macro}%^^A \ps@@fancy +% \end{macro}%^^A \ps@f@nch@fancycore +% +% A future release of \Package{scrlayer-fancyhdr} may even provide the font +% features of the \KOMAScript{} classes and a working +% \Option{markcase}. However, in this case I would have to redefine the +% initial page style \Pagestyle{fancy} and the layers above. +% +% \iffalse +%</package> +% \fi +% +% \Finale +% +\endinput +% +% End of file `scrlayer-fancyhdr.dtx'. +% + +%%% Local Variables: +%%% mode: doctex +%%% mode: flyspell +%%% ispell-local-dictionary: "en_GB" +%%% TeX-master: t +%%% End: |