summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex-dev/amsmath/amsmath.dtx10
-rw-r--r--Master/texmf-dist/source/latex-dev/base/classes.dtx22
-rw-r--r--Master/texmf-dist/source/latex-dev/base/doc.dtx11
-rw-r--r--Master/texmf-dist/source/latex-dev/base/ltboxes.dtx25
-rw-r--r--Master/texmf-dist/source/latex-dev/base/ltcmdhooks.dtx373
-rw-r--r--Master/texmf-dist/source/latex-dev/base/ltfiles.dtx20
-rw-r--r--Master/texmf-dist/source/latex-dev/base/ltfinal.dtx37
-rw-r--r--Master/texmf-dist/source/latex-dev/base/ltfloat.dtx27
-rw-r--r--Master/texmf-dist/source/latex-dev/base/ltfssdcl.dtx255
-rw-r--r--Master/texmf-dist/source/latex-dev/base/lthooks.dtx28
-rw-r--r--Master/texmf-dist/source/latex-dev/base/ltluatex.dtx4
-rw-r--r--Master/texmf-dist/source/latex-dev/base/ltmath.dtx8
-rw-r--r--Master/texmf-dist/source/latex-dev/base/ltoutenc.dtx7
-rw-r--r--Master/texmf-dist/source/latex-dev/base/ltpara.dtx214
-rw-r--r--Master/texmf-dist/source/latex-dev/base/ltvers.dtx2
-rw-r--r--Master/texmf-dist/source/latex-dev/base/makeindx.dtx4
-rw-r--r--Master/texmf-dist/source/latex-dev/base/preload.dtx4
-rw-r--r--Master/texmf-dist/source/latex-dev/base/slides.dtx8
-rw-r--r--Master/texmf-dist/source/latex-dev/graphics/color.dtx23
-rw-r--r--Master/texmf-dist/source/latex-dev/graphics/graphics.dtx2
-rw-r--r--Master/texmf-dist/source/latex-dev/tools/array.dtx6
-rw-r--r--Master/texmf-dist/source/latex-dev/tools/multicol.dtx128
22 files changed, 950 insertions, 268 deletions
diff --git a/Master/texmf-dist/source/latex-dev/amsmath/amsmath.dtx b/Master/texmf-dist/source/latex-dev/amsmath/amsmath.dtx
index eec51f50cbe..a5cf333e797 100644
--- a/Master/texmf-dist/source/latex-dev/amsmath/amsmath.dtx
+++ b/Master/texmf-dist/source/latex-dev/amsmath/amsmath.dtx
@@ -86,7 +86,7 @@ Bug reports can be opened (category \texttt{#1}) at\\%
% \end{macrocode}
%
% \begin{macrocode}
-\ProvidesPackage{amsmath}[2021/08/28 v2.17k AMS math features]
+\ProvidesPackage{amsmath}[2021/10/15 v2.17l AMS math features]
% \end{macrocode}
%
% \section{Catcode defenses}
@@ -3012,7 +3012,13 @@ ill-advised in LaTeX.%
% the \cs{maketag@@} macro above.
% \begin{macrocode}
\let\df@tag\@empty
-\def\make@df@tag{\@ifstar\make@df@tag@@\make@df@tag@@@}
+\def\make@df@tag{%
+% \end{macrocode}
+% We set \cs{@currentcounter} here so that it applies to both branches.
+%\changes{v2.17l}{2021/10/15}{Explicitly set \cs{@currentcounter} (gh/687)}
+% \begin{macrocode}
+ \def\@currentcounter{equation}%
+ \@ifstar\make@df@tag@@\make@df@tag@@@}
% \end{macrocode}
% \cs{make@df@tag} sets \cs{@currentlabel} and defines
% \cs{df@tag} appropriately.
diff --git a/Master/texmf-dist/source/latex-dev/base/classes.dtx b/Master/texmf-dist/source/latex-dev/base/classes.dtx
index fdf0ef3a5b0..a13053b871a 100644
--- a/Master/texmf-dist/source/latex-dev/base/classes.dtx
+++ b/Master/texmf-dist/source/latex-dev/base/classes.dtx
@@ -53,7 +53,7 @@
%<*driver>
\ProvidesFile{classes.drv}
%</driver>
- [2021/09/11 v1.4n
+ [2021/10/04 v1.4n
%<article|report|book> Standard LaTeX document class]
%<10pt|11pt|12pt> Standard LaTeX file (size option)]
% \end{macrocode}
@@ -1622,7 +1622,7 @@
% \label{sec:classes:pagestyle}
%
% The pagestyles \pstyle{empty} and \pstyle{plain} are defined in
-% \file{latex.dtx}.
+% the \LaTeX{} format.
%
% \begin{macro}{\ps@headings}
% The definition of the page style \pstyle{headings} has to be
@@ -1771,7 +1771,7 @@
% \begin{macro}{\title}
% \begin{macro}{\author}
% \begin{macro}{\date}
-% These three macros are provided by \file{latex.dtx} to provide
+% These three macros are provided by the \LaTeX{} format to provide
% information about the title, author(s) and date of the document.
% The information is stored away in internal control sequences.
% It is the task of the |\maketitle| command to use the
@@ -2056,7 +2056,7 @@
% Default initializations of |\...mark| commands. These commands
% are used in the definition of the page styles (see
% section~\ref{sec:classes:pagestyle}) Most of them are already defined by
-% \file{latex.dtx}, so they are only shown here.
+% the \LaTeX{} format, so they are only shown here.
%
% \begin{macrocode}
%<!article>\newcommand*\chaptermark[1]{}
@@ -2891,7 +2891,7 @@
% \begin{macro}{\theenumii}
% \begin{macro}{\theenumiii}
% \begin{macro}{\theenumiv}
-% The counters are already defined in \file{latex.dtx}, but their
+% The counters are already defined in the \LaTeX{} format, but their
% representation is changed here.
%
% \begin{macrocode}
@@ -2990,7 +2990,7 @@
%
% \begin{environment}{description}
% The description environment is defined here -- while the itemize
-% and enumerate environments are defined in \file{latex.dtx}.
+% and enumerate environments are defined in the \LaTeX{} format.
%
% \begin{macrocode}
\newenvironment{description}
@@ -3123,7 +3123,7 @@
% \subsubsection{Theorem}
%
% This document class does not define it's own theorem environments,
-% the defaults, supplied by \file{latex.dtx} are available.
+% the defaults, supplied by the \LaTeX{} format are available.
%
% \subsubsection{Titlepage}
%
@@ -3365,7 +3365,7 @@
%
% \subsection{Floating objects}
%
-% The file \file{latex.dtx} only defines a number of tools with
+% The \LaTeX{} format only defines a number of tools with
% which floating objects can be defined. This is done in the
% document class. It needs to define the following macros for each
% floating object of type \texttt{TYPE} (e.g., \texttt{TYPE} =
@@ -3402,7 +3402,7 @@
%
% The actual environment that implements a floating object such as
% a figure is defined using the macros |\@float| and |\end@float|,
-% which are defined in \file{latex.dtx}.
+% which are defined in the \LaTeX{} format.
%
% An environment that implements a single-column floating object is
% started with |\@float{|\texttt{TYPE}|}[|\meta{placement}|]| of type
@@ -4194,7 +4194,7 @@
%
% \begin{macro}{\@biblabel}
% The label for a |\bibitem[...]| command is produced by this
-% macro. The default from \file{latex.dtx} is used.
+% macro. The default from the \LaTeX{} format is used.
% \begin{macrocode}
% \renewcommand*{\@biblabel}[1]{[#1]\hfill}
% \end{macrocode}
@@ -4202,7 +4202,7 @@
%
% \begin{macro}{\@cite}
% The output of the |\cite| command is produced by this macro. The
-% default from \file{latex.dtx} is used.
+% default from the \LaTeX{} format is used.
% \begin{macrocode}
% \renewcommand*{\@cite}[1]{[#1]}
% \end{macrocode}
diff --git a/Master/texmf-dist/source/latex-dev/base/doc.dtx b/Master/texmf-dist/source/latex-dev/base/doc.dtx
index fb3412f21f4..41bc0733155 100644
--- a/Master/texmf-dist/source/latex-dev/base/doc.dtx
+++ b/Master/texmf-dist/source/latex-dev/base/doc.dtx
@@ -35,7 +35,7 @@
%<+package|shortvrb>\NeedsTeXFormat{LaTeX2e}[1994/12/01]
%<+package> \ProvidesPackage{doc}
%<+shortvrb>\ProvidesPackage{shortvrb}
-%<+package|shortvrb> [2021/05/28 v2.1n
+%<+package|shortvrb> [2021/10/04 v2.1n
%<+package|shortvrb> Standard LaTeX documentation package (FMi)]
%\catcode`\<=12
%
@@ -885,7 +885,7 @@
% We provide macros for logos such as \Web, \AmSTeX, \BibTeX,
% \SliTeX{} and \PlainTeX. Just type |\Web|, |\AmSTeX|,
% |\BibTeX|, |\SliTeX| or |\PlainTeX|, respectively.
-% \LaTeX{} and \TeX{} are already defined in \texttt{latex.tex}.
+% \LaTeX{} and \TeX{} are already defined in the \LaTeX{} format.
%
% \DescribeMacro\meta
% Another useful macro is |\meta| which has one argument and
@@ -938,7 +938,8 @@
% argument and produces a verbatim listing of the file, indexing every
% command as it goes along. This might be handy, if you want to learn
% something about macros without enough documentation. I used this
-% feature to cross-reference \texttt{latex.tex} getting a verbatim
+% feature to cross-reference \texttt{latex.tex} (these days
+% called \texttt{latex.ltx}) getting a verbatim
% copy with about 15 pages index.\footnote{It took quite a long time
% and the resulting \texttt{.idx} file was longer than the
% \texttt{.dvi} file. Actually too long to be handled by the
@@ -2031,7 +2032,7 @@
% \begin{macro}{\@verbatim}
% Additionally we redefine the |\@verbatim| macro so that it
% suppresses |%| characters at the beginning of the line. The
-% first lines are copied literally from \texttt{latex.tex}.
+% first lines are copied literally from the \LaTeX{} format.
% \changes{v1.7i}{1992/07/12}{Added \cs{@@par} to clear possible
% \cs{parshape}.}
% \begin{macrocode}
@@ -2055,7 +2056,7 @@
% \begin{macrocode}
\check@percent}%
% \end{macrocode}
-% The rest is again copied literally from \texttt{latex.tex} (less
+% The rest is again copied literally from the \LaTeX{} format (less
% "\tt").
% \changes{v1.7a}{1992/02/26}{Removed redundant \cs{tt}.}
% \changes{v1.8b}{1993/09/21}{Changed to conform to new LaTeX verbatim,
diff --git a/Master/texmf-dist/source/latex-dev/base/ltboxes.dtx b/Master/texmf-dist/source/latex-dev/base/ltboxes.dtx
index 8499d3ab8b9..92d9228a8af 100644
--- a/Master/texmf-dist/source/latex-dev/base/ltboxes.dtx
+++ b/Master/texmf-dist/source/latex-dev/base/ltboxes.dtx
@@ -33,7 +33,7 @@
%<*driver>
% \fi
\ProvidesFile{ltboxes.dtx}
- [2021/02/10 v1.4b LaTeX Kernel (Box Commands)]
+ [2021/10/14 v1.4c LaTeX Kernel (Box Commands)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltboxes.dtx}
@@ -1137,10 +1137,12 @@
% {Color groups restored here.}
% \changes{v1.4b}{2021/02/10}
% {Explicitly run \cs{par} in support for paragraph tagging}
+% \changes{v1.4c}{2021/10/14}
+% {Explicitly set \cs{@currentcounter} (gh/687)}
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
-%<latexrelease>\IncludeInRelease{2021/06/01}%
+%<latexrelease>\IncludeInRelease{2021/11/15}%
%<latexrelease> {\@mpfootnotetext}{footnotetext tagging}%
\long\def\@mpfootnotetext#1{%
\global\setbox\@mpfootins\vbox{%
@@ -1148,6 +1150,7 @@
\reset@font\footnotesize
\hsize\columnwidth
\@parboxrestore
+ \def\@currentcounter{mpfootnote}%
\protected@edef\@currentlabel
{\csname p@mpfootnote\endcsname\@thefnmark}%
\color@begingroup
@@ -1158,6 +1161,24 @@
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
% \end{macrocode}
+% \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2021/06/01}%
+%<latexrelease> {\@mpfootnotetext}{footnotetext tagging}%
+%<latexrelease>\long\def\@mpfootnotetext#1{%
+%<latexrelease> \global\setbox\@mpfootins\vbox{%
+%<latexrelease> \unvbox\@mpfootins
+%<latexrelease> \reset@font\footnotesize
+%<latexrelease> \hsize\columnwidth
+%<latexrelease> \@parboxrestore
+%<latexrelease> \protected@edef\@currentlabel
+%<latexrelease> {\csname p@mpfootnote\endcsname\@thefnmark}%
+%<latexrelease> \color@begingroup
+%<latexrelease> \@makefntext{%
+%<latexrelease> \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
+%<latexrelease> \par
+%<latexrelease> \color@endgroup}}
+%<latexrelease>\EndIncludeInRelease
+% \end{macrocode}
%
% \begin{macrocode}
%<latexrelease>\IncludeInRelease{0000/00/00}%
diff --git a/Master/texmf-dist/source/latex-dev/base/ltcmdhooks.dtx b/Master/texmf-dist/source/latex-dev/base/ltcmdhooks.dtx
index b6c57a41acc..208f7c3d22c 100644
--- a/Master/texmf-dist/source/latex-dev/base/ltcmdhooks.dtx
+++ b/Master/texmf-dist/source/latex-dev/base/ltcmdhooks.dtx
@@ -13,21 +13,14 @@
%
%%% From File: ltcmdhooks.dtx
%
-\def\ltcmdhooksversion{v1.0d}
-\def\ltcmdhooksdate{2021/08/25}
+\def\ltcmdhooksversion{v1.0f}
+\def\ltcmdhooksdate{2021/10/20}
%
%
%
%<*driver>
\documentclass{l3doc}
%\usepackage{ltcmdhooks}
-\makeatletter
-\providecommand\footref[1]{%
- \begingroup
- \unrestored@protected@xdef\@thefnmark{\ref{#1}}%
- \endgroup
- \@footnotemark}
-\makeatother
\EnableCrossrefs
\CodelineIndex
\begin{document}
@@ -360,19 +353,46 @@
% \end{macro}
%
% \begin{macro}{\l_@@_patch_prefixes_tl}
-% \begin{macro}{\l_@@_patch_param_text_tl}
-% \begin{macro}{\l_@@_patch_replacement_tl}
+% \begin{macro}{\l_@@_param_text_tl}
+% \begin{macro}{\l_@@_replace_text_tl}
% The prefixes and parameters of the definition for the macro being
% patched.
% \begin{macrocode}
\tl_new:N \l_@@_patch_prefixes_tl
-\tl_new:N \l_@@_patch_param_text_tl
-\tl_new:N \l_@@_patch_replacement_tl
+\tl_new:N \l_@@_param_text_tl
+\tl_new:N \l_@@_replace_text_tl
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
+% \begin{macro}{\c_@@_hash_tl}
+% A constant token list that contains two parameter tokens.
+% \begin{macrocode}
+\tl_const:Nn \c_@@_hash_tl { # # }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_exp_not:NN}
+% \begin{macro}{\@@_def_cmd:w}
+% Two temporary macros that change depending on the macro being
+% patched.
+% \begin{macrocode}
+\cs_new_eq:NN \@@_exp_not:NN ?
+\cs_new_eq:NN \@@_def_cmd:w ?
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\q_@@_recursion_tail,\q_@@_recursion_stop}
+% Internal quarks for recursion: they can't appear in any macro being
+% patched.
+% \begin{macrocode}
+\quark_new:N \q_@@_recursion_tail
+\quark_new:N \q_@@_recursion_stop
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\g_@@_delayed_patches_prop}
% A list containing the patches delayed to |\begin{document}|, so that
% patching is not attempted twice.
@@ -670,13 +690,71 @@
%
%
%
+%
% \begin{macro}{\@@_patch_expand_redefine:NNnn}
+% \begin{macro}{\@@_redefine_with_hooks:Nnnn}
% \begin{macro}[EXP]{\@@_make_prefixes:w}
% Now the real action begins. Here we have in |#1| a boolean
-% indicating if the command has a |[|\ldots|]|-delimited argument, in
-% |#2| the command control sequence, in |#3| the name of the command
-% (note that |#1|${}\ne{}$|\csname#2\endcsname| at this point!), and
-% in |#4| the hook position, either |before| or |after|.
+% indicating if the command has a leading |[|\ldots|]|-delimited
+% argument, in |#2| the command control sequence, in |#3| the name of
+% the command (note that |#1|${}\ne{}$|\csname#2\endcsname| at this
+% point!), and in |#4| the hook position, either |before| or |after|.
+%
+% \changes{v1.0f}{2021/10/20}
+% {Correct patching by expansion+redefinition when the macro
+% contains a parameter tokens (gh/697).}
+% Patching with expansion+redefinition is trickier than it looks like
+% at first glance. Suppose the simple definition:
+% \begin{verbatim}
+% \def\foo#1{#1##2}
+% \end{verbatim}
+% When defined, its \meta{replacement text} will be a token list
+% containing:
+% \begin{quote}
+% \itshape
+% out\_param |1|, mac\_param |#|, character |2|
+% \end{quote}
+%
+% Then, after expanding \cs{foo}|{##1}| (here |##| denotes a single
+% |#|$_6$) we end up with a token list with \textit{out\_param}~|1|
+% replaced:
+% \begin{quote}
+% \itshape
+% mac\_param |#|, character |1|, mac\_param |#|, character |2|
+% \end{quote}
+% that is, the definition would be:
+% \begin{verbatim}
+% \def\foo#1{#1#2}
+% \end{verbatim}
+% which obviously fails, because the original input in the definition
+% was |##| but \TeX{} reduced that to a single parameter token |#|$_6$
+% when carrying out the definition. That leaves no room for a clever
+% solution with (say) \cs{unexpanded}, because anything that would
+% double the second |#|$_6$, would also (incorrectly) double the
+% first, so there's not much to do other than a manual solution.
+%
+% There are three cases we can distinguish to make things hopefully
+% faster on simpler cases:
+% \begin{enumerate}
+% \item a macro with no parameters;
+% \item a macro with no parameter tokens in its definition;
+% \item a macro with parameters \emph{and} parameter tokens.
+% \end{enumerate}
+%
+% The first case is trivial: if the macro has no parameters, we can
+% just use \cs{unexpanded} around it, and if there is a parameter
+% token in it, it is handled correctly (the macro can be treated as a
+% |tl| variable).
+%
+% The second case requires looking at the \meta{replacement text} of
+% the macro to see if it has a parameter token in there. If it does
+% not, then there is no worry, and the macro can be redefined normally
+% (without \cs{unexpanded}).
+%
+% The third case, as usual, is the devious one. Here we'll have to
+% loop through the definition token by token, and double every
+% parameter token, so that this case can be handled like the previous
+% one.
% \begin{macrocode}
\cs_new_protected:Npn \@@_patch_expand_redefine:NNnn #1 #2 #3 #4
{
@@ -696,36 +774,93 @@
% \end{macrocode}
% Now build two token lists:
% \begin{description}
-% \item[\cs{l_@@_patch_param_text_tl}] will contain the
+% \item[\cs{l_@@_param_text_tl}] will contain the
% \meta{parameter text} to be used when redefining the macro. It
% should be identical to the \meta{parameter text} used when
% originally defining that macro.
-% \item[\cs{l_@@_patch_replacement_tl}] will contain braced pairs of
-% |#|$_{12}$\meta{num} to feed to the macro when expanded. This
-% token list as well as the previous will have the first item
+% \item[\cs{l_@@_replace_text_tl}] will contain braced pairs of
+% \cs{c_@@_hash_tl}\meta{num} to feed to the macro when expanded.
+% This token list as well as the previous will have the first item
% surrounded by |[|\ldots|]| in the case of an optional argument.
% \end{description}
+%
+% The use of \cs{c_@@_hash_tl} here is to differentiate actual
+% parameters in the macro from parameter tokens in the original
+% definition of the macro. Later on, \cs{c_@@_hash_tl} is either
+% replaced by actual parameter tokens, or expanded into them.
% \begin{macrocode}
\int_compare:nNnTF { \l_@@_patch_num_args_int } > { \c_zero_int }
{
- \tl_set:Nx \l_@@_patch_param_text_tl
- { \bool_if:NTF #1 { [####1] } { ####1 } }
- \tl_set:Nx \l_@@_patch_replacement_tl
- { \bool_if:NTF #1 { [####1] } { {####1} } }
+% \end{macrocode}
+% We'll first check if the command has any parameter token in its
+% definition (feeding it empty arguments), and set \cs{@@_exp_not:n}
+% accordingly. \cs{@@_exp_not:n} will be used later to either leave
+% \cs{c_@@_hash_tl} or expand it, and also to remember the result of
+% \cs{@@_if_has_hash:nTF} to avoid testing twice (the test can be
+% rather slow).
+% \begin{macrocode}
+ \tl_set:Nx \l_@@_tmpa_tl { \bool_if:NTF #1 { [ ] } { { } } }
+ \int_step_inline:nnn { 2 } { \l_@@_patch_num_args_int }
+ { \tl_put_right:Nn \l_@@_tmpa_tl { { } } }
+ \exp_args:NNo \exp_args:No \@@_if_has_hash:nTF
+ { \exp_after:wN #2 \l_@@_tmpa_tl }
+ { \cs_set_eq:NN \@@_exp_not:n \exp_not:n }
+ { \cs_set_eq:NN \@@_exp_not:n \use:n }
+ \cs_set_protected:Npn \@@_tmp:w ##1 ##2
+ {
+ ##1 \l_@@_param_text_tl { \use:n ##2 }
+ ##1 \l_@@_replace_text_tl { \@@_exp_not:n {##2} }
+ }
+% \end{macrocode}
+% Here we'll conditionally add |[|\ldots|]| around the first
+% parameter:
+% \begin{macrocode}
+ \bool_if:NTF #1
+ { \@@_tmp:w \tl_set:Nx { [ \c_@@_hash_tl 1 ] } }
+ { \@@_tmp:w \tl_set:Nx { { \c_@@_hash_tl 1 } } }
+% \end{macrocode}
+% Then, for every parameter from the second, just add it normally:
+% \begin{macrocode}
\int_step_inline:nnn { 2 } { \l_@@_patch_num_args_int }
+ { \@@_tmp:w \tl_put_right:Nx { { \c_@@_hash_tl ##1 } } }
+% \end{macrocode}
+% Now, if the command has any parameter token in its definition
+% (then \cs{@@_exp_not:n} is \cs{exp_not:n}), call
+% \cs{@@_double_hashes:n} to double them, and replace every
+% \cs{c_@@_hash_tl} by |#|:
+% \begin{macrocode}
+ \tl_set:Nx \l_@@_replace_text_tl
+ { \exp_not:N #2 \exp_not:V \l_@@_replace_text_tl }
+ \tl_set:Nx \l_@@_replace_text_tl
{
- \tl_put_right:Nn \l_@@_patch_param_text_tl { ## ####1 }
- \tl_put_right:Nn \l_@@_patch_replacement_tl { { ## ####1 } }
+ \token_if_eq_meaning:NNTF \@@_exp_not:n \exp_not:n
+ { \exp_args:NNV \exp_args:No \@@_double_hashes:n }
+ { \exp_args:NV \exp_not:o }
+ \l_@@_replace_text_tl
}
+% \end{macrocode}
+% And now, set a few auxiliaries for the case that the macro has
+% parameters, so it won't be passed through \cs{unexpanded} (twice):
+% \begin{macrocode}
+ \cs_set_eq:NN \@@_def_cmd:w \tex_gdef:D
+ \cs_set_eq:NN \@@_exp_not:NN \prg_do_nothing:
}
{
- \tl_clear:N \l_@@_patch_param_text_tl
- \tl_clear:N \l_@@_patch_replacement_tl
+% \end{macrocode}
+% In the case the macro has no parameters, we'll treat it as a token
+% list and things are much simpler (expansion control looks a bit
+% complicated, but it's just a pair of \cs{exp_not:N} preventing
+% another \cs{exp_not:n} from expanding):
+% \begin{macrocode}
+ \tl_clear:N \l_@@_param_text_tl
+ \tl_set_eq:NN \l_@@_replace_text_tl #2
+ \cs_set_eq:NN \@@_def_cmd:w \tex_xdef:D
+ \cs_set:Npn \@@_exp_not:NN ##1 { \exp_not:N ##1 \exp_not:N }
}
% \end{macrocode}
-% Finally, before redefining, we need to also get the prefixes used
-% when defining the command. Here we ensure that the \tn{escapechar}
-% is printable, otherwise a macro defined with prefixes
+% Before redefining, we need to also get the prefixes used when
+% defining the command. Here we ensure that the \tn{escapechar} is
+% printable, otherwise a macro defined with prefixes
% |\protected \long| will have it \tn{meaning} printed as
% |protectedlong|, making life unnecessarily complicated. Here the
% \tn{escapechar} is changed to |/|, then we loop between pairs of
@@ -740,34 +875,47 @@
{ \exp_not:N \@@_make_prefixes:w \cs_prefix_spec:N #2 / / }
}
% \end{macrocode}
-% Now that all the needed tools are ready, without further ado we'll
-% redefine the command |#2|. The definition uses the prefixes
-% gathered in \cs{l_@@_patch_prefixes_tl}, a primitive \cs{tex_def:D}
-% to avoid adding extra prefixes, and the \meta{parameter text} from
-% \cs{l_@@_patch_param_text_tl}.
-%
-% Then finally, in the body of the definition, we insert
-% \hook{cmd/\#3/before} if |#4| is |before|, the code of the
-% command expanded once grabbing the parameters in
-% \cs{l_@@_patch_replacement_tl}, and \hook{cmd/\#3/after} if |#4| is
-% |after|.
+% Finally, call \cs{@@_redefine_with_hooks:Nnnn} with the macro being
+% redefined in |#1|, then \cs{UseHook}|{cmd/<name>/before}| in |#2| or
+% \cs{UseHook}|{cmd/<name>/after}| in |#3| (one is always empty), and
+% in |#4| the \meta{replacement text} of the macro.
% \begin{macrocode}
\use:x
{
- \l_@@_patch_prefixes_tl \tex_def:D
- \exp_not:N #2 \exp_not:V \l_@@_patch_param_text_tl
- {
- \str_if_eq:nnT {#4} { before }
- { \exp_not:N \UseHook { cmd / #3 / #4 } }
- \exp_args:No \exp_not:o
- { \exp_after:wN #2 \l_@@_patch_replacement_tl }
- \str_if_eq:nnT {#4} { after }
- { \exp_not:N \UseHook { cmd / #3 / #4 } }
- }
+ \@@_redefine_with_hooks:Nnnn \exp_not:N #2
+ \str_if_eq:nnTF {#4} { after }
+ { \use_ii_i:nn }
+ { \use:nn }
+ { { \@@_exp_not:NN \exp_not:N \UseHook { cmd / #3 / #4 } } }
+ { { } }
+ { \@@_exp_not:NN \exp_not:V \l_@@_replace_text_tl }
}
}
% \end{macrocode}
%
+% Now that all the needed tools are ready, without further ado we'll
+% redefine the command. The definition uses the prefixes gathered in
+% \cs{l_@@_patch_prefixes_tl}, a primitive \cs{@@_def_cmd:w} (which is
+% \cs{tex_gdef:D} or \cs{tex_xdef:D}) to avoid adding extra prefixes,
+% and the \meta{parameter text} from \cs{l_@@_param_text_tl}.
+%
+% Then finally, in the body of the definition, we insert |#2|, which
+% is \hook{cmd/\#1/before} or empty, |#4| which is the
+% \meta{replacement text}, and |#3| which is \hook{cmd/\#1/after} or
+% empty.
+%
+% \changes{v1.0e}{2021/09/28}
+% {Make patching of commands a global operation (gh/674)}
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_redefine_with_hooks:Nnnn #1 #2 #3 #4
+ {
+ \l_@@_patch_prefixes_tl
+ \exp_after:wN \@@_def_cmd:w
+ \exp_after:wN #1 \l_@@_param_text_tl
+ { #2 #4 #3 }
+ }
+% \end{macrocode}
+%
% Here's the auxiliary that makes the prefix control sequences for the
% redefinition. Each item has to be \cs{tl_trim_spaces:n}'d because
% the last item (and not any other) has a trailing space.
@@ -783,11 +931,125 @@
% \end{macrocode}
% \end{macro}
% \end{macro}
+% \end{macro}
%
%
+% Here are some auxiliaries for the contraption above.
%
+% \begin{macro}[pTF]{\@@_if_has_hash:n}
+% \begin{macro}{\@@_if_has_hash:w,\@@_if_has_hash_check:w}
+% \cs{@@_if_has_hash:nTF} searches the token list |#1| for a catcode~6
+% token, and if any is found, it returns |true|, and |false|
+% otherwise. The searching doesn't care about preserving groups or
+% spaces: we can ignore those safely (braces are removed) so that
+% searching is as fast as possible.
+% \begin{macrocode}
+\prg_new_conditional:Npnn \@@_if_has_hash:n #1 { TF }
+ { \@@_if_has_hash:w #1 ## \s_@@_mark }
+\cs_new:Npn \@@_if_has_hash:w #1
+ {
+ \tl_if_single_token:nTF {#1}
+ {
+ \token_if_eq_catcode:NNTF ## #1
+ { \@@_if_has_hash_check:w }
+ { \@@_if_has_hash:w }
+ }
+ { \@@_if_has_hash:w #1 }
+ }
+\cs_new:Npn \@@_if_has_hash_check:w #1 \s_@@_mark
+ { \tl_if_empty:nTF {#1} { \prg_return_false: } { \prg_return_true: } }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
%
%
+% \begin{macro}[rEXP]{\@@_double_hashes:n}
+% \begin{macro}[rEXP]{
+% \@@_double_hashes:w,
+% \@@_double_hashes_output:N,
+% \@@_double_hashes_stop:w,
+% \@@_double_hashes_group:n,
+% \@@_double_hashes_space:w,
+% }
+% \cs{@@_double_hashes:n} loops through the token list |#1| and
+% duplicates any catcode~6 token, and expands tokens \cs{ifx}-equal to
+% \cs{c_@@_hash_tl}, and leaves all other tokens \cs{notexpanded} with
+% \cs{exp_not:N}. Unfortunately pairs of explicit catcode~1 and
+% catcode~2 character tokens are normalised to |{|$_1$ and |}|$_1$
+% because it's not feasible to expandably detect the character code
+% (\emph{maybe} it could be done using something along the lines of
+% \url{https://tex.stackexchange.com/a/527538}, but it's far too much
+% work for close to zero benefit).
+%
+% \cs{@@_double_hashes:w} is the tail-recursive loop macro, that tests
+% which of the three types of item is in the head of the token list.
+% \begin{macrocode}
+\cs_new:Npn \@@_double_hashes:n #1
+ { \@@_double_hashes:w #1 \q_@@_recursion_tail \q_@@_recursion_stop }
+\cs_new:Npn \@@_double_hashes:w #1 \q_@@_recursion_stop
+ {
+ \tl_if_head_is_N_type:nTF {#1}
+ { \@@_double_hashes_output:N }
+ {
+ \tl_if_head_is_group:nTF {#1}
+ { \@@_double_hashes_group:n }
+ { \@@_double_hashes_space:w }
+ }
+ #1 \q_@@_recursion_stop
+ }
+% \end{macrocode}
+%
+% \cs{@@_double_hashes_output:N} checks for the end of the token list,
+% then checks if the token is \cs{c_@@_hash_tl}, and if so just leaves
+% it.
+% \begin{macrocode}
+\cs_new:Npn \@@_double_hashes_output:N #1
+ {
+ \if_meaning:w \q_@@_recursion_tail #1
+ \@@_double_hashes_stop:w
+ \fi:
+ \if_meaning:w \c_@@_hash_tl #1
+% \end{macrocode}
+% (this \cs{use_i:nnnn} uses \cs{fi:} and consumes \cs{use:n}, the
+% whole \cs{if_catcode:w} block, and the \cs{exp_not:N}, leaving just
+% |#1| which is \cs{c_@@_hash_tl}.)
+% \begin{macrocode}
+ \use_i:nnnn
+ \fi:
+ \use:n
+ {
+% \end{macrocode}
+% If |#1| is not \cs{c_@@_hash_tl}, then check if its catcode is~6,
+% and if so, leave it doubled in \cs{exp_not:n} and consume the
+% following |\exp_not:N #1|.
+% \begin{macrocode}
+ \if_catcode:w ## \exp_not:N #1
+ \exp_after:wN \use_ii:nnnn
+ \fi:
+ \use_none:n
+ { \exp_not:n { #1 #1 } }
+ }
+% \end{macrocode}
+% If both previous tests returned |false|, then leave the token
+% unexpanded and resume the loop.
+% \begin{macrocode}
+ \exp_not:N #1
+ \@@_double_hashes:w
+ }
+\cs_new:Npn \@@_double_hashes_stop:w #1 \q_@@_recursion_stop { \fi: }
+% \end{macrocode}
+%
+% Dealing with spaces and grouped tokens is trivial:
+% \begin{macrocode}
+\cs_new:Npn \@@_double_hashes_group:n #1
+ { { \@@_double_hashes:n {#1} } \@@_double_hashes:w }
+\exp_last_unbraced:NNo
+\cs_new:Npn \@@_double_hashes_space:w \c_space_tl
+ { ~ \@@_double_hashes:w }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
%
% \subsubsection{Patching by retokenization}
%
@@ -1061,8 +1323,11 @@
% \end{macrocode}
% And to close, copy the newly-defined command into the old name and
% the patching is finally completed:
+%
+% \changes{v1.0e}{2021/09/28}
+% {Make patching of commands a global operation (gh/674)}
% \begin{macrocode}
- \cs_set_eq:NN #1 \kerneltmpDoNotUse
+ \cs_gset_eq:NN #1 \kerneltmpDoNotUse
}
% \end{macrocode}
% \end{macro}
diff --git a/Master/texmf-dist/source/latex-dev/base/ltfiles.dtx b/Master/texmf-dist/source/latex-dev/base/ltfiles.dtx
index 4dee83c4d6e..4c24716df65 100644
--- a/Master/texmf-dist/source/latex-dev/base/ltfiles.dtx
+++ b/Master/texmf-dist/source/latex-dev/base/ltfiles.dtx
@@ -32,7 +32,7 @@
%<*driver>
% \fi
\ProvidesFile{ltfiles.dtx}
- [2021/08/25 v1.2o LaTeX Kernel (File Handling)]
+ [2021/10/14 v1.2p LaTeX Kernel (File Handling)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltfiles.dtx}
@@ -823,8 +823,16 @@
%
% \changes{v1.2j}{2020/10/04}{Quotes around the aux file name removed,
% they are not needed and upset BibTeX (gh/400)}
+% \changes{v1.2p}{2021/10/14}{Warn about use in preamble}
% \begin{macrocode}
\def\@include#1 {%
+% \end{macrocode}
+%
+% \begin{macrocode}
+\ifx\@nodocument\relax
+% \end{macrocode}
+%
+% \begin{macrocode}
\clearpage
\if@filesw
\immediate\write\@mainaux{\string\@input{#1.aux}}%
@@ -892,7 +900,15 @@
\deadcycles\z@
\@nameuse{cp@#1}%
\fi
- \let\@auxout\@mainaux}
+ \let\@auxout\@mainaux
+% \end{macrocode}
+%
+% \begin{macrocode}
+\else
+\@latex@warning{%
+ \noexpand\include should only be used after \string\begin{document}}%
+\@input@{#1}%
+\fi}
% \end{macrocode}
%
% \changes{v1.2o}{2021/08/25}{Declare non-generic include hooks}
diff --git a/Master/texmf-dist/source/latex-dev/base/ltfinal.dtx b/Master/texmf-dist/source/latex-dev/base/ltfinal.dtx
index 5d77fb2e834..40017a205a4 100644
--- a/Master/texmf-dist/source/latex-dev/base/ltfinal.dtx
+++ b/Master/texmf-dist/source/latex-dev/base/ltfinal.dtx
@@ -1246,32 +1246,33 @@
% \end{macro}
% \end{macro}
%
-% \subsection{Prepare for supporting PDF management in backends}
+% \subsection{Preparation for supporting PDF in backends}
%
-% At the current point in time support for PDF management in
-% backends is not part of \LaTeX{} core but provided by external
+% At the current point in time, basic support for PDF in
+% backends is not part of \LaTeX{} core; it is provided by external
% packages. At some time in the future that work will be placed
% into the kernel but for now it is separate and has to be
% explicitly loaded in the document.
%
-% There is a command \cs{IfPDFManagementActiveTF} in that code
-% which checks if the PDF management code is activated, which can
-% be used by packages to execute different code branches depending
-% on the state.
+% In that code there is a command \cs{IfPDFManagementActiveTF}
+% which can be used by packages in order to execute different
+% code depending on the whether this basic backend support is loaded.
%
-% To make this also work properly if the external package is not
-% loaded at all this command is already made available in the
-% kernel (with a trivial definition) so that other packages can
-% query the state in all circumstances. Once the PDF management
-% support moves to the kernel this definition here will vanish
-% again or rather will be replaced by a real test.
+% To make this also work properly when this external package is not
+% loaded at all, we here add this command already in the
+% kernel (with a trivial definition); thus any package can
+% query this loading state in all circumstances.
+% Once this basic PDF backend
+% support gets moved to the kernel, this definition will vanish
+% again from here or, rather, it will be replaced by a real test.
%
-%
% \begin{macro}{\IfPDFManagementActiveTF}
-% While the PDF management code is not loaded, the test will
-% always return the false branch. Once this code is loaded, it
-% is replaced by a real test (as then it is possible that the
-% management code is activate or not activated).
+% So long as the code for the basic backend support for PDF is not
+% loaded, the test that is implicit here will
+% always return the false branch.
+% Once this code is loaded, this definition will get
+% replaced by a real test (as it is then possible that the
+% management code is either activated or not activated).
% \changes{v2.2p}{2021/08/08}{Default definition added (gh/640)}
% \begin{macrocode}
\let \IfPDFManagementActiveTF \@secondoftwo
diff --git a/Master/texmf-dist/source/latex-dev/base/ltfloat.dtx b/Master/texmf-dist/source/latex-dev/base/ltfloat.dtx
index ed25db3ed10..ac3b6418171 100644
--- a/Master/texmf-dist/source/latex-dev/base/ltfloat.dtx
+++ b/Master/texmf-dist/source/latex-dev/base/ltfloat.dtx
@@ -31,7 +31,7 @@
%
%<*driver>
% \fi
-\ProvidesFile{ltfloat.dtx}[2021/03/03 v1.2f LaTeX Kernel (Floats)]
+\ProvidesFile{ltfloat.dtx}[2021/10/14 v1.2g LaTeX Kernel (Floats)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltfloat.dtx}
@@ -1510,10 +1510,12 @@
% {Missing percent, again}
% \changes{v1.2e}{2021/02/10}{Explicitly run \cs{par} at the end of footnote text
% in preparation for paragraph hooks}
+% \changes{v1.2g}{2021/10/14}
+% {Explicitly set \cs{@currentcounter} (gh/687)}
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
-%<latexrelease>\IncludeInRelease{2021/06/01}%
+%<latexrelease>\IncludeInRelease{2021/11/15}%
%<latexrelease> {\@footnotetext}{footnotetext tagging}%
\long\def\@footnotetext#1{\insert\footins{%
\reset@font\footnotesize
@@ -1521,6 +1523,7 @@
\splittopskip\footnotesep
\splitmaxdepth \dp\strutbox \floatingpenalty \@MM
\hsize\columnwidth \@parboxrestore
+ \def\@currentcounter{footnote}%
\protected@edef\@currentlabel{%
\csname p@footnote\endcsname\@thefnmark
}%
@@ -1534,6 +1537,26 @@
% \end{macrocode}
%
% \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2021/06/01}%
+%<latexrelease> {\@footnotetext}{footnotetext tagging}%
+%<latexrelease>\long\def\@footnotetext#1{\insert\footins{%
+%<latexrelease> \reset@font\footnotesize
+%<latexrelease> \interlinepenalty\interfootnotelinepenalty
+%<latexrelease> \splittopskip\footnotesep
+%<latexrelease> \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
+%<latexrelease> \hsize\columnwidth \@parboxrestore
+%<latexrelease> \protected@edef\@currentlabel{%
+%<latexrelease> \csname p@footnote\endcsname\@thefnmark
+%<latexrelease> }%
+%<latexrelease> \color@begingroup
+%<latexrelease> \@makefntext{%
+%<latexrelease> \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
+%<latexrelease> \par
+%<latexrelease> \color@endgroup}}%
+%<latexrelease>\EndIncludeInRelease
+% \end{macrocode}
+%
+% \begin{macrocode}
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease> {\@footnotetext}{footnotetext tagging}%
%<latexrelease>
diff --git a/Master/texmf-dist/source/latex-dev/base/ltfssdcl.dtx b/Master/texmf-dist/source/latex-dev/base/ltfssdcl.dtx
index 9710d543829..4f2cabd613b 100644
--- a/Master/texmf-dist/source/latex-dev/base/ltfssdcl.dtx
+++ b/Master/texmf-dist/source/latex-dev/base/ltfssdcl.dtx
@@ -36,7 +36,7 @@
%
%
\ProvidesFile{ltfssdcl.dtx}
- [2021/02/15 v3.0w LaTeX Kernel (NFSS Declarative Interface)]
+ [2021/10/15 v3.0y LaTeX Kernel (NFSS Declarative Interface)]
% \iffalse
\documentclass{ltxdoc}
\begin{document}
@@ -454,25 +454,88 @@
% \end{macrocode}
% \end{macro}
%
+%
+%
+%
+% \begin{macro}{\c@localalphabets}
+% \changes{v3.0x}{2021/09/26}{Counter added for (gh/676)}
+% To avoid hitting the ``no more math fams available'' limit of 16, we
+% keep a defined number of math alphabets flexible/local. If we have to
+% allocate any of those we roll back the allocation after the
+% formula has ended, so the next formula can use other alphabets in
+% the slot(s). This makes the processing a bit slower if you are
+% working at the limit, but that is better than dying with ``out of memory''.
+% \begin{macrocode}
+%</2ekernel>
+%<latexrelease>\IncludeInRelease{2021/11/15}
+%<latexrelease> {\document@select@group}{\document@select@group}%
+%<*2ekernel|latexrelease>
+% \end{macrocode}
+% We don't really undo the declaration on rollback (as that would
+% be hard to maintain), so rolling
+% forward needs to check if the declaration was already made.
+% \begin{macrocode}
+\ifx\c@localmathalphabets\@undefined
+% \end{macrocode}
+% There is no need to have this counter as part of the include
+% checkpoints, given that it makes little sense to alter its
+% settings mid document. All we want is the ability to change it
+% using the \cs{setcounter} interface.
+%
+% By default we keep two math fams flexible.
+% \begin{macrocode}
+ \newcount\c@localmathalphabets
+ \setcounter{localmathalphabets}{2}
+\fi
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
+%
% \begin{macro}{\document@select@group}
-% We surround |\select@group| with braces so that functions using it
-% can be used directly after |_| or |^|.
-% \changes{v2.1p}{1994/12/10}{Surround with braces (add fourth arg)}
-% \changes{v2.1q}{1995/04/02}{fix problem for pr/1275}
+% The \cs{document@select@group} command is the version of
+% \cs{select@group} (inside math versions) that is used in the
+% document body to set up math alphabets (if used).
+%
% \changes{v3.0g}{1997/11/20}
% {(DPC) inline use of \cs{stepcounter} (faster, and saves a csname
% per math version as no reset list)}
% \changes{v3.0q}{2015/03/18}{Introduce \cs{e@mathgroup@top}}
% \begin{macrocode}
-%</2ekernel>
-%<latexrelease>\IncludeInRelease{2020/10/01}
-%<latexrelease> {\document@select@group}{\document@select@group}%
-%<*2ekernel|latexrelease>
\def\document@select@group#1#2#3#4{%
\ifx\math@bgroup\bgroup\else\relax\expandafter\@firstofone\fi
{%
\ifmmode
+% \end{macrocode}
+% We first check if there is still room for allocating another
+% mathgroup. If there is, we check if it can be globally allocated
+% or if we have reached the limit which is given by
+% \cs{e@mathgroup@top} with \cs{c@localmathalphabets} subtracted.
+%
+% \changes{v3.0x}{2021/09/26}{Test if we should freeze the version (gh/676)}
+% \begin{macrocode}
\ifnum\csname c@mv@\math@version\endcsname<\e@mathgroup@top
+ \ifnum \numexpr\e@mathgroup@top-\c@localmathalphabets
+ >\csname c@mv@\math@version\endcsname
+ \else
+% \end{macrocode}
+% If we are past this point we freeze the current state of the math
+% version so that we can return to it after the formula has
+% ended. Of course, that should be done only once, so we check if
+% \cs{mv@\meta{version}@frozen} already exists.
+% \begin{macrocode}
+ \ifcsname mv@\math@version @frozen\endcsname \else
+% \end{macrocode}
+% We have to pass the current value of \cs{math@version} not the
+% macro itself, because some of the processing is delayed to a
+% point where the value may have changed again---not doing this
+% caused a puzzling error in one setup.
+% \begin{macrocode}
+ \expandafter\freeze@math@version\expandafter{\math@version}%
+ \fi
+ \fi
\begingroup
\escapechar\m@ne
\getanddefine@fonts{\csname c@mv@\math@version\endcsname}#3%
@@ -486,16 +549,21 @@
\global\advance\csname c@mv@\math@version\endcsname\@ne
\else
\let#1\relax
- \@latex@error{Too many math alphabets used
- in version \math@version}%
+ \@latex@error{Too many math alphabets used in
+ version \math@version}%
\@eha
\fi
% \end{macrocode}
-% extra \cs{expandafter} to remove the \cs{expandafter} added below
-% \changes{v3.0w}{2021/02/115}{fix for (gh/501)}
+% Extra \cs{expandafter} to remove the \cs{expandafter} added below
+% \changes{v3.0w}{2021/02/15}{fix for (gh/501)}
% \begin{macrocode}
\else \expandafter\expandafter\expandafter\non@alpherr\fi
% \end{macrocode}
+% We surround |\select@group| with braces so that functions using it
+% can be used directly after |_| or |^|.
+% \changes{v2.1p}{1994/12/10}{Surround with braces (add fourth arg)}
+% \changes{v2.1q}{1995/04/02}{fix problem for pr/1275}
+%
% If the legacy interface is used, e.g., \verb=$\sf -1$= the math
% alphabet \verb=#1= does not take an argument so we better do not
% surround \verb=#4= with braces, because then we get
@@ -507,8 +575,142 @@
\expandafter#1\ifx\math@bgroup\bgroup{#4}\else#4\fi
}%
}
+% \end{macrocode}
+%
+%
+%
+% \begin{macro}{\freeze@math@version}
+% \changes{v3.0x}{2021/09/26}{Macro added for (gh/676)}
+% This command stores the current state of the math version and sets
+% things up to return to it after each formula from now on. We use
+% L3 programming layer code to set it up.
+% \begin{macrocode}
+\ExplSyntaxOn
+\cs_new_protected:Npn\freeze@math@version #1 {
+% \end{macrocode}
+% Save the current \cs{mv@\meta{version}} code and the number of
+% allocated mathgroups inside.
+% \begin{macrocode}
+ \@font@info{Freeze~ math~ alphabet~ allocation~ in~ version~
+ #1.\MessageBreak
+ Allocated~math~groups:~\int_use:c{ c@mv@ #1 }~
+ (local:~ \int_use:N\c@localmathalphabets) }
+ \cs_gset_eq:cc { mv@#1@frozen }{ mv@#1 }
+ \tl_gset:cx { g__nfss_frozen_mv_ #1 _tl }{ \int_use:c { c@mv@#1 } }
+% \end{macrocode}
+% Doing the reset the first time, we wait until we are out of
+% math mode, so we use some recursive \cs{group_insert_after:N} for this
+% before we execute \cs{mv@\meta{version}@reset}.
+% \begin{macrocode}
+ \group_insert_after:N \__nfss_init_mv_freeze:N \exp_after:wN
+ \group_insert_after:N \cs:w mv@#1@reset \cs_end:
+% \end{macrocode}
+% The \cs{check@mathfonts} is called at the very beginning of each
+% math formula, so it is a good way to hook in the resetting.
+% Again that has to happen after the formula has ended, but we know
+% because of the place where \cs{check@mathfonts} is used
+% that a single \cs{aftergoup} is sufficient.
+% \begin{macrocode}
+ \tl_gput_right:No \check@mathfonts
+ {
+ \exp_after:wN \group_insert_after:N \cs:w mv@#1@reset \cs_end:
+ }
+% \end{macrocode}
+% Here is the definition of \cs{mv@\meta{version}@reset}. If there
+% has been no new math alphabet allocation, doing a reset would
+% just cause a lot of unnecessary processing, so we do a quick
+% check upfront for this.
+% \begin{macrocode}
+ \cs_gset:cpn{mv@#1@reset}
+ {
+ \int_compare:nNnTF { \int_use:c{c@mv@#1} } >
+ { \tl_use:c{g__nfss_frozen_mv_ #1 _tl} }
+ {
+ \@font@info{Undo~ math~ alphabet~ allocation~ in~ version~ #1}
+% \end{macrocode}
+% If the undo is necessary, we restore the \cs{mv@\meta{version}} code.
+% \begin{macrocode}
+ \cs_gset_eq:cc { mv@#1 }{ mv@#1@frozen }
+ \int_gset:cn { c@mv@#1 }{ \tl_use:c {g__nfss_frozen_mv_ #1 _tl} }
+% \end{macrocode}
+% But we also should undo changes to the math alphabet
+% definitions. We therefore run this code with a modified
+% definition for \cs{getanddefine@fonts} because there is no need
+% to do anything to the symbol fonts that are permanently allocated.
+% \begin{macrocode}
+ \group_begin:
+ \cs_set_eq:NN \getanddefine@fonts \use_none:nn
+ \use:c {mv@#1}
+ \group_end:
+ }
+ {
+% \end{macrocode}
+% If there was no change, we report that in the log (but this
+% branch could go completely).
+% \begin{macrocode}
+ \@font@info{No~ math~ alphabet~ change~ to~ frozen~ version~ #1}
+ }
+ }
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\__nfss_init_mv_freeze:N}
+% \changes{v3.0x}{2021/09/26}{Macro added for (gh/676)}
+% To do the initial freeze in a safe place, we check if we are in
+% math mode and if so try again after the group has ended by pushing
+% the command and its single token argument with two
+% \cs{group_insert_after:N}s after the current group. If we are no longer in
+% math mode we bypass the
+% conditional and so the next token is our argument
+% which is then finally executed.
+% \begin{macrocode}
+\cs_new_protected:Npn \__nfss_init_mv_freeze:N #1 {%
+ \mode_if_math:T { \group_insert_after:N \__nfss_init_mv_freeze:N
+ \group_insert_after:N } #1
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macrocode}
+\ExplSyntaxOff
+% \end{macrocode}
+%
+% \begin{macrocode}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2020/10/01}
+%<latexrelease> {\document@select@group}{\document@select@group}%
+%<latexrelease>
+%<latexrelease>\def\document@select@group#1#2#3#4{%
+%<latexrelease> \ifx\math@bgroup\bgroup\else\relax\expandafter\@firstofone\fi
+%<latexrelease> {%
+%<latexrelease> \ifmmode
+%<latexrelease> \ifnum\csname c@mv@\math@version\endcsname<\e@mathgroup@top
+%<latexrelease> \begingroup
+%<latexrelease> \escapechar\m@ne
+%<latexrelease> \getanddefine@fonts{\csname c@mv@\math@version\endcsname}#3%
+%<latexrelease> \globaldefs\@ne \math@fonts
+%<latexrelease> \endgroup
+%<latexrelease> \expandafter\extract@alph@from@version
+%<latexrelease> \csname mv@\math@version\expandafter\endcsname
+%<latexrelease> \expandafter{\number\csname
+%<latexrelease> c@mv@\math@version\endcsname}%
+%<latexrelease> #1%
+%<latexrelease> \global\advance\csname c@mv@\math@version\endcsname\@ne
+%<latexrelease> \else
+%<latexrelease> \let#1\relax
+%<latexrelease> \@latex@error{Too many math alphabets used
+%<latexrelease> in version \math@version}%
+%<latexrelease> \@eha
+%<latexrelease> \fi
+%<latexrelease> \else \expandafter\expandafter\expandafter\non@alpherr\fi
+%<latexrelease> \expandafter#1\ifx\math@bgroup\bgroup{#4}\else#4\fi
+%<latexrelease> }%
+%<latexrelease>}
+%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{2015/01/01}
%<latexrelease> {\document@select@group}{\document@select@group}%
%<latexrelease>
@@ -653,9 +855,36 @@
%
% \begin{macro}{\DeclareMathVersion}
% \begin{macrocode}
+%</2ekernel>
+%<*2ekernel|latexrelease>
+%<latexrelease>\IncludeInRelease{2021/11/15}%
+%<latexrelease> {\DeclareMathVersion}{local alphabets}%
\def\DeclareMathVersion#1{%
+% \end{macrocode}
+% When declaring a new math version we need to instantiate an L3
+% variable that is used when we freeze the version, because too many
+% alphabets got allocated. If we don't do this, L3 programming layer
+% complains if it is run in checking mode.
+% \changes{v3.0y}{2021/10/15}{Initialize variable for freezing
+% math version (gh/676)}
+% \begin{macrocode}
+ \@namedef{g__nfss_frozen_mv_#1_tl}{}%
+% \end{macrocode}
+%
+% \begin{macrocode}
\expandafter\new@mathversion\csname mv@#1\endcsname}
\@onlypreamble\DeclareMathVersion
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<latexrelease>\IncludeInRelease{0000/00/00}%
+%<latexrelease> {\DeclareMathVersion}{local alphabets}%
+%<latexrelease>\def\DeclareMathVersion#1{%
+%<latexrelease> \expandafter\new@mathversion\csname mv@#1\endcsname}
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
% \end{macrocode}
% \end{macro}
%
diff --git a/Master/texmf-dist/source/latex-dev/base/lthooks.dtx b/Master/texmf-dist/source/latex-dev/base/lthooks.dtx
index 3969a2be567..5b3d80e9844 100644
--- a/Master/texmf-dist/source/latex-dev/base/lthooks.dtx
+++ b/Master/texmf-dist/source/latex-dev/base/lthooks.dtx
@@ -31,8 +31,8 @@
%%% From File: lthooks.dtx
%
% \begin{macrocode}
-\def\lthooksversion{v1.0r}
-\def\lthooksdate{2021/09/06}
+\def\lthooksversion{v1.0s}
+\def\lthooksdate{2021/09/28}
% \end{macrocode}
%
%<*driver>
@@ -959,13 +959,14 @@
% \begin{syntax}
% \cs{hook_activate_generic:n} \Arg{hook}
% \end{syntax}
-% Like \cs{hook_new:n} but does nothing if the hook was previously
-% declared with \cs{hook_new:n}. This declaration should only be used
-% in special situations, e.g., when a command of another package
-% needs to be altered and it is not clear if for that command a
-% generic \hook{cmd} hook was already explicitly declared before.
-%
-% Normally \cs{hook_new:n} should be used instead.
+% This is like \cs{hook_new:n} but it does nothing if the hook was previously
+% declared with \cs{hook_new:n}. This declaration should be used
+% only in special situations, e.g., when a command from another package
+% needs to be altered and it is not clear whether a
+% generic \hook{cmd} hook (for that command) has been previously
+% explicitly declared.
+%
+% Normally \cs{hook_new:n} should be used instead of this.
% \end{function}
%
%
@@ -3138,10 +3139,13 @@
% component to see if we have to make a reversed hook. In either case
% the function returns \meta{true} for a generic hook and \meta{false}
% in other cases.
+%
+% \changes{v1.0s}{2021/09/28}
+% {Correct usage of older \cs{@@_if_file_hook:wTF} (gh/675)}
% \begin{macrocode}
%<latexrelease>\cs_new_protected:Npn \@@_try_declaring_generic_hook:nNNnn #1
%<latexrelease> {
-%<latexrelease> \@@_if_file_hook:wTF #1 / \s_@@_mark {#1}
+%<latexrelease> \@@_if_file_hook:wTF #1 / \s_@@_mark
%<latexrelease> {
%<latexrelease> \exp_args:Ne \@@_try_declaring_generic_hook_split:nNNnn
%<latexrelease> { \exp_args:Ne \@@_file_hook_normalize:n {#1} }
@@ -4777,10 +4781,12 @@
%<latexrelease> }
% \end{macrocode}
%
+% \changes{v1.0s}{2021/09/28}
+% {Correct usage of older \cs{@@_if_file_hook:wTF} (gh/675)}
% \begin{macrocode}
%<latexrelease>\cs_new_protected:Npn \@@_try_file_hook:n #1
%<latexrelease> {
-%<latexrelease> \@@_if_file_hook:wTF #1 / \s_@@_mark {#1}
+%<latexrelease> \@@_if_file_hook:wTF #1 / \s_@@_mark
%<latexrelease> {
%<latexrelease> \exp_args:Ne \@@_if_usable_use:n
%<latexrelease> { \exp_args:Ne \@@_file_hook_normalize:n {#1} }
diff --git a/Master/texmf-dist/source/latex-dev/base/ltluatex.dtx b/Master/texmf-dist/source/latex-dev/base/ltluatex.dtx
index 2508f5a7cc2..258ac482977 100644
--- a/Master/texmf-dist/source/latex-dev/base/ltluatex.dtx
+++ b/Master/texmf-dist/source/latex-dev/base/ltluatex.dtx
@@ -28,7 +28,7 @@
\ProvidesFile{ltluatex.dtx}
%</driver>
%<*tex>
-[2021/08/11 v1.1u
+[2021/10/15 v1.1v
%</tex>
%<plain> LuaTeX support for plain TeX (core)
%<*tex>
@@ -1415,6 +1415,7 @@ local callbacktypes = callbacktypes or {
% \changes{v1.1j}{2019/06/18}{font\_descriptor\_objnum\_provider added}
% \changes{v1.1l}{2020/02/02}{glyph\_info added}
% \changes{v1.1t}{2021/04/18}{input\_level\_string added}
+% \changes{v1.1v}{2021/10/15}{provide\_charproc\_data added}
% \begin{macrocode}
define_font = exclusive,
glyph_info = exclusive,
@@ -1423,6 +1424,7 @@ local callbacktypes = callbacktypes or {
make_extensible = exclusive,
font_descriptor_objnum_provider = exclusive,
input_level_string = exclusive,
+ provide_charproc_data = exclusive,
% \end{macrocode}
% \changes{v1.0m}{2016/02/11}{pdf\_stream\_filter\_callback removed}
% \begin{macrocode}
diff --git a/Master/texmf-dist/source/latex-dev/base/ltmath.dtx b/Master/texmf-dist/source/latex-dev/base/ltmath.dtx
index aadb96fb023..59e0d89a106 100644
--- a/Master/texmf-dist/source/latex-dev/base/ltmath.dtx
+++ b/Master/texmf-dist/source/latex-dev/base/ltmath.dtx
@@ -38,7 +38,7 @@
%<*driver>
% \fi
\ProvidesFile{ltmath.dtx}
- [2021/04/20 v1.2i LaTeX Kernel (Math Setup)]
+ [2021/10/14 v1.2j LaTeX Kernel (Math Setup)]
% \iffalse
%</driver>
%
@@ -915,10 +915,13 @@
% whole display. Note that we can't use \cs{refstepcounter} as this
% results in |\@currentlabel| getting restored at the wrong and
% thus always writing the first label to the \texttt{.aux} file.
+% \changes{v1.2j}{2021/10/14}
+% {Explicitly set \cs{@currentcounter} (gh/687)}
% \begin{macrocode}
\def\eqnarray{%
\stepcounter{equation}%
\def\@currentlabel{\p@equation\theequation}%
+ \def\@currentcounter{equation}%
\global\@eqnswtrue
\m@th
\global\@eqcnt\z@
@@ -1231,10 +1234,13 @@
%
% \begin{environment}{eqnarray}
% The \textsf{eqnarray} environment
+% \changes{v1.2j}{2021/10/14}
+% {Explicitly set \cs{@currentcounter} (gh/687)}
% \begin{macrocode}
\renewenvironment{eqnarray}{%
\stepcounter{equation}%
\def\@currentlabel{\p@equation\theequation}%
+ \def\@currentcounter{equation}%
\global\@eqnswtrue\m@th
\global\@eqcnt\z@
\tabskip\mathindent
diff --git a/Master/texmf-dist/source/latex-dev/base/ltoutenc.dtx b/Master/texmf-dist/source/latex-dev/base/ltoutenc.dtx
index 14518d2fb24..61ea381823c 100644
--- a/Master/texmf-dist/source/latex-dev/base/ltoutenc.dtx
+++ b/Master/texmf-dist/source/latex-dev/base/ltoutenc.dtx
@@ -44,7 +44,7 @@
%<*driver>
% \fi
\ProvidesFile{ltoutenc.dtx}
- [2021/09/12 v2.0w LaTeX Kernel (font encodings)]
+ [2021/10/16 v2.0x LaTeX Kernel (font encodings)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltoutenc.dtx}
@@ -199,7 +199,7 @@
% commands, such as accents. It also contains the code for some of
% the encoding files, including |omlenc.def|,
% |omsenc.def|, |t1enc.def| and |ot1enc.def| files, which define
-% the |OLM|,
+% the |OML|,
% |OMS|, |T1| and |OT1| encodings, and the |fontenc| package
% for selecting encodings.
%
@@ -845,10 +845,11 @@
% We also ignore \cs{ignorespaces} which has the same issue and may
% show up as part of \cs{normalfont} if that is used.
% \changes{v2.0m}{2019/12/18}{Avoid code that breaks \cs{accent}}
+% \changes{v2.0x}{2021/10/16}{Dont set \cs{spacefactor in math mode gh/643}}
% \begin{macrocode}
\let\maybe@load@fontshape\relax
\let\ignorespaces\relax
- \accent#1 #2\egroup\spacefactor\accent@spacefactor}
+ \accent#1 #2\egroup\ifmmode\else\spacefactor\accent@spacefactor\fi}
% \end{macrocode}
%
%
diff --git a/Master/texmf-dist/source/latex-dev/base/ltpara.dtx b/Master/texmf-dist/source/latex-dev/base/ltpara.dtx
index bc51e4688ff..9802bfd63a2 100644
--- a/Master/texmf-dist/source/latex-dev/base/ltpara.dtx
+++ b/Master/texmf-dist/source/latex-dev/base/ltpara.dtx
@@ -14,8 +14,8 @@
%%% From File: ltpara.dtx
%
% \begin{macrocode}
-\def\ltparaversion{v1.0j}
-\def\ltparadate{2021/09/18}
+\def\ltparaversion{v1.0k}
+\def\ltparadate{2021/10/19}
% \end{macrocode}
%<*driver>
\documentclass{l3doc}
@@ -122,8 +122,8 @@
% \verb=\hbox{a\par b}= is ignored, but \verb=$a\par b$= would complain.
%
% If this primitive ends the paragraph it does some special
-% \enquote{end of horizontal list} processing, then calls \TeX{} paragraph
-% builder that breaks the horizontal list into lines then these
+% \enquote{end of horizontal list} processing, then calls \TeX{}’s paragraph
+% builder; this breaks the horizontal list into lines and then these
% lines are added as boxes to the enclosing vertical list and
% \TeX{} returns to vertical mode.
%
@@ -133,13 +133,14 @@
% automatically changed to a \cs{par} command which is then
% executed. The other possibility is that \TeX{} encounters a
% command which is incompatible with horizontal processing, e.g.,
-% \cs{vskip} (a request for adding vertical space). In such case it
+% \cs{vskip} (a request for adding vertical space). In such cases it
% silently backs up, and inserts a \cs{par} in the hope that this
-% gets it out of horizontal mode and makes the offending command
+% gets it out of horizontal mode and makes the vertical command
% acceptable.
% The important point to note here is that \TeX{} really inserts
-% the command \cs{par} which can be redefined. Thus, it may not have
+% the command with the name \cs{par}, which can be redefined.
+% Thus, it may not have
% its original \enquote{primitive} meaning and therefore may not end the
% horizontal list and call the paragraph builder. This approach
% offers some flexibility but also allows you to easily produce a
@@ -151,31 +152,30 @@
% then sees \cs{vskip} and inserts \cs{par} to end the
% paragraph. But this now only runs \cs{relax} so nothing changes
% and \cs{vskip} is read again, issues a \cs{par} which \ldots. In
-% short, it takes a plain \TeX{} document with five tokens to run
-% forever (as not even memory is consumed and therefore eventually
+% short, it only takes a plain \TeX{} document with five tokens to run
+% forever (since no memory is consumed and therefore eventually
% exhausted).
%
-% There are no other ways than changing \cs{par} to gain control at
+% There is no way other than changing \cs{par} to gain control at
% the end of a paragraph, i.e., there is no token list like
-% \cs{everypar} that is inserted, i.e., the only way to change the
-% default behavior is to modify the action that \cs{par} executes
+% \cs{everypar} that is inserted. Hence the only way to change the
+% default behavior is to modify the action that \cs{par} executes,
% with similar issues as outlined before: different processes need
% to ensure that they do not overwrite their modifications or
% worse, think that the \cs{par} in front of them is the engine
% primitive while in fact it has already been changed by other
% code.
%
-%
% To make matters slightly worse there are a few places where
% \TeX{} handles the situation differently (most likely for speed
% reasons back when computers were much slower). If \TeX{} finds
% itself in unrestricted horizontal mode at the end of building a
-% vertical box (or an \cs{insert}, \cs{vadjust} or at the end of
+% vertical box (for an \cs{insert}, \cs{vadjust} or
% executing the output routine code), it will finish the horizontal
% list not by issuing a \cs{par} command (which would be consistent
-% with all other places, but by simply executing the primitive version
-% of \cs{par} regardless of the definition that \cs{par} has at the
-% time.
+% with all other places) but by simply executing the primitive meaning
+% of \cs{par}, regardless of the actual definition that \cs{par}
+% has at the time.
%
% Thus, if you have carefully crafted a redefined \cs{par} to execute
% some special actions at the end of a paragraph and you write
@@ -183,27 +183,28 @@
%\begin{verbatim}
% \vbox{Some paragraph ... text.}
%\end{verbatim}
-% you will find that your code has never run for the last paragraph
+% you will find that your code does not get run for the last paragraph
% in that box. \LaTeX{} avoids this problem, by making sure that
-% all its boxes (such as \cs{parbox} or the \env{minipage}
+% its boxes (such as \cs{parbox} or the \env{minipage}
% environment, etc.) all internally add an explicit \cs{par} at the
% end so that such code is run and \TeX{} finds itself in vertical
% mode already without the need to start up the paragraph builder
% internally. But, of course, this only works for boxes under direct
-% control of the \LaTeX{} kernel, if some package uses low-level
+% control of the \LaTeX{} kernel; if some package uses low-level
% \cs{vbox}es without adding this precaution the \TeX{}
% optimization kicks in and no special \cs{par} code is executed.
%
% And there is another optimization that is painful: if a paragraph
% is interrupted by a mathematical display, e.g., \verb=\[...\]= in
% \LaTeX{} or \verb=$$...$$= in plain \TeX{}, then \TeX{} will
-% resume horizontal mode afterward, i.e., build a new horizontal
-% list (without inserting an indentation box or \cs{everypar} at
-% that point). However, if that list immediately ends with an
+% resume horizontal mode afterward, i.e., it will start to build
+% a new horizontal
+% list without inserting an indentation box or \cs{everypar} at
+% that point. However, if that list immediately ends with an
% explicit or implicit \cs{par} then \TeX{} will simply throw away
% this \enquote{null} paragraph and not do its usual \enquote{end
-% of horizontal list} processing, so this special case need to be
-% accounted for when introducing some extended processing.
+% of horizontal list} processing, so this special case also needs to be
+% accounted for when introducing any extended processing.
%
%
%
@@ -214,8 +215,8 @@
% the start and end of the paragraph processing. The public hooks
% can be used by packages (or by the user in the preamble or
% within the document) and using the hook mechanisms it is possible
-% to reorder or arrange code from different packages in a way that
-% it can safely coexist.
+% to reorder or arrange code from different packages in such a way that
+% these can safely coexist.
%
% To make that happen we have to make use of the basic
% functionality that is offered by \TeX{}, e.g., we install
@@ -248,7 +249,7 @@
% Fortunately, \LaTeX{} has already redefined \cs{par} for its own
% purposes. As a result there aren't many packages that attempt to
% change \cs{par}, because without a lot of extra care that would
-% fail miserably. But bottom line, if you load a package that
+% fail miserably. But the bottom line is that, if you load a package that
% alters \cs{par} then the end of paragraph hooks are most likely
% not executing while that redefinition is
% active.\footnote{Similarly to the \cs{everypar} situation, the
@@ -326,7 +327,7 @@
%
% This hook is executed at the end of a paragraph when \TeX{} is
% ready to return to vertical mode and after it has removed the
-% last horizontal glue (but not kern) placed on the horizontal
+% last horizontal glue (but not any kerns) placed on the horizontal
% list. The code is still executed in horizontal mode so it is
% possible to add further horizontal material at this point, but
% it should not alter the mode (even a temporary exit from
@@ -415,20 +416,30 @@
% \subsection{Altered and newly provided commands}
%
% \begin{function}{\par,\endgraf,\para_end:}
-% An explicit request for ending a paragraph is known in plain
-% \TeX{} under the name \cs{endgraf} where it simply calls the
-% paragraph primitive (regardless of what \cs{par} may have as its
-% current definition). In \LaTeX{} \cs{endgraf} with that behavior
-% was also made available.
+% An explicit request for ending a paragraph is provided in plain
+% \TeX{} under the name \cs{endgraf}, which simply uses the
+% primitive meaning (regardless of what \cs{par} may have as its
+% current definition). In \LaTeX{} \cs{endgraf} (with that behavior)
+% was originally also available.
%
% With the new paragraph handling in \LaTeX{}, ending a paragraph
% means a bit more than just calling the engine's paragraph
% builder: the process also has to add any hook code for the end of
% a paragraph. Thus
% \cs{endgraf} was changed to provide this additional functionality
-% (and so by extension \cs{par} subject to its current meaning).
-%
-% The \pkg{expl3} name for the functionality is \cs{para_end:}.
+% (along with \cs{par} remaining subject to its current meaning).
+%
+% TEMP NOTE: Maybe endgraf should not be changed by LaTeX as it is
+% essentially not at all a part of LaTeX.
+% If it is too dangerous to leave it as
+% a synonym for the primitive, then we could just disable it.
+% [FMi:]
+% not in my opinion. It is used in many places and the redefinition is safe and does the right thing.
+% disabling it just means it breaks a lot of stuff for no reason.
+% [FMi:]
+% Note that the 2e kernel has been completely purged of endgrafs.
+%
+% The \pkg{expl3} name for this functionality is \cs{para_end:}.
% \end{function}
%
% \begin{quote}
@@ -538,7 +549,7 @@
% sequence numbers. This is most easily done using \pkg{expl3}
% functions, so we switch over. This is not a very general
% implementation, just enough for what we need and a bit of
-% \LaTeXe{} thrown in as well. When popping the result gets stored
+% \LaTeXe{} thrown in as well. When popping, the result gets stored
% in \cs{paracntvalue} and the \cs{ERROR} should never happen
% because it means we have tried to pop from an empty stack.
%\begin{verbatim}
@@ -629,7 +640,7 @@
% \subsubsection{Glue items between paragraphs (found with \pkg{fancypar})}
%
% In the past \LaTeX{} placed two glue items between two
-% consecutive paragraph, e.g.,
+% consecutive paragraphs, e.g.,
%\begin{verbatim}
% text1 \par text2 \par
%\end{verbatim}
@@ -644,12 +655,12 @@
% \glue(\parskip) 0.0
% \glue(\baselineskip) 5.16669
%\end{verbatim}
-% The reason is that we generate a \enquote{fake}'' paragraph to
+% The reason is that we generate a \enquote{fake} paragraph to
% gain control and safely add the early hooks, but this generates
% an additional glue item. That item doesn't contribute anything
-% vertically but ifsomebody writes code the unravels a constructed
+% vertically but if somebody writes code that unravels a constructed
% list using \cs{lastbox}, \cs{unskip} and \cs{unpenalty} then the
-% code has to remove one additional glue item or else will fail.
+% code has to remove one additional glue item or else it will fail.
%
% ^^A \subsubsection{}
@@ -828,8 +839,8 @@
%
% But if we have already replaced it by a token register then all
% they do is to give that token register a new name. Thus our code
-% in \cs{tex_everypar:D} would call \cs{everypar} (which is their
-% now token register) and the code that they added ends up in our
+% in \cs{tex_everypar:D} would call \cs{everypar} (which is now their
+% token register) and the code that they added ends up in our
% token register which is then never used at all. A bit mind
% boggling I guess.
%
@@ -927,7 +938,7 @@
% \end{itemize}
%
% Unfortunately, \TeX{} has some (these days) unnecessary
-% optimization: if a \cs{vbox} ends and \TeX{} is still in
+% optimizations: if a \cs{vbox} ends and \TeX{} is still in
% horizontal mode it simply exercises the paragraph builder instead
% of issuing a \cs{par}. It is therefore necessary for \LaTeX{} to
% ensure that this case doesn't happen and all boxes internally
@@ -940,11 +951,12 @@
% \texttt{latex.ltx}. For this \LaTeXe{} code has the following
% conventions: \cs{@@@@par} and \cs{endgraf} both refer to the
% default meaning (in the past this was the initex primitive) while
-% \cs{par} is the current meaning which may does something else.
+% \cs{par} is the current meaning which maybe does something else.
%
+% TEMP NOTE: See earlier note re endgraf.
%
-% We are now going to change this default meaning to run
-% \cs{para_end:} instead, which ultimately executes the initex
+% We are now going to change this default meaning to instead run
+% \cs{para_end:}, which ultimately executes the initex
% primitive but additionally adds our hooks when appropriate.
% This way the change is again transparent to the legacy \LaTeXe{}
% code.
@@ -953,22 +965,24 @@
% primitive and we achieve this by simply expanding it to the
% primitive which is available to us as \cs{tex_par:D}. This way we
% don't have to care about whether \TeX{} just does nothing (e.g.,
-% if in vertical mode already) or generate an error, etc.
+% if in vertical mode already) or generates an error, etc.
% \begin{macrocode}
\cs_new_protected:Npn \para_end: {
% \end{macrocode}
%
+% TEMP NOTE: What should happen if in outer hmode with an empty hlist?
+%
% The only case we care about is when we are in horizontal mode
% (i.e., doing typesetting) and not also in inner mode (i.e.,
% making paragraphs and not building an \cs{hbox}.
-% \begin{macrocode}
+%\begin{verbatim}
% \bool_lazy_and:nnT
% { \mode_if_horizontal_p: }
% { \bool_not_p:n { \mode_if_inner_p: } }
% { ...
-% \end{macrocode}
+%\end{verbatim}
% Since this is executed for each and every paragraph in a document
-% we try to stay a fast as possible, So we are aren't using the
+% we try to stay as fast as possible, so we do not use the
% above construct but two conditionals instead. Using low-level
% \cs{if_mode...} conditions would be even faster but has the
% danger to conflict with conditionals in the user hooks.
@@ -981,17 +995,18 @@
% \afterassignment\lst@vskip\@tempskipa \z@ \par
%\end{verbatim}
% If \TeX{} is in hmode while that assignment happens then the
-% \cs{par} is seen in hmode (because in the above case the
-% assignment isn't finished (one should have used \cs{z@skip} and
+% \cs{par} is seen in hmode because in the above case the
+% assignment may not be finished (one should have used \cs{z@skip}) and
% the \cs{lst@vskip} will get inserted into the middle of the
% conditional. The \cs{lst@vskip} then changes to vmode and you get
% a surprising error about the \texttt{para/end} hook having
-% changed modes even if you don't have any hook code because it is
-% the instered \cs{lst@vskip} that is causing it. That happened
+% changed modes even if you don't have any hook code(!): it is
+% the inserted \cs{lst@vskip} that is actually causing the change of
+% mode.This is what happened
% when the output routines got started while a \texttt{lstlisting}
% environment (that redefines \cs{vskip} in this way) was
% active. This is really faulty coding, but we try to be proactive
-% and guard the conditional so thatany scanning is stopped before it:
+% and guard the conditional so that any scanning is first stopped, thus:
% \begin{macrocode}
\scan_stop:
% \end{macrocode}
@@ -1001,17 +1016,26 @@
\mode_if_inner:F {
% \end{macrocode}
% In that case the action of the primitive would be to remove the
-% last glue (not kern) from the horizontal list constructed to form
-% a paragraph then append the a penalty of 10000 and the
-% \cs{parfillskip} at the end and pass the whole list to the
-% paragraph builder which breaks it into lines and \TeX{} then
+% last glue (but no kerns) from the horizontal list (constructed to form
+% a paragraph) and then to append a penalty of 10000 and the
+% \cs{parfillskip}; it then passes the whole list to the
+% paragraph builder, which breaks it into lines and \TeX{} then
% returns to vertical mode.
%
-% What we want to do instead is to add our hook code at the end of
-% the horizontal list before that happens and the code is passed to
-% the paragraph builder. If there was a glue item at the end then
+% What we want to do is to add this hook code at the end of
+% the horizontal list before any of the above happens.
+% If there was a glue item at the end of the list then
% it should get removed before the hook code gets added so we have
-% to arrange for its removal ourselves.
+% to arrange for this removal.
+%
+% TEMP NOTE: maybe a ‘nobreak’ should also be added?
+%
+% [FMi:]
+% sounds wrong to me, why?
+% [CCC:] See email: because the hook may add some material,
+% such as glue that might produce an unintended linebreak.
+% [FMi:]
+%
%
% There is not much point in checking if there was really a glue
% item at the end of the horizontal list, instead we simply try to
@@ -1020,38 +1044,44 @@
% \begin{macrocode}
\tex_unskip:D
% \end{macrocode}
-% The we execute the public hook (which may add final typesetting
-% material) followed by the kernel hook we need for adding tagging
+% We then execute the public hook (which may add some final typeset
+% material) followed by the kernel hook that we need for adding tagging
% support. None of this is supposed to change the mode---at the
% moment we make only a very simple test for this, more devious
-% changes go unnoticed, but too bad, that will then probably
-% badly backfire.
+% changes go unnoticed, but too bad as they will then probably
+% backfire badly.
% \begin{macrocode}
\hook_use:n{para/end}
\@kernel@after@para@end
\mode_if_horizontal:TF {
% \end{macrocode}
% The final action (before getting to the point where
-% \cs{tex_par:D} is called) is to add a glue item so that the
-% primitive is prevented from removing glue (if there was some). If
-% we don't do this and the
-% horizontal list ended in several glue items we would end up with
-% removing two instead of just the last one, which would be wrong.
-% We use glue (rather than a kern) as that will be removed by the primitive
-% par.
+% \cs{tex_par:D} is called) is to add an extra glue item so that the
+% primitive is prevented from removing intended glue
+% (if there was some). If we don't do this and the
+% horizontal list ends in several glue items we would end up removing
+% two glue items instead of just the last one, which would be wrong.
+% We use glue (rather than a kern) as that will be removed by the
+% primitive.
%
% There is however one other \TeX{} optimization that hurts: in a
% sequence like this \verb=$$ ... $$ \par= \TeX{} will be in
% horizontal mode after the display, ready to receive further
% paragraph text, but since the \cs{par} follows immediately there
% is a ``null'' paragraph at the end and \TeX{} simply throws that
-% away. The space between \verb=$$= and \cs{par} got already
+% away.
+% The space between \verb=$$= and \cs{par} got already
% dropped during the display processing so the \cs{par} is not
% removing any space and appending \cs{parfillskip}, instead it
-% simply goes silently to vmode. Now if we would have added something (to
+% simply goes silently to vmode.
+%
+% TEMP NOTE: Is this actually how it works?
+% For any current definition of par?
+%
+% Now if we would have added something (to
% prevent glue removal) that would look to \TeX{} like material
% after the display and so we would end up with an empty paragraph
-% just containing \cs{parfillskip}.
+% just containing a penalty and \cs{parfillskip}.
%
% We therefore check if the current hlist does end in glue
% (\cs{tex_lastnodetype:D} has the value \texttt{11}) and
@@ -1066,15 +1096,16 @@
% To run the \hook{para/after} hook we first end the
% paragraph. This means that the \cs{tex_par:D} at the very end is
% unnecessary but executing it there unnecessarily is better than
-% having code that test for all the different mode possibilities.
+% having code that tests for all the different mode possibilities.
% \begin{macrocode}
\tex_par:D
\hook_use:n{para/after}
\@kernel@after@para@after
}
% \end{macrocode}
-% If we haven't been in horizontal mode then the earlier hook
-% \hook{para/end} is at fault and we report that.
+% If we were not horizontal mode (the F case from above)
+% then the earlier hook
+% \hook{para/end} must have been at fault, so we report that.
% \begin{macrocode}
{ \msg_error:nnnn { hooks }{ para-mode }{end}{horizontal} }
% \end{macrocode}
@@ -1083,7 +1114,7 @@
}
}
% \end{macrocode}
-%
+% And then we can use the primitive to truly end the paragraph.
% \begin{macrocode}
\tex_par:D
}
@@ -1160,10 +1191,13 @@
% \begin{macro}[int]{\@@par}
%
% Having the new default definition for \cs{par} we also have to
-% set it up so that it gets used. This is needed in three places
+% set it up so that it gets used. This involves three commands:
% \cs{par}, \cs{@@par} (to which \LaTeX{} resets \cs{par}
-% occasionally) and \cs{endgraf} which is another name for the
+% occasionally) and \cs{endgraf}, which is another name for the
% ``default'' action of \cs{par}.
+%
+% TEMP NOTE: re endgraf again.
+%
% \begin{macrocode}
\cs_set_eq:NN \par \para_end:
\cs_set_eq:NN \@@par \para_end:
@@ -1235,6 +1269,16 @@
%<latexrelease>\cs_set_eq:NN \@@par \tex_par:D
%<latexrelease>\cs_set_eq:NN \endgraf \tex_par:D
%<latexrelease>
+% \end{macrocode}
+% We also need to clean up the primitive ``everypar'' as that
+% should no longer execute any code by default. And, of course,
+% make \cs{everypar} become the primitive again.
+% \changes{v1.0k}{2021/10/19}{Remove content from \cs{tex_everypar:D}
+% on rollback}
+% \begin{macrocode}
+%<latexrelease>\tex_everypar:D {}
+%<latexrelease>\cs_set_eq:NN \everypar \tex_everypar:D
+%<latexrelease>
%<latexrelease>\EndModuleRelease
\ExplSyntaxOff
%</2ekernel|latexrelease>
diff --git a/Master/texmf-dist/source/latex-dev/base/ltvers.dtx b/Master/texmf-dist/source/latex-dev/base/ltvers.dtx
index 3f2f119cb1b..7c17069aea0 100644
--- a/Master/texmf-dist/source/latex-dev/base/ltvers.dtx
+++ b/Master/texmf-dist/source/latex-dev/base/ltvers.dtx
@@ -115,7 +115,7 @@
{2021-11-15}
%</2ekernel|latexrelease>
%<*2ekernel>
-\def\patch@level{-2}
+\def\patch@level{-3}
% \end{macrocode}
%
% \begin{macro}{\development@branch@name}
diff --git a/Master/texmf-dist/source/latex-dev/base/makeindx.dtx b/Master/texmf-dist/source/latex-dev/base/makeindx.dtx
index e8e48e60b06..9dc03a8431e 100644
--- a/Master/texmf-dist/source/latex-dev/base/makeindx.dtx
+++ b/Master/texmf-dist/source/latex-dev/base/makeindx.dtx
@@ -121,7 +121,7 @@
% \begin{macrocode}
%<makeidx>\ProvidesPackage{makeidx}
%<showidx>\ProvidesPackage{showidx}
- [2014/09/29 v1.0m Standard LaTeX package]
+ [2021/10/04 v1.0m Standard LaTeX package]
% \end{macrocode}
%
% \subsection{Makeidx}
@@ -261,7 +261,7 @@
%
% \begin{macro}{\raggedbottom}
% \begin{macro}{\flushbottom}
-% The definition of these macros from \texttt{latex.dtx} is changed
+% The definitions of these macros from the \LaTeX{} format are changed
% here to add the execution of |\@mkidx| to |\@texttop|, which is
% executed at the top of each page.
% \begin{macrocode}
diff --git a/Master/texmf-dist/source/latex-dev/base/preload.dtx b/Master/texmf-dist/source/latex-dev/base/preload.dtx
index b2ca24bce5b..bf2bfebbfa9 100644
--- a/Master/texmf-dist/source/latex-dev/base/preload.dtx
+++ b/Master/texmf-dist/source/latex-dev/base/preload.dtx
@@ -45,7 +45,7 @@
%<+tex> \ProvidesFile{preload.ltx}
% \fi
% \ProvidesFile{preload.dtx}
- [2014/09/29 v2.1g LaTeX Kernel (Font Preloading)]
+ [2021/10/04 v2.1g LaTeX Kernel (Font Preloading)]
%
%
%
@@ -179,7 +179,7 @@
% We begin by loading the math extension font (cmex10)
% and the \LaTeX{} line and circle fonts.
% It is necessary to do this explicitly since these are
-% used by \texttt{lplain.tex} and \texttt{latex.tex}.
+% used by the \LaTeX{} format.
% Since the internal font name contains |/| characters
% and digits we construct the name via |\csname|.
% These are the only fonts (!) that must be loaded in this file.
diff --git a/Master/texmf-dist/source/latex-dev/base/slides.dtx b/Master/texmf-dist/source/latex-dev/base/slides.dtx
index 883e7d34f04..e63c1901d6d 100644
--- a/Master/texmf-dist/source/latex-dev/base/slides.dtx
+++ b/Master/texmf-dist/source/latex-dev/base/slides.dtx
@@ -53,7 +53,7 @@
%<*driver>
\ProvidesFile{slides.drv}
%</driver>
- [2020/11/23 v2.4b
+ [2021/10/04 v2.4b
%<+class> Standard LaTeX document class]
%<+cmd> SLiTeX definitions]
% \end{macrocode}
@@ -1342,7 +1342,7 @@
%
% \begin{environment}{description}
% The description environment is defined here -- while the itemize
-% and enumerate environments are defined in \file{latex.dtx}.
+% and enumerate environments are defined in the \LaTeX{} format.
%
% \begin{macrocode}
\newenvironment{description}{\list{}{\labelwidth\z@
@@ -1373,7 +1373,7 @@
% \begin{macro}{\theenumii}
% \begin{macro}{\theenumiii}
% \begin{macro}{\theenumiv}
-% The counters are already defined in \file{latex.dtx}, but their
+% The counters are already defined in the \LaTeX{} format, but their
% representation is changed here.
%
% \begin{macrocode}
@@ -2349,7 +2349,7 @@ COLOR LAYER\\[.75in]%
%
% \changes{v2.2j}{1994/03/11}{Corrected \cs{@oval}, like previous
% \changes{v2.4a}{2016/03/29}{Initialize in \cs{@oval}tests added for
-% latex/4452} change to \file{latex.dtx}.}
+% latex/4452} change to the \LaTeX{} format.}
% \begin{macrocode}
\def\line(#1,#2)#3{\if@visible\@xarg #1\relax \@yarg #2\relax
\@linelen #3\unitlength
diff --git a/Master/texmf-dist/source/latex-dev/graphics/color.dtx b/Master/texmf-dist/source/latex-dev/graphics/color.dtx
index 2dfbb238daa..9418a124773 100644
--- a/Master/texmf-dist/source/latex-dev/graphics/color.dtx
+++ b/Master/texmf-dist/source/latex-dev/graphics/color.dtx
@@ -21,7 +21,7 @@
%<driver> \ProvidesFile{color.drv}
% \fi
% \ProvidesFile{color.dtx}
- [2020/02/24 v1.2b Standard LaTeX Color (DPC)]
+ [2021/10/11 v1.3b Standard LaTeX Color (DPC)]
%
% \iffalse
%<*driver>
@@ -78,6 +78,9 @@
% fixed values whilst this file is being read.
% \changes{v0.3b}{1994/09/14}
% {Save and restore catcodes}
+% \changes{v1.3a}{2021/09/27}
+% {Use \cs{@backslashchar} in preference to \cs{string} gh/659}
+%
% \begin{macrocode}
\edef\Gin@codes{%
\catcode`\noexpand\^^A\the\catcode`\^^A\relax
@@ -185,9 +188,11 @@
% \begin{option}{dvipdfm}
% \changes{v1.0h}{1999/01/13}
% {dvipdfm added}
-% Mark Wick's dvipdfm driver.
+% \changes{v1.3b}{2021/10/11}
+% {make dvipdfm an alias for dvipdfmx}
+% Mark Wick's dvipdfm driver (now merged with xdvipdfmx).
% \begin{macrocode}
-\DeclareOption{dvipdfm}{\def\Gin@driver{dvipdfm.def}}
+\DeclareOption{dvipdfm}{\def\Gin@driver{dvipdfmx.def}}
% \end{macrocode}
% \end{option}
%
@@ -375,7 +380,7 @@
% \begin{macrocode}
\DeclareOption{usenames}{%
\def\c@lor@usename#1{%
- \expandafter\color@named\csname\string\color @#1\endcsname{#1}}}
+ \expandafter\color@named\csname\@backslashchar color @#1\endcsname{#1}}}
% \end{macrocode}
% \end{option}
%
@@ -432,10 +437,10 @@
% Finally call |\set@color| to effect the colour change.
% \begin{macrocode}
\def\@declaredcolor#1{%
- \@ifundefined{\string\color @#1}%
+ \@ifundefined{\@backslashchar color @#1}%
{\c@lor@error{`#1'}}%
{\expandafter\let\expandafter\current@color
- \csname\string\color @#1\endcsname
+ \csname\@backslashchar color @#1\endcsname
\set@color}%
\ignorespaces}
% \end{macrocode}
@@ -506,7 +511,7 @@
% \begin{macrocode}
\protected\def\nopagecolor{%
\@ifundefined{no@page@color}{%
- \PackageInfo{color}{\string\nopagecolor\space is not supported}%
+ \PackageInfo{color}{\@backslashchar nopagecolor\space is not supported}%
}{%
\no@page@color
}%
@@ -545,10 +550,10 @@
\protected\def\definecolor#1#2#3{%
\@ifundefined{color@#2}%
{\c@lor@error{model `#2'}}%
- {\@ifundefined{\string\color @#1}{}%
+ {\@ifundefined{\@backslashchar color @#1}{}%
{\PackageInfo{color}{Redefining color #1}}%
\csname color@#2\expandafter\endcsname
- \csname\string\color @#1\endcsname{#3}}}
+ \csname\@backslashchar color @#1\endcsname{#3}}}
% \end{macrocode}
% \end{macro}
%
diff --git a/Master/texmf-dist/source/latex-dev/graphics/graphics.dtx b/Master/texmf-dist/source/latex-dev/graphics/graphics.dtx
index 0c5c9e88eca..cec35559ef8 100644
--- a/Master/texmf-dist/source/latex-dev/graphics/graphics.dtx
+++ b/Master/texmf-dist/source/latex-dev/graphics/graphics.dtx
@@ -616,7 +616,7 @@
% \end{macrocode}
% \end{option}
%
-% \begin{option}{luatex}
+% \begin{option}{dvisvgm}
% \changes{v1.0r}{2016/05/09}
% {dvisvgm added}
% dvisvgm driver.
diff --git a/Master/texmf-dist/source/latex-dev/tools/array.dtx b/Master/texmf-dist/source/latex-dev/tools/array.dtx
index eab451fccd0..ba88aba7c26 100644
--- a/Master/texmf-dist/source/latex-dev/tools/array.dtx
+++ b/Master/texmf-dist/source/latex-dev/tools/array.dtx
@@ -33,7 +33,7 @@
%<+package>\DeclareCurrentRelease{}{2020-10-01}
%<+package>
%<+package>\ProvidesPackage{array}
-%<+package> [2021/07/12 v2.5f Tabular extension package (FMi)]
+%<+package> [2021/10/04 v2.5f Tabular extension package (FMi)]
%
% \fi
%
@@ -927,12 +927,12 @@
% \textsf{token} is stored in the
% \textsf{count} register =\@lastchclass=.
% All of the mentioned registers are already allocated in
-% \texttt{latex.tex},
+% the \LaTeX{} format,
% which is the reason why the following three lines of code are
% commented out.
% Later throughout the text I will not mention it again explicitly
% whenever I use a =%= sign. These parts are already defined in
-% \texttt{latex.tex}.
+% the \LaTeX{} format.
% \begin{macrocode}
% \newcount \@chclass
% \newcount \@chnum
diff --git a/Master/texmf-dist/source/latex-dev/tools/multicol.dtx b/Master/texmf-dist/source/latex-dev/tools/multicol.dtx
index 25d4bc68db1..2b74d85af92 100644
--- a/Master/texmf-dist/source/latex-dev/tools/multicol.dtx
+++ b/Master/texmf-dist/source/latex-dev/tools/multicol.dtx
@@ -98,7 +98,7 @@
%<driver> \ProvidesFile{multicol.drv}
% \fi
% \ProvidesFile{multicol.dtx}
- [2021/07/06 v1.8z multicolumn formatting (FMi)]
+ [2021/10/08 v1.9a multicolumn formatting (FMi)]
%
%
%%
@@ -564,6 +564,13 @@
% forced into the second column (resulting in some white
% space between paragraphs in the first column).
%
+% From version 1.9 onwards \cs{columnbreak} accepts an optional
+% argument (just like \cs{pagebreak}) in which you can specify the
+% desirability to break the column at that point: supported values are
+% \texttt{1} to \texttt{4}. This version also adds \cs{newcolumn}
+% which forces a column break but runs the column short (comparible to
+% \cs{newpage}).
+%
% \subsection{Floats inside a \mc{} environment}
%
% Within the \mc{} environment the usual star float commands are
@@ -981,7 +988,8 @@
% \changes{v1.8x}{2019/10/15}{Use \cs{@maxdepth} not \cs{maxdepth} (gh/190)}
% \begin{macrocode}
\let\mc@gridwarn\maxdimen
-\DeclareOption{grid}{\def\mc@gridwarn{\@maxdepth}}
+\DeclareOption{grid}
+ {\def\mc@gridwarn{\@maxdepth}}
% \end{macrocode}
%
% \changes{v1.8e}{2014/04/23}{Support \cs{docolaction}}
@@ -1071,7 +1079,8 @@
% \changes{v1.6e}{2004/02/14}{Avoid self-referencing definition of
% \cs{@footnotetext} (pr/3618)}.
% \begin{macrocode}
- \ifx\@footnotetext\mult@footnotetext\else
+ \ifx\@footnotetext\mult@footnotetext
+ \else
\let\orig@footnotetext\@footnotetext
\let\@footnotetext\mult@footnotetext
\fi
@@ -1512,10 +1521,13 @@
\def\clearpage{%
\ifx\@deferlist\@empty\else
\PackageError{multicol}%
- {Deferred floats not cleared}%
- {A \string\clearpage\space inside multicols acts like
- \string\newpage\space and doesn't clear floats.\MessageBreak
- Move it before the multicols environment if you need it.}%
+ {Deferred floats not cleared}%
+ {A \string\clearpage\space inside
+ multicols acts like
+ \string\newpage\space and doesn't
+ clear floats.\MessageBreak
+ Move it before the multicols
+ environment if you need it.}%
\fi
\newpage}%
% \end{macrocode}
@@ -1701,7 +1713,8 @@
% for later.
% \changes{v1.8r}{2018/01/28}{Macro added}
% \begin{macrocode}
-\mathchardef\@Mvi=10006 % 10005 is \columnbreak
+\mathchardef\@Mvi=10006 % 10005 is
+ % \columnbreak
% \end{macrocode}
% \end{macro}
%
@@ -1724,7 +1737,8 @@
% \changes{v1.8c}{2013/11/03}{Add \cs{color@endgroup} to prevent color leak}
% \changes{v1.8f}{2014/06/19}{Discard spaces before adding \cs{color@endgroup}}
% \begin{macrocode}
- \remove@discardable@items\color@endgroup\egroup
+ \remove@discardable@items
+ \color@endgroup\egroup
% \end{macrocode}
% Now we call |\balance@columns| the routine that balances material
% stored in the box |\mult@box|.
@@ -1754,7 +1768,7 @@
{Restore kept marks to\MessageBreak
first: \meaning\kept@firstmark
\MessageBreak bot\space\space:
- \meaning\kept@botmark }%
+ \meaning\kept@botmark }%
%</marktrace>
% \end{macrocode}
% This finishes the code for the ``boxed'' case.
@@ -2203,7 +2217,7 @@
% \changes{v1.8x}{2019/10/15}{Use \cs{@maxdepth} not \cs{maxdepth} (gh/190)}
% \begin{macrocode}
\def\vfilmaxdepth{\vskip \z@ \@plus .0001fil
- \@minus \@maxdepth}
+ \@minus \@maxdepth}
% \end{macrocode}
% \end{macro}
%
@@ -2335,7 +2349,8 @@
\setbox\count@
\vbox to\dimen@
{\unvbox\count@
- \ifshr@nking\vfilmaxdepth\fi}%
+ \ifshr@nking
+ \vfilmaxdepth\fi}%
}%
% \end{macrocode}
% Then the last column follows.
@@ -2615,7 +2630,8 @@
% \changes{v1.8r}{2018/01/28}{Handling end of env through special penalty}
% \begin{macrocode}
\ifnum\outputpenalty = -\@Mvi
- \mult@info\@ne{End penalty of multicols seen}%
+ \mult@info\@ne{End penalty of
+ multicols seen}%
% \end{macrocode}
% If we are at this point then we have to run the balancing code
% (which was previously its own output routine). First we pretend
@@ -2626,7 +2642,9 @@
% in a better way; basically it is like this, because of the older
% code was using different ORs and I simply reused most of it.
% \begin{macrocode}
- \outputpenalty\@M % pretend we had a natural forced break
+ \outputpenalty\@M % pretend we had
+ % a natural
+ % forced break
\balance@columns@out
\else
% \end{macrocode}
@@ -2647,7 +2665,8 @@
% this is possible with |\xdef|.)
% \changes{v1.2a}{1990/02/05}{Float boxes freed.}
% \begin{macrocode}
- \xdef\@freelist{\@freelist\@currlist}%
+ \xdef\@freelist{\@freelist
+ \@currlist}%
\gdef\@currlist{}%
\fi
\fi
@@ -2822,8 +2841,9 @@
% |\enlargethispage| command.
% \changes{v1.8a}{2011/12/20}{Support for \cs{enlargethispage}}
% \begin{macrocode}
- \ifvbox\@kludgeins\insert\@kludgeins
- {\unvbox\@kludgeins}\fi
+ \ifvbox\@kludgeins
+ \insert\@kludgeins
+ {\unvbox\@kludgeins}\fi
% \end{macrocode}
% Then we |\unvbox| the |\partial@page| (which may be void if we
% are not processing the first page of this \mc{} environment.
@@ -2833,7 +2853,8 @@
% Then we return the first and bottom mark and the gathered
% material to the main vertical list.
% \begin{macrocode}
- \return@nonemptymark{first}\kept@firstmark
+ \return@nonemptymark{first}%
+ \kept@firstmark
\return@nonemptymark{bot}\kept@botmark
\page@sofar
% \end{macrocode}
@@ -2960,12 +2981,14 @@
% \changes{v1.8w}{2019/03/01}{Provide minrows counter for balancing}
% \begin{macrocode}
\@tempdima\dimexpr
- \topskip +\c@minrows\baselineskip-\baselineskip\relax
+ \topskip +\c@minrows\baselineskip
+ -\baselineskip\relax
\ifnum\dimen@<\@tempdima
\mult@info\@ne
{Start value
\the\dimen@ \space ->
- \the\@tempdima \space (corrected for minrows)}%
+ \the\@tempdima \space
+ (corrected for minrows)}%
\dimen@\@tempdima
\fi
% \end{macrocode}
@@ -3466,7 +3489,9 @@
% directly at the values of the allocation counters.
% \changes{v1.8y}{2019/12/09}{Allow for 20 columns (gh/237)}
% \begin{macrocode}
-\ifnum\numexpr \count20-\count14-1<41 % = 2 * 20 + 1
+\ifnum\numexpr
+ \count20-\count14-1<41
+ % this is = 2 * 20 + 1
\count14=\@cclv
\fi
% \end{macrocode}
@@ -4071,34 +4096,65 @@
%
% \begin{macro}{\columnbreak}
% \changes{v1.5u}{1999/05/25}{Macro added}
+% \changes{v1.9a}{2021/10/08}{Added optional argument for conditional break}
% |\columnbreak| is modeled after |\pagebreak| except that we
% generate a penalty -10005.
% \begin{macrocode}
\mathchardef\@Mv=10005
-\def\columnbreak{%
+\newcommand\columnbreak[1][4]{%
% \end{macrocode}
% We have to ensure that it is only used within a \mc{}
% environment since if that penalty would be seen by the unmodified
% \LaTeX{} output routine strange things would happen.
% \begin{macrocode}
- \ifnum\col@number<\tw@
- \PackageError{multicol}%
- {\noexpand\columnbreak outside multicols}%
- {This command can only be used within
- a multicols or multicols* environment.}%
- \else
- \ifvmode
- \penalty -\@Mv\relax
- \else
- \@bsphack
- \vadjust{\penalty -\@Mv\relax}%
- \@esphack
- \fi
- \fi}
+ \ifnum\col@number<\tw@
+ \PackageError{multicol}%
+ {\noexpand\newcolumn outside multicols}%
+ {This command can only be used within
+ a multicols or multicols* environment.}%
+ \else
+% \end{macrocode}
+% Increasingly lower penalty based on argument value. This is like
+% \cs{pagebreak} but we use other penalty values are the \LaTeX{}
+% defaults aree rather pointless for pagination.
+% \begin{macrocode}
+ \edef\mc@break@pen
+ {-\ifcase#1\@m\or 3333\or 6666\or 9999\else\@Mv\fi\relax}%
+ \ifvmode
+ \penalty \mc@break@pen
+ \else
+ \@bsphack
+ \vadjust{\penalty \mc@break@pen}%
+ \@esphack
+ \fi
+ \fi}
% \end{macrocode}
% \end{macro}
%
%
+%
+% \begin{macro}{\newcolumn}
+% \changes{v1.9a}{2021/10/08}{Macro added}
+% This is modeled after \cs{newpage} but for column breaks.
+% \begin{macrocode}
+\newcommand\newcolumn{%
+ \ifnum\col@number<\tw@
+ \PackageError{multicol}%
+ {\noexpand\newcolumn outside multicols}%
+ {This command can only be used within
+ a multicols or multicols* environment.}%
+ \else
+ \ifvmode
+ \nobreak\vfill\penalty -\@Mv\relax
+ \else
+ \@bsphack
+ \vadjust{\nobreak\vfill\kern\z@\penalty -\@Mv\relax}%
+ \@esphack
+ \fi
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\colbreak@box}
% \changes{v1.5u}{1999/05/25}{Macro added}
% Need a box to collect the galley up to the column break.