summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/latex-dev/firstaid/README.md9
-rw-r--r--Master/texmf-dist/doc/latex-dev/firstaid/changes.txt51
-rw-r--r--Master/texmf-dist/doc/latex-dev/firstaid/latex2e-first-aid-for-external-files.pdfbin0 -> 224897 bytes
-rw-r--r--Master/texmf-dist/source/latex-dev/firstaid/firstaid.ins78
-rw-r--r--Master/texmf-dist/source/latex-dev/firstaid/latex2e-first-aid-for-external-files.dtx521
-rw-r--r--Master/texmf-dist/tex/latex-dev/firstaid/everysel-ltx.sty45
-rw-r--r--Master/texmf-dist/tex/latex-dev/firstaid/filehook-ltx.sty94
-rw-r--r--Master/texmf-dist/tex/latex-dev/firstaid/latex2e-first-aid-for-external-files.ltx107
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check2
-rw-r--r--Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc1
-rw-r--r--Master/tlpkg/tlpsrc/latex-bin-dev.tlpsrc3
-rw-r--r--Master/tlpkg/tlpsrc/latex-firstaid-dev.tlpsrc3
12 files changed, 912 insertions, 2 deletions
diff --git a/Master/texmf-dist/doc/latex-dev/firstaid/README.md b/Master/texmf-dist/doc/latex-dev/firstaid/README.md
new file mode 100644
index 00000000000..a9a762e4a2c
--- /dev/null
+++ b/Master/texmf-dist/doc/latex-dev/firstaid/README.md
@@ -0,0 +1,9 @@
+# LaTeX2e temporary first aid for external packages and classes during transition periods
+
+LaTeX2e kernel code that temporarily adjusts packages that are not yet
+updated and therefore fail if a new LaTeX release updates internal
+commands (which have been used in the external packages)
+
+This is stored in a separate file external to the base bundle, so that
+it can be easily updated when fixes become available without the need
+to upload a full new LaTeX2e release to CTAN.
diff --git a/Master/texmf-dist/doc/latex-dev/firstaid/changes.txt b/Master/texmf-dist/doc/latex-dev/firstaid/changes.txt
new file mode 100644
index 00000000000..24b6eae4f6d
--- /dev/null
+++ b/Master/texmf-dist/doc/latex-dev/firstaid/changes.txt
@@ -0,0 +1,51 @@
+2021-01-06 Frank Mittelbach <Frank.Mittelbach@latex-project.org>
+
+ * latex2e-first-aid-for-external-files.dtx:
+ Add replacement code for everysel package.
+ Add first aid for CJK (as it overwrite \selectfont with an
+ old definition).
+
+2020-12-14 Frank Mittelbach <Frank.Mittelbach@latex-project.org>
+
+ * latex2e-first-aid-for-external-files.dtx:
+ bandage for pgfmorepages got detached, so need to adjust the first
+ aid (gh/455)
+
+2020-10-29 Frank Mittelbach <Frank.Mittelbach@latex-project.org>
+
+ * latex2e-first-aid-for-external-files.dtx:
+ Add temporary aid for pgfpages and pfgmorepages.
+ To be replaced when LaTeX offers configuration point interfaces.
+
+2020-10-25 Frank Mittelbach <Frank.Mittelbach@latex-project.org>
+
+ * latex2e-first-aid-for-external-files.dtx
+ Fix for gh408 taken out as now in the kernel.
+
+2020-10-13 Frank Mittelbach <Frank.Mittelbach@latex-project.org>
+
+ * latex2e-first-aid-for-external-files.dtx:
+ Fix for gh408 to be taken out later when it moves to the kernel.
+
+2020-10-04 Frank Mittelbach <Frank.Mittelbach@latex-project.org>
+
+ * latex2e-first-aid-for-external-files.dtx:
+ Fix for gh400 taken out and moved into the kernel instead for PL1.
+
+2020-10-03 Frank Mittelbach <Frank.Mittelbach@latex-project.org>
+
+ * latex2e-first-aid-for-external-files.dtx:
+ Added a fix for gh400. This will soon move into the kernel.
+
+2020-09-29 Frank Mittelbach <Frank.Mittelbach@latex-project.org>
+
+ * latex2e-first-aid-for-external-files.dtx:
+ filehook doesn't need first aid any longer.
+
+2020-09-27 Frank Mittelbach <Frank.Mittelbach@latex-project.org>
+
+ * latex2e-first-aid-for-external-files.dtx:
+ Initial version for 2020-10-01 release containing first aid
+ for packages bidi, filehook and class dinbrief.
+
+
diff --git a/Master/texmf-dist/doc/latex-dev/firstaid/latex2e-first-aid-for-external-files.pdf b/Master/texmf-dist/doc/latex-dev/firstaid/latex2e-first-aid-for-external-files.pdf
new file mode 100644
index 00000000000..eecccbc8f6f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex-dev/firstaid/latex2e-first-aid-for-external-files.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex-dev/firstaid/firstaid.ins b/Master/texmf-dist/source/latex-dev/firstaid/firstaid.ins
new file mode 100644
index 00000000000..6a1dbaa853f
--- /dev/null
+++ b/Master/texmf-dist/source/latex-dev/firstaid/firstaid.ins
@@ -0,0 +1,78 @@
+%%
+%% This file will generate fast loadable files and documentation
+%% driver files from the doc files in this package when run through
+%% LaTeX or TeX.
+%%
+%% Copyright (C) 2020,2021
+%% The LaTeX Project and any individual authors listed elsewhere
+%% in this file.
+%%
+%% This file is part of the Standard LaTeX `First Aid Bundle'.
+%% -------------------------------------------------------
+%%
+%% It may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3c
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% https://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% As this file contains legal notices, it is NOT PERMITTED to modify
+%% this file in any way that the legal information placed into
+%% generated files is changed (i.e., the files generated when the
+%% original file is executed). This restriction does not apply if
+%% (parts of) the content is reused in a different WORK producing its
+%% own generated files.
+%%
+%% The list of all files belonging to the `First Aid Bundle' is
+%% given in the file `manifest.txt'.
+%%
+%%
+%% --------------- start of docstrip commands ------------------
+%%
+\input docstrip
+
+\keepsilent
+
+\usedir{tex/latex/firstaid}
+
+\preamble
+
+The source is maintained by the LaTeX Project team and bug
+reports for it can be opened at https://latex-project.org/bugs/
+(but please observe conditions on bug reports sent to that address!)
+
+
+Copyright (C) 2020-2021
+The LaTeX Project and any individual authors listed elsewhere
+in this file.
+
+This file was generated from file(s) of the Standard LaTeX `First Aid Bundle'.
+------------------------------------------------------------------------------
+
+It may be distributed and/or modified under the
+conditions of the LaTeX Project Public License, either version 1.3c
+of this license or (at your option) any later version.
+The latest version of this license is in
+ https://www.latex-project.org/lppl.txt
+and version 1.3c or later is part of all distributions of LaTeX
+version 2005/12/01 or later.
+
+This file may only be distributed together with a copy of the LaTeX
+`First Aid Bundle'. You may however distribute the LaTeX `First Aid Bundle'
+without such generated files.
+
+\endpreamble
+
+
+\generate{\file{latex2e-first-aid-for-external-files.ltx}
+ {\from{latex2e-first-aid-for-external-files.dtx}{kernel}}}
+
+\generate{\file{filehook-ltx.sty}
+ {\from{latex2e-first-aid-for-external-files.dtx}{filehook-ltx}}}
+
+\generate{\file{everysel-ltx.sty}
+ {\from{latex2e-first-aid-for-external-files.dtx}{everysel-ltx}}}
+
+\endbatchfile
diff --git a/Master/texmf-dist/source/latex-dev/firstaid/latex2e-first-aid-for-external-files.dtx b/Master/texmf-dist/source/latex-dev/firstaid/latex2e-first-aid-for-external-files.dtx
new file mode 100644
index 00000000000..a74cb79a78f
--- /dev/null
+++ b/Master/texmf-dist/source/latex-dev/firstaid/latex2e-first-aid-for-external-files.dtx
@@ -0,0 +1,521 @@
+% \iffalse meta-comment
+%
+%% File: latex2e-first-aid-for-external-files.dtx (C) Copyright 2020,2021
+%% The LaTeX Project and any individual authors listed elsewhere
+%% in this file.
+%
+% It may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3c
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% https://www.latex-project.org/lppl.txt
+% and version 1.3c or later is part of all distributions of LaTeX
+% version 2008 or later.
+%
+% This file has the LPPL maintenance status "maintained".
+%
+%
+%
+%<*driver>
+\documentclass{ltxdoc}
+\EnableCrossrefs
+\CodelineIndex
+\begin{document}
+ \DocInput{latex2e-first-aid-for-external-files.dtx}
+\end{document}
+%</driver>
+%
+% \fi
+%
+%
+% \providecommand\pkg[1]{\texttt{#1}}
+%
+% \title{First aid for external files and packages that need updating}
+% \author{Frank Mittelbach, \LaTeX{} Project}
+%
+% \maketitle
+%
+%
+% \begin{abstract}
+% This file contains some first aid for packages or classes that
+% require updates because of internal changes to \LaTeX{} but that
+% aren't yet reflected in the package/class code.
+% \end{abstract}
+%
+% \tableofcontents
+%
+% \section{Introduction}
+%
+% Over the years package writers have hooked into
+% various parts of internal \LaTeX{} commands (largely because
+% proper interfaces were missing in important places) and if
+% we are now gradually adding such interfaces these internal
+% commands do change and as a result patching into them stops
+% working.
+%
+% As part of making such internal changes the \LaTeX{} Project team
+% attempts to check for such usage in packages, alert the package
+% maintainers and ensures that the packages get updated alongside
+% the core \LaTeX{} system. However it is not always possible to
+% get packages that will fail with a new kernel updated in time and
+% if that is the case we try to provide a temporary fix in this
+% file for them.
+% Once the package gets updated the fix will then be removed again.
+%
+% For that reason, it is put into a separate bundle so that we can
+% update it easily without requiring the CTAN maintainers to
+% install a new full LaTeX system just because we take out (or add)
+% a fix for a package here.
+%
+% In the best case scenario the file documented here should be
+% empty. In practice it will probably always contain one or the
+% other fix while we are waiting for the package to get updated.
+%
+% \begin{quote} \textbf{Important notice:} The fixes provided here
+% are not meant to be a permanent solution, but are only provided
+% to support the transition period. They are (usually) neither
+% complete nor necessarily the best solution! Furthermore, as they
+% are done from the ``outside'', they usually add some burden and
+% slow down \LaTeX{} processing, even if the package/class is not
+% used in the document.
+%
+% We will therefore remove such code as soon as possible
+% again. In practice this means that if some package never gets
+% updated/corrected, then it will eventually fail to work, because
+% after one or at most two \LaTeX{} releases we will take out the
+% transition code to ensure that this ``first aid patching''
+% doesn't get out of bounds.
+% \end{quote}
+%
+% \subsection{Minor kernel fixes}
+%
+% If we encounter issues with the kernel code that should get fixed
+% before the next main release we normally generate a patch release
+% for \LaTeX{}. However, depending on the complexity of the fix we
+% might first add the fix here and generate a full patch release
+% only when a number of such issues have accumulated. This way we
+% lessen the impact on CTAN maintainers because for each tach
+% release we have to make and distribute also a matching
+% development release.
+%
+% \StopEventually{\setlength\IndexMin{200pt} \PrintIndex }
+%
+%
+% \section{The Implementation}
+%
+% This file is meant to be loaded during format generation which is
+% why we give it the extension \texttt{.ltx}.
+% \begin{macrocode}
+%<*kernel>
+% \end{macrocode}
+%
+% \begin{macrocode}
+\def\LaTeXFirstAidDate{2021/02/24}
+\def\LaTeXFirstAidVersion{v1.0k}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\ProvidesFile{latex2e-first-aid-for-external-files.ltx}
+ [\LaTeXFirstAidDate\space \LaTeXFirstAidVersion\space
+ LaTeX kernel fixes to external files and packages]
+% \end{macrocode}
+ %
+
+% \begin{macro}{\FirstAidNeededT}
+% This is a very simple help to ensure that we only apply first aid
+% to an unmodified package or class. It only works in the case the
+% file has already been loaded and the csname \cs{ver@\#1.\#2} got
+% defined (holding the current date, version, and short description
+% info). We then compare its content to a frozen string and make
+% the modification \verb=#3= only if both agree. If they differ we
+% assume that the package/class in question got updated by its
+% maintainer.
+% \begin{macrocode}
+\ExplSyntaxOn
+\cs_new:Npn\FirstAidNeededT#1#2#3{
+ \exp_args:Nc\str_if_eq:onT{ver@#1.#2}{#3}
+}
+\ExplSyntaxOff
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+%</kernel>
+% \end{macrocode}
+%
+%
+% \subsection{The \pkg{filehook} package first aid}
+%
+% The \pkg{filehook} package implements hooks into file loading
+% commands. These days this is already provided by the kernel
+% albeit not with the same user interface. Until that package gets
+% updated (to use the kernel interfaces) we provide a
+% substitution. This does not offer all hooks from \pkg{filehook}
+% but all that have been used in packages available in \TeX{} Live.
+%
+% Note that this doesn't fix \pkg{currfile} because that package
+% uses \pkg{filehook} but relies on the internals of the old
+% implementation.
+%
+% The package has now got an update so we aren't activating the
+% first aid. However, at the moment it basically bypasses the new
+% hook mechanism and puts the old hooks in thereby disabling, for
+% example, the possibility to re-order code through rules.
+%
+% We therefore keep \texttt{filehook-ltx.sty} around as a guideline
+% for further updates.
+%
+% Replacing \pkg{filehook} with a leaner version would then work
+% like this:
+% \begin{macrocode}
+%<*kernel>
+%\declare@file@substitution{filehook.sty}{filehook-ltx.sty}
+%</kernel>
+% \end{macrocode}
+%
+% What follows is a simplified (partial) implementation of the \pkg{filehook}
+% interfaces.
+% Not implemented are:
+%\begin{verbatim}
+% \AtBeginOfFiles \AtEndOfFiles
+% \AtBeginOfInputs \AtEndOfInputs
+% \AtBeginOfInputFile \AtEndOfInputFile
+%\end{verbatim}
+%
+% \begin{macrocode}
+%<*filehook-ltx>
+% \end{macrocode}
+%
+% \begin{macrocode}
+\newcommand\AtBeginOfEveryFile [1]
+ {\AddToHook{file/before}{#1}}
+\newcommand\AtEndOfEveryFile [1]
+ {\AddToHook{file/after}{#1}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\newcommand\AtBeginOfIncludes [1]
+ {\AddToHook{include/before}{#1}}
+\newcommand\AtEndOfIncludes [1]
+ {\AddToHook{include/end}{#1}}
+\newcommand\AfterIncludes [1]
+ {\AddToHook{include/after}{#1}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\newcommand\AtBeginOfPackages [1]
+ {\AddToHook{package/before}{#1}}
+\newcommand\AtEndOfPackages [1]
+ {\AddToHook{package/after}{#1}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\newcommand\AtBeginOfClasses [1]
+ {\AddToHook{class/before}{#1}}
+\newcommand\AtEndOfClasses [1]
+ {\AddToHook{class/after}{#1}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\newcommand\AtBeginOfFile [2]
+ {\AddToHook{file/before/#1}{#2}}
+\newcommand\AtEndOfFile [2]
+ {\AddToHook{file/after/#1}{#2}}
+% \end{macrocode}
+%
+% Some commands offered a starred form
+% \begin{macrocode}
+\DeclareDocumentCommand \AtBeginOfPackageFile {smm}
+ {\IfBooleanTF{#1}%
+ {\@ifpackageloaded{#2}%
+ {#3}%
+ {\AddToHook{package/before/#2}{#3}}}%
+ {\AddToHook{package/before/#2}{#3}}%
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareDocumentCommand \AtEndOfPackageFile {smm}
+ {\IfBooleanTF{#1}%
+ {\@ifpackageloaded{#2}%
+ {#3}%
+ {\AddToHook{package/after/#2}{#3}}}%
+ {\AddToHook{package/after/#2}{#3}}%
+ }
+% \end{macrocode}
+%
+% Are the * forms here of any use? I know they are use 3--4 times
+% on CTAN but I wonder if those are real or mistaken usages.
+% \begin{macrocode}
+\DeclareDocumentCommand \AtBeginOfClassFile {smm}
+ {\IfBooleanTF{#1}%
+ {\@ifclassloaded{#2}%
+ {#3}%
+ {\AddToHook{class/before/#2}{#3}}}%
+ {\AddToHook{class/before/#2}{#3}}%
+ }
+\DeclareDocumentCommand \AtEndOfClassFile {smm}
+ {\IfBooleanTF{#1}%
+ {\@ifclassloaded{#2}%
+ {#3}%
+ {\AddToHook{class/after/#2}{#3}}}%
+ {\AddToHook{class/after/#2}{#3}}%
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\newcommand\AtBeginOfIncludeFile [2]
+ {\AddToHook{include/before/#1}{#2}}
+\newcommand\AtEndOfIncludeFile [2]
+ {\AddToHook{include/end/#1}{#2}}
+\newcommand\AfterIncludeFile [2]
+ {\AddToHook{include/after/#1}{#2}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+%</filehook-ltx>
+% \end{macrocode}
+%
+%
+%
+%
+% \subsection{The \pkg{bidi} package first aid}
+%
+% The \pkg{bidi} package adds a lot of hooks in various places and
+% those added to \cs{document} and \cs{enddocument} are now no
+% longer necessary as the kernel already provides the right hooks
+% there.
+%
+% However, we aren't trying to change that but instead only make
+% sure that the existing patches still work by adding some first
+% aid after \pkg{biditools} has been loaded.
+%
+% If the package gets updated one can easily take that out simply
+% through
+%\begin{verbatim}
+% \RemoveFromHook{file/after/biditools.sty}[firstaid]
+%\end{verbatim}
+% This makes it easy to test new bidi code while the first aid code
+% is still in the kernel.
+%
+% \begin{macrocode}
+%<*kernel>
+% \end{macrocode}
+%
+% \begin{macrocode}
+\AddToHook{file/after/biditools.sty}[firstaid]{%
+ \FirstAidNeededT{biditools}{sty}%
+ {2020/05/13 v2 Programming tools for bidi package}%
+ {%
+% \end{macrocode}
+% \pkg{bidi} adds some code to the beginning of \cs{document} which
+% contains \cs{endgroup} and \cs{begingroup} which is no longer
+% correct.
+%
+% Patching \cs{document} using \cs{bidi@patchcmd} doesn't work so
+% we take the extra groups out by hand:
+% \begin{macrocode}
+ \def\firstaid@bidi@document@patch
+ \endgroup#1\begingroup#2\firstaid@bidi@document@patch
+ {\unexpanded{#1#2}}%
+ \edef\document{\expandafter\firstaid@bidi@document@patch\document
+ \firstaid@bidi@document@patch}%
+% \end{macrocode}
+% There are also some patches into \cs{enddocument}, some continue
+% to go in but one fails, so we add that now into the right place.
+% \begin{macrocode}
+ \AddToHook{enddocument/info}%
+ {\let\bidi@AfterEndDocumentCheckLabelsRerun\@firstofone
+ \bidi@afterenddocumentchecklabelsrerunhook}%
+ }%
+}
+% \end{macrocode}
+%
+%
+%
+% \subsection{The \pkg{dinbrief} class first aid}
+%
+% Again a case of a no longer correct \cs{endgroup} in document.
+% Here the fix is simply though.
+% \begin{macrocode}
+\AddToHook{file/after/dinbrief.cls}[firstaid]{%
+ \FirstAidNeededT{dinbrief}{cls}{2000/03/02 LaTeX2e class}%
+ {\AddToHook{env/document/begin}{\begingroup}}%
+}
+% \end{macrocode}
+%
+%
+%
+%
+% \subsection{The \pkg{pgfpages} and \pkg{pgfmorepages} first aid}
+%
+% \pkg{pgfpages} alters the \cs{shipout} primitive to support
+% multiple page up scenarios. If used together with \pkg{atbegshi}
+% that worked because the alterations done by \pkg{atbegshi} came
+% later and so used the new definition provide by
+% \pkg{pgfpages}. Now that the code from \pkg{atbegshi} is already
+% in the kernel this further redefinition doesn't happen with the
+% result that the change to \cs{shipout} comes to late and
+% breaks the kernel processes.
+%
+% \begin{macrocode}
+\ExplSyntaxOn
+\AddToHook{file/after/pgfpages.sty}[firstaid]{%
+% \end{macrocode}
+% Undo overwriting \cs{shipout}:
+% \begin{macrocode}
+ \cs_gset_eq:NN \shipout \pgfpages@originalshipout
+% \end{macrocode}
+% Instead overwrite the L3 programming layer name of the
+% primitive. This is really an absolute no-go, but for now the
+% simplest solution to keep the original code running.
+%
+% It will be replaced when the ``configuration points'' interface
+% for \LaTeX{} becomes available. At that point the package will be
+% able to set up a different strategy for doing shipouts and
+% without the need to overrite a primitive (which it did in the
+% past and which we do below) and then this code here can be taken
+% out again.
+% \begin{macrocode}
+ \cs_set_eq:NN \pgfpages@originalshipout \tex_shipout:D
+ \cs_set_eq:NN \tex_shipout:D \pgfpages@interceptshipout
+}
+\ExplSyntaxOff
+% \end{macrocode}
+%
+% Same issue with \pkg{pgfmorepages} but slightly different implementation (sigh).
+%
+% \begin{macrocode}
+\ExplSyntaxOn
+\AddToHook{file/after/pgfmorepages.sty}[firstaid]{
+ \cs_set_nopar:Npn \pgfhookintoshipout {
+ \cs_set_eq:NN \pgfpages@originalshipout \tex_shipout:D
+ \cs_set_eq:NN \tex_shipout:D \pgfpages@interceptshipout
+ }
+}
+\ExplSyntaxOff
+% \end{macrocode}
+%
+%
+% \begin{macrocode}
+%</kernel>
+% \end{macrocode}
+%
+%
+%
+%
+%
+% \subsection{The \pkg{everysel} package first aid}
+%
+%
+% The \cs{selectfont} command got a hook (with the 2021/05 release) which
+% was originally provided by the \pkg{everysel}
+% package. Now that it is in the kernel this package is no longer
+% needed (or only in a simplified manner).
+%
+% If it is requested we replace it with a simplified package
+% (until) it gets updated at which point this line can be removed.
+% \changes{v2.2k}{2020/12/04}{Emulate everysel package}
+% \begin{macrocode}
+%<*kernel>
+% this has been updated
+%\declare@file@substitution{everysel.sty}{everysel-ltx.sty}
+%</kernel>
+% \end{macrocode}
+%
+%
+%
+% \begin{macrocode}
+%<*everysel-ltx>
+\ProvidesPackage{everysel-ltx}
+ [2020/12/04 v1.0a
+ Emulation of the original everysel^^Jpackage with kernel methods]
+% \end{macrocode}
+%
+% \begin{macrocode}
+\newcommand*{\EverySelectfont}[1]
+ {\AddToHook{selectfont}{#1}}
+\newcommand*{\AtNextSelectfont}[1]
+ {\AddToHookNext{selectfont}{#1}}
+% \end{macrocode}
+%
+%
+% \begin{macrocode}
+%</everysel-ltx>
+% \end{macrocode}
+%
+%
+%
+%
+%
+% \subsection{The \pkg{CJK} package first aid}
+%
+% \begin{macrocode}
+%<*kernel>
+% \end{macrocode}
+%
+% The package redefines \cs{selectfont} to add some code but
+% otherwise uses the old definition. So we make a copy of the
+% newer kernel definition and restore it after the package got
+% loaded. The extra code that the package needs can go into the
+% newly provided hook instead.
+%
+% \begin{macrocode}
+\DeclareCommandCopy\CJK@selectfont\selectfont
+% \end{macrocode}
+%
+% \begin{macrocode}
+\AddToHook{file/after/CJK.sty}[firstaid]{%
+ \FirstAidNeededT{CJK}{sty}%
+ {2015/04/18 4.8.4}%
+ {%
+ \DeclareCommandCopy\selectfont\CJK@selectfont
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \AddToHook{selectfont}[CJK]{%
+ \expandafter\ifx\csname CJK@\curr@fontshape\endcsname \relax
+ \else
+ \CJK@bold@false
+ \csname CJK@\curr@fontshape\endcsname
+ \fi
+ }%
+ }%
+}
+% \end{macrocode}
+%
+%
+%
+% \subsection{\cs{footref} first aid}
+%
+% A few classes unconditionally define \cs{footref}. Until that has
+% changed we provide some first aid to let them do this.
+%
+% \begin{macrocode}
+\AddToHook{file/after/scrkbase.sty}[firstaid]{%
+ \FirstAidNeededT{scrkbase}{sty}%
+ {2020/09/21 v3.32 KOMA-Script package (KOMA-Script-dependent basics and keyval usage)}%
+ {\let\footref\@undefined}
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\AddToHook{class/before/memoir}[firstaid]{%
+ % for version {2020/10/04 v3.7n configurable book, report, article document class}%
+ \let\footref\@undefined
+}
+% \end{macrocode}
+%
+%
+% \subsection[Temporary fixes for the kernel (until the next
+% patch-level release)]
+% {Temporary fixes for the kernel \\
+% (until the next patch-level release)}
+%
+%
+% \begin{macrocode}
+%</kernel>
+% \end{macrocode}
+%
+% \Finale
+%
diff --git a/Master/texmf-dist/tex/latex-dev/firstaid/everysel-ltx.sty b/Master/texmf-dist/tex/latex-dev/firstaid/everysel-ltx.sty
new file mode 100644
index 00000000000..c8a984b7e6e
--- /dev/null
+++ b/Master/texmf-dist/tex/latex-dev/firstaid/everysel-ltx.sty
@@ -0,0 +1,45 @@
+%%
+%% This is file `everysel-ltx.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% latex2e-first-aid-for-external-files.dtx (with options: `everysel-ltx')
+%%
+%% The source is maintained by the LaTeX Project team and bug
+%% reports for it can be opened at https://latex-project.org/bugs/
+%% (but please observe conditions on bug reports sent to that address!)
+%%
+%%
+%% Copyright (C) 2020-2021
+%% The LaTeX Project and any individual authors listed elsewhere
+%% in this file.
+%%
+%% This file was generated from file(s) of the Standard LaTeX `First Aid Bundle'.
+%% ------------------------------------------------------------------------------
+%%
+%% It may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3c
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% https://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This file may only be distributed together with a copy of the LaTeX
+%% `First Aid Bundle'. You may however distribute the LaTeX `First Aid Bundle'
+%% without such generated files.
+%%
+%% File: latex2e-first-aid-for-external-files.dtx (C) Copyright 2020,2021
+%% The LaTeX Project and any individual authors listed elsewhere
+%% in this file.
+\ProvidesPackage{everysel-ltx}
+ [2020/12/04 v1.0a
+ Emulation of the original everysel^^Jpackage with kernel methods]
+\newcommand*{\EverySelectfont}[1]
+ {\AddToHook{selectfont}{#1}}
+\newcommand*{\AtNextSelectfont}[1]
+ {\AddToHookNext{selectfont}{#1}}
+\endinput
+%%
+%% End of file `everysel-ltx.sty'.
diff --git a/Master/texmf-dist/tex/latex-dev/firstaid/filehook-ltx.sty b/Master/texmf-dist/tex/latex-dev/firstaid/filehook-ltx.sty
new file mode 100644
index 00000000000..643a3d92667
--- /dev/null
+++ b/Master/texmf-dist/tex/latex-dev/firstaid/filehook-ltx.sty
@@ -0,0 +1,94 @@
+%%
+%% This is file `filehook-ltx.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% latex2e-first-aid-for-external-files.dtx (with options: `filehook-ltx')
+%%
+%% The source is maintained by the LaTeX Project team and bug
+%% reports for it can be opened at https://latex-project.org/bugs/
+%% (but please observe conditions on bug reports sent to that address!)
+%%
+%%
+%% Copyright (C) 2020-2021
+%% The LaTeX Project and any individual authors listed elsewhere
+%% in this file.
+%%
+%% This file was generated from file(s) of the Standard LaTeX `First Aid Bundle'.
+%% ------------------------------------------------------------------------------
+%%
+%% It may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3c
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% https://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This file may only be distributed together with a copy of the LaTeX
+%% `First Aid Bundle'. You may however distribute the LaTeX `First Aid Bundle'
+%% without such generated files.
+%%
+%% File: latex2e-first-aid-for-external-files.dtx (C) Copyright 2020,2021
+%% The LaTeX Project and any individual authors listed elsewhere
+%% in this file.
+\newcommand\AtBeginOfEveryFile [1]
+ {\AddToHook{file/before}{#1}}
+\newcommand\AtEndOfEveryFile [1]
+ {\AddToHook{file/after}{#1}}
+\newcommand\AtBeginOfIncludes [1]
+ {\AddToHook{include/before}{#1}}
+\newcommand\AtEndOfIncludes [1]
+ {\AddToHook{include/end}{#1}}
+\newcommand\AfterIncludes [1]
+ {\AddToHook{include/after}{#1}}
+\newcommand\AtBeginOfPackages [1]
+ {\AddToHook{package/before}{#1}}
+\newcommand\AtEndOfPackages [1]
+ {\AddToHook{package/after}{#1}}
+\newcommand\AtBeginOfClasses [1]
+ {\AddToHook{class/before}{#1}}
+\newcommand\AtEndOfClasses [1]
+ {\AddToHook{class/after}{#1}}
+\newcommand\AtBeginOfFile [2]
+ {\AddToHook{file/before/#1}{#2}}
+\newcommand\AtEndOfFile [2]
+ {\AddToHook{file/after/#1}{#2}}
+\DeclareDocumentCommand \AtBeginOfPackageFile {smm}
+ {\IfBooleanTF{#1}%
+ {\@ifpackageloaded{#2}%
+ {#3}%
+ {\AddToHook{package/before/#2}{#3}}}%
+ {\AddToHook{package/before/#2}{#3}}%
+ }
+\DeclareDocumentCommand \AtEndOfPackageFile {smm}
+ {\IfBooleanTF{#1}%
+ {\@ifpackageloaded{#2}%
+ {#3}%
+ {\AddToHook{package/after/#2}{#3}}}%
+ {\AddToHook{package/after/#2}{#3}}%
+ }
+\DeclareDocumentCommand \AtBeginOfClassFile {smm}
+ {\IfBooleanTF{#1}%
+ {\@ifclassloaded{#2}%
+ {#3}%
+ {\AddToHook{class/before/#2}{#3}}}%
+ {\AddToHook{class/before/#2}{#3}}%
+ }
+\DeclareDocumentCommand \AtEndOfClassFile {smm}
+ {\IfBooleanTF{#1}%
+ {\@ifclassloaded{#2}%
+ {#3}%
+ {\AddToHook{class/after/#2}{#3}}}%
+ {\AddToHook{class/after/#2}{#3}}%
+ }
+\newcommand\AtBeginOfIncludeFile [2]
+ {\AddToHook{include/before/#1}{#2}}
+\newcommand\AtEndOfIncludeFile [2]
+ {\AddToHook{include/end/#1}{#2}}
+\newcommand\AfterIncludeFile [2]
+ {\AddToHook{include/after/#1}{#2}}
+\endinput
+%%
+%% End of file `filehook-ltx.sty'.
diff --git a/Master/texmf-dist/tex/latex-dev/firstaid/latex2e-first-aid-for-external-files.ltx b/Master/texmf-dist/tex/latex-dev/firstaid/latex2e-first-aid-for-external-files.ltx
new file mode 100644
index 00000000000..233dfed70fa
--- /dev/null
+++ b/Master/texmf-dist/tex/latex-dev/firstaid/latex2e-first-aid-for-external-files.ltx
@@ -0,0 +1,107 @@
+%%
+%% This is file `latex2e-first-aid-for-external-files.ltx',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% latex2e-first-aid-for-external-files.dtx (with options: `kernel')
+%%
+%% The source is maintained by the LaTeX Project team and bug
+%% reports for it can be opened at https://latex-project.org/bugs/
+%% (but please observe conditions on bug reports sent to that address!)
+%%
+%%
+%% Copyright (C) 2020-2021
+%% The LaTeX Project and any individual authors listed elsewhere
+%% in this file.
+%%
+%% This file was generated from file(s) of the Standard LaTeX `First Aid Bundle'.
+%% ------------------------------------------------------------------------------
+%%
+%% It may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3c
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% https://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This file may only be distributed together with a copy of the LaTeX
+%% `First Aid Bundle'. You may however distribute the LaTeX `First Aid Bundle'
+%% without such generated files.
+%%
+%% File: latex2e-first-aid-for-external-files.dtx (C) Copyright 2020,2021
+%% The LaTeX Project and any individual authors listed elsewhere
+%% in this file.
+\def\LaTeXFirstAidDate{2021/02/24}
+\def\LaTeXFirstAidVersion{v1.0k}
+\ProvidesFile{latex2e-first-aid-for-external-files.ltx}
+ [\LaTeXFirstAidDate\space \LaTeXFirstAidVersion\space
+ LaTeX kernel fixes to external files and packages]
+ %
+
+\ExplSyntaxOn
+\cs_new:Npn\FirstAidNeededT#1#2#3{
+ \exp_args:Nc\str_if_eq:onT{ver@#1.#2}{#3}
+}
+\ExplSyntaxOff
+\AddToHook{file/after/biditools.sty}[firstaid]{%
+ \FirstAidNeededT{biditools}{sty}%
+ {2020/05/13 v2 Programming tools for bidi package}%
+ {%
+ \def\firstaid@bidi@document@patch
+ \endgroup#1\begingroup#2\firstaid@bidi@document@patch
+ {\unexpanded{#1#2}}%
+ \edef\document{\expandafter\firstaid@bidi@document@patch\document
+ \firstaid@bidi@document@patch}%
+ \AddToHook{enddocument/info}%
+ {\let\bidi@AfterEndDocumentCheckLabelsRerun\@firstofone
+ \bidi@afterenddocumentchecklabelsrerunhook}%
+ }%
+}
+\AddToHook{file/after/dinbrief.cls}[firstaid]{%
+ \FirstAidNeededT{dinbrief}{cls}{2000/03/02 LaTeX2e class}%
+ {\AddToHook{env/document/begin}{\begingroup}}%
+}
+\ExplSyntaxOn
+\AddToHook{file/after/pgfpages.sty}[firstaid]{%
+ \cs_gset_eq:NN \shipout \pgfpages@originalshipout
+ \cs_set_eq:NN \pgfpages@originalshipout \tex_shipout:D
+ \cs_set_eq:NN \tex_shipout:D \pgfpages@interceptshipout
+}
+\ExplSyntaxOff
+\ExplSyntaxOn
+\AddToHook{file/after/pgfmorepages.sty}[firstaid]{
+ \cs_set_nopar:Npn \pgfhookintoshipout {
+ \cs_set_eq:NN \pgfpages@originalshipout \tex_shipout:D
+ \cs_set_eq:NN \tex_shipout:D \pgfpages@interceptshipout
+ }
+}
+\ExplSyntaxOff
+\DeclareCommandCopy\CJK@selectfont\selectfont
+\AddToHook{file/after/CJK.sty}[firstaid]{%
+ \FirstAidNeededT{CJK}{sty}%
+ {2015/04/18 4.8.4}%
+ {%
+ \DeclareCommandCopy\selectfont\CJK@selectfont
+ \AddToHook{selectfont}[CJK]{%
+ \expandafter\ifx\csname CJK@\curr@fontshape\endcsname \relax
+ \else
+ \CJK@bold@false
+ \csname CJK@\curr@fontshape\endcsname
+ \fi
+ }%
+ }%
+}
+\AddToHook{file/after/scrkbase.sty}[firstaid]{%
+ \FirstAidNeededT{scrkbase}{sty}%
+ {2020/09/21 v3.32 KOMA-Script package (KOMA-Script-dependent basics and keyval usage)}%
+ {\let\footref\@undefined}
+ }
+\AddToHook{class/before/memoir}[firstaid]{%
+ % for version {2020/10/04 v3.7n configurable book, report, article document class}%
+ \let\footref\@undefined
+}
+\endinput
+%%
+%% End of file `latex2e-first-aid-for-external-files.ltx'.
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index c4659db0cad..06ba4ada462 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -429,7 +429,7 @@ my @TLP_working = qw(
lapdf lastpackage lastpage
latex latex-amsmath-dev latex-base-dev
latex-brochure
- latex-course latex-doc-ptr latex-fonts
+ latex-course latex-doc-ptr latex-firstaid-dev latex-fonts
latex-git-log latex-graphics-companion latex-graphics-dev
latex-make latex-mr latex-notes-zh-cn
latex-papersize latex-refsheet
diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
index 2900d13c565..d2e5a33070e 100644
--- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
@@ -670,6 +670,7 @@ depend lastpage
depend latex-amsmath-dev
depend latex-base-dev
depend latex-bin-dev
+depend latex-firstaid-dev
depend latex-graphics-dev
depend latex-tds
depend latex-tools-dev
diff --git a/Master/tlpkg/tlpsrc/latex-bin-dev.tlpsrc b/Master/tlpkg/tlpsrc/latex-bin-dev.tlpsrc
index 14e1e2dd139..b768ad71e60 100644
--- a/Master/tlpkg/tlpsrc/latex-bin-dev.tlpsrc
+++ b/Master/tlpkg/tlpsrc/latex-bin-dev.tlpsrc
@@ -10,12 +10,13 @@ depend latexconfig
depend latex-fonts
#
depend latex-base-dev
+depend latex-firstaid-dev
depend latex-graphics-dev
docpattern f texmf-dist/doc/man/man1/*latex-dev.*
# cf. latex-bin.tlpsrc.
-tlpsetvar fmtcomm ${global_latex_deps},latex-base-dev
+tlpsetvar fmtcomm ${global_latex_deps},latex-base-dev,latex-firstaid-dev
#
tlpsetvar nonluafmtdeps dehyph,hyph-utf8,latexconfig
tlpsetvar luafmtdeps lm,luaotfload
diff --git a/Master/tlpkg/tlpsrc/latex-firstaid-dev.tlpsrc b/Master/tlpkg/tlpsrc/latex-firstaid-dev.tlpsrc
new file mode 100644
index 00000000000..cbf1a86f2b1
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/latex-firstaid-dev.tlpsrc
@@ -0,0 +1,3 @@
+runpattern d texmf-dist/tex/latex-dev/firstaid
+srcpattern d texmf-dist/source/latex-dev/firstaid
+docpattern d texmf-dist/doc/latex-dev/firstaid