summaryrefslogtreecommitdiff
path: root/macros/latex/base/ltfssdcl.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/base/ltfssdcl.dtx')
-rw-r--r--macros/latex/base/ltfssdcl.dtx322
1 files changed, 204 insertions, 118 deletions
diff --git a/macros/latex/base/ltfssdcl.dtx b/macros/latex/base/ltfssdcl.dtx
index dd9f12f802..49041605e9 100644
--- a/macros/latex/base/ltfssdcl.dtx
+++ b/macros/latex/base/ltfssdcl.dtx
@@ -36,7 +36,7 @@
%
%
\ProvidesFile{ltfssdcl.dtx}
- [2022/07/04 v3.0z LaTeX Kernel (NFSS Declarative Interface)]
+ [2022/09/20 v3.1b LaTeX Kernel (NFSS Declarative Interface)]
% \iffalse
\documentclass{ltxdoc}
\begin{document}
@@ -457,7 +457,7 @@
%
%
%
-% \begin{macro}{\c@localalphabets}
+% \begin{macro}{\c@localmathalphabets}
% \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
@@ -577,118 +577,6 @@
}
% \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}
-% If this is executed after a math display, we may have to arrange
-% for ignoring spaces, because they are now hidden if
-% the tokens from above intervene. This is signaled by the 2e
-% switch \texttt{@ignore} which is set in \cs{frozen@everymath} and
-% \cs{frozen@everydisplay}.
-%
-% This is all 2e code so we use that syntax.
-% \changes{v3.0z}{2022/07/04}{Ignore spaces if necessary (gh/886)}
-% \begin{macrocode}
- \if@ignore \ignorespaces \fi
- }
-}
-% \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
@@ -786,7 +674,132 @@
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
% \end{macrocode}
-% \end{macro}
+% \end{macro}
+%
+%
+%
+%
+% \begin{macro}{\freeze@math@version}
+% \changes{v3.0x}{2021/09/26}{Macro added for (gh/676)}
+% \changes{v3.1a}{2022/09/17}{New logic for freezing math versions (gh/921)}
+% 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}
+%</2ekernel>
+%<*2ekernel|latexrelease>
+%<latexrelease>\IncludeInRelease{2022/11/01}%
+%<latexrelease> {\freeze@math@version}{freeze math version}%
+\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}
+% 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}
+% If this is executed after a math display, we may have to arrange
+% for ignoring spaces, because they are now hidden if
+% the tokens from above intervene. This is signaled by the 2e
+% switch \texttt{@ignore} which is set in \cs{frozen@everymath} and
+% \cs{frozen@everydisplay}.
+%
+% This is all 2e code so we use that syntax.
+% \changes{v3.0z}{2022/07/04}{Ignore spaces if necessary (gh/886)}
+% \begin{macrocode}
+ \if@ignore \ignorespaces \fi
+ }
+}
+\ExplSyntaxOff
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2021/11/15}
+%<latexrelease> {\freeze@math@version}{freeze math version}%
+%<latexrelease>
+%<latexrelease>\ExplSyntaxOn
+%<latexrelease>\cs_set_protected:Npn\freeze@math@version #1 {
+%<latexrelease> \@font@info{Freeze~ math~ alphabet~ allocation~ in~ version~
+%<latexrelease> #1.\MessageBreak
+%<latexrelease> Allocated~math~groups:~\int_use:c{ c@mv@ #1 }~
+%<latexrelease> (local:~ \int_use:N\c@localmathalphabets) }
+%<latexrelease> \cs_gset_eq:cc { mv@#1@frozen }{ mv@#1 }
+%<latexrelease> \tl_gset:cx { g__nfss_frozen_mv_ #1 _tl }{ \int_use:c { c@mv@#1 } }
+%<latexrelease> \group_insert_after:N \__nfss_init_mv_freeze:N
+%<latexrelease> \exp_after:wN \group_insert_after:N \cs:w mv@#1@reset \cs_end:
+%<latexrelease> \tl_gput_right:No \check@mathfonts
+%<latexrelease> {
+%<latexrelease> \exp_after:wN \group_insert_after:N \cs:w mv@#1@reset \cs_end:
+%<latexrelease> }
+%<latexrelease> \cs_gset:cpn{mv@#1@reset}
+%<latexrelease> {
+%<latexrelease> \int_compare:nNnTF { \int_use:c{c@mv@#1} } >
+%<latexrelease> { \tl_use:c{g__nfss_frozen_mv_ #1 _tl} }
+%<latexrelease> {
+%<latexrelease> \@font@info{Undo~ math~ alphabet~ allocation~ in~ version~ #1}
+%<latexrelease> \cs_gset_eq:cc { mv@#1 }{ mv@#1@frozen }
+%<latexrelease> \int_gset:cn { c@mv@#1 }{ \tl_use:c {g__nfss_frozen_mv_ #1 _tl} }
+%<latexrelease> \group_begin:
+%<latexrelease> \cs_set_eq:NN \getanddefine@fonts \use_none:nn
+%<latexrelease> \use:c {mv@#1}
+%<latexrelease> \group_end:
+%<latexrelease> }
+%<latexrelease> {
+%<latexrelease> \@font@info{No~ math~ alphabet~ change~ to~ frozen~ version~ #1}
+%<latexrelease> }
+%<latexrelease> \if@ignore \ignorespaces \fi
+%<latexrelease> }
+%<latexrelease>}
+%<latexrelease>\cs_set_protected:Npn \__nfss_init_mv_freeze:N #1 {%
+%<latexrelease> \mode_if_math:T { \group_insert_after:N \__nfss_init_mv_freeze:N
+%<latexrelease> \group_insert_after:N } #1
+%<latexrelease>}
+%<latexrelease>\ExplSyntaxOff
+%<latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
+% \end{macrocode}
+% \end{macro}
+%
%
% \begin{macro}{\process@table}
% \begin{macrocode}
@@ -868,7 +881,7 @@
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
-%<latexrelease>\IncludeInRelease{2021/11/15}%
+%<latexrelease>\IncludeInRelease{2022/11/01}%
%<latexrelease> {\DeclareMathVersion}{local alphabets}%
\def\DeclareMathVersion#1{%
% \end{macrocode}
@@ -881,6 +894,21 @@
% \begin{macrocode}
\@namedef{g__nfss_frozen_mv_#1_tl}{}%
% \end{macrocode}
+% We also extend \cs{check@mathfonts} to call a version reset (once
+% frozen) after a formula has finished.
+% \changes{v3.1a}{2022/09/17}{New logic for freezing math versions (gh/921)}
+% \begin{macrocode}
+ \expandafter\ifx\csname mv@#1\endcsname \relax
+ \expandafter \g@addto@macro \expandafter \check@mathfonts
+ \expandafter {\expandafter \aftergroup \csname mv@#1@reset\endcsname}%
+% \end{macrocode}
+% Initially this macro does nothing. It is, however, important that
+% it doesn't stop any \cs{ignorespaces}, so we make it expandable
+% and not \cs{relax}.
+% \begin{macrocode}
+ \@namedef{mv@#1@reset}{}%
+ \fi
+% \end{macrocode}
%
% \begin{macrocode}
\expandafter\new@mathversion\csname mv@#1\endcsname}
@@ -890,6 +918,12 @@
% \end{macrocode}
%
% \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2021/11/15}%
+%<latexrelease> {\DeclareMathVersion}{local alphabets}%
+%<latexrelease>\def\DeclareMathVersion#1{%
+%<latexrelease> \@namedef{g__nfss_frozen_mv_#1_tl}{}%
+%<latexrelease> \expandafter\new@mathversion\csname mv@#1\endcsname}
+%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease> {\DeclareMathVersion}{local alphabets}%
%<latexrelease>\def\DeclareMathVersion#1{%
@@ -963,8 +997,24 @@
% \end{macro}
%
% \begin{macro}{\DeclareSymbolFont}
+% First drop any surplus \texttt{m} from the series argument then
+% do what has been done since 1994.
+% \changes{v3.1b}{2022/09/20}{Drop any surplus 'm' in series argument (gh/918)}
% \begin{macrocode}
-\def\DeclareSymbolFont#1#2#3#4#5{%
+%</2ekernel>
+%<*2ekernel|latexrelease>
+%<latexrelease>\IncludeInRelease{2022/11/01}%
+%<latexrelease> {\DeclareSymbolFont}{maybe drop m}%
+\def\DeclareSymbolFont #1#2#3#4#5{%
+ \def\reserved@a{\DeclareSymbolFont@m@dropped{#1}{#2}{#3}}%
+ \edef\reserved@b{#4}%
+ \series@maybe@drop@one@m\reserved@b\reserved@b
+ \expandafter\reserved@a\expandafter{\reserved@b}{#5}%
+}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\def\DeclareSymbolFont@m@dropped #1#2#3#4#5{%
\@tempswafalse
\edef\reserved@b{#2}%
\def\cdp@elt##1##2##3##4{\def\reserved@c{##1}%
@@ -1018,6 +1068,16 @@
\fi
}
\@onlypreamble\DeclareSymbolFont
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{0000/00/00}%
+%<latexrelease> {\DeclareSymbolFont}{maybe drop m}%
+%<latexrelease>
+%<latexrelease>\let\DeclareSymbolFont\DeclareSymbolFont@m@dropped
+%<latexrelease>\let\DeclareSymbolFont@m@dropped\@undefined
+%<latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
% \end{macrocode}
% \end{macro}
%
@@ -1054,8 +1114,24 @@
% \end{macro}
%
% \begin{macro}{\SetSymbolFont}
+% First drop any surplus \texttt{m} from the series argument then
+% do what has been done since 1994.
+% \changes{v3.1b}{2022/09/20}{Drop any surplus 'm' in series argument (gh/918)}
% \begin{macrocode}
-\def\SetSymbolFont#1#2#3#4#5#6{%
+%</2ekernel>
+%<*2ekernel|latexrelease>
+%<latexrelease>\IncludeInRelease{2022/11/01}%
+%<latexrelease> {\SetSymbolFont}{maybe drop m}%
+\def\SetSymbolFont #1#2#3#4#5#6{%
+ \def\reserved@a{\SetSymbolFont@m@dropped{#1}{#2}{#3}{#4}}%
+ \edef\reserved@b{#5}%
+ \series@maybe@drop@one@m\reserved@b\reserved@b
+ \expandafter\reserved@a\expandafter{\reserved@b}{#6}%
+}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\def\SetSymbolFont@m@dropped#1#2#3#4#5#6{%
\@tempswafalse
\edef\reserved@b{#3}%
\def\cdp@elt##1##2##3##4{\def\reserved@c{##1}%
@@ -1070,6 +1146,16 @@
\fi
}
\@onlypreamble\SetSymbolFont
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{0000/00/00}%
+%<latexrelease> {\SetSymbolFont}{maybe drop m}%
+%<latexrelease>
+%<latexrelease>\let\SetSymbolFont\SetSymbolFont@m@dropped
+%<latexrelease>\let\SetSymbolFont@m@dropped\@undefined
+%<latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
% \end{macrocode}
% \end{macro}
%