[latex3-commits] [latex3/latex2e] develop: Gh1101 fix localmathalphabets (#1570) (051cfdb27)

github at latex-project.org github at latex-project.org
Sat Nov 30 18:01:24 CET 2024


Repository : https://github.com/latex3/latex2e
On branch  : develop
Link       : https://github.com/latex3/latex2e/commit/051cfdb27893aac8f5723c06404c16f132384299

>---------------------------------------------------------------

commit 051cfdb27893aac8f5723c06404c16f132384299
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Sat Nov 30 18:01:24 2024 +0100

    Gh1101 fix localmathalphabets (#1570)
    
    * draft for #1101
    
    * reset top-level alphabets only for the current math version
    
    * no resetting happens in TU engines
    
    * message only when not resetting top-level defs
    
    * slightly different implementation for bold inside normal
    
    * typo
    
    * add news entry and change a tracing info
    
    * add a few \changes entries
    
    * Update base/ltfssdcl.dtx
    
    Co-authored-by: David Carlisle <d.p.carlisle at gmail.com>
    
    * docu adjustments after review
    
    ---------
    
    Co-authored-by: David Carlisle <d.p.carlisle at gmail.com>


>---------------------------------------------------------------

051cfdb27893aac8f5723c06404c16f132384299
 base/changes.txt                      |  6 +++
 base/doc/ltnews41.tex                 | 34 ++++++++++----
 base/ltfssbas.dtx                     | 62 +++++++++++++++++++++++---
 base/ltfssdcl.dtx                     | 52 ++++++++++++++++++----
 base/testfiles/github-1028.luatex.tlg | 80 ++++++++++++++++++++++++++++++++-
 base/testfiles/github-1028.lvt        | 14 +++++-
 base/testfiles/github-1028.tlg        | 84 +++++++++++++++++++++++++++++++++--
 base/testfiles/github-1028.xetex.tlg  | 70 ++++++++++++++++++++++++++++-
 base/testfiles/github-1101.luatex.tlg | 32 +++++++++++++
 base/testfiles/github-1101.lvt        | 43 ++++++++++++++++++
 base/testfiles/github-1101.tlg        | 37 +++++++++++++++
 base/testfiles/github-1101.xetex.tlg  | 32 +++++++++++++
 12 files changed, 515 insertions(+), 31 deletions(-)

diff --git a/base/changes.txt b/base/changes.txt
index 2eccbc5d8..c381e020f 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -6,6 +6,12 @@ to completeness or accuracy and it contains some references to files that are
 not part of the distribution.
 ================================================================================
 
+2024-11-27  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
+
+	* ltfssdcl.dtx (section{Interface Commands}):
+	Reset top-level alphabet definitions
+        only for the current math version (gh/1101 and gh/1028)
+
 2024-11-27  Yukai Chou  <muzimuzhi at gmail.com>
 	* clsguide.tex:
 	Add opt-arg to syntax of \Make...case
diff --git a/base/doc/ltnews41.tex b/base/doc/ltnews41.tex
index 1bc7562c3..85be7ba21 100644
--- a/base/doc/ltnews41.tex
+++ b/base/doc/ltnews41.tex
@@ -229,11 +229,27 @@ finally changed.
 
 \section{Bug fixes}
 
-%\subsection{A fix}
-
-%% Some text
+\subsection{Fix the use of  \texttt{localmathalpabets}}
+
+In 2021 we introduced a method to overcome the problem that classic
+\TeX{} engines (but not the Unicode engines) have only a limited
+number of math alphabets available that got easily fill up simply by
+loading math font packages, even if their symbols got used only
+occasionally. The idea was to avoid allocating all math alphabets
+globally, but instead allow a number of them (defined by counter
+\texttt{localmathalpabets}) to vary from one formula to the next. This
+way different formulas can make use of different alphabets and chances
+are much higher that the processing a complex the document succeeds.
+See~\cite{41:ltnews34} for details.
+
+Unfortunately, the approach taken failed in some cases of nested
+formulas with the result that the wrong symbol glyphs were used.
+This has now been corrected.
 %
-%%\githubissue{XXXX}
+\githubissue[s]{1101 1028}
+
+
+
 
 %\section{Changes to packages in the \pkg{amsmath} category}
 
@@ -270,17 +286,17 @@ Leslie Lamport.
 \newblock Reprinted with corrections in 1996.
 
 \bibitem{41:ltnews} \LaTeX{} Project Team.
-  \emph{\LaTeXe{} news 1--39}. June, 2024.
+  \emph{\LaTeXe{} news 1--41}. June, 2025.
   \url{https://latex-project.org/news/latex2e-news/ltnews.pdf}
 
+\bibitem{41:ltnews34} \LaTeX{} Project Team.
+  \emph{\LaTeXe{} news 34}. November 2021.
+  \url{https://latex-project.org/news/latex2e-news/ltnews34.pdf}
+
 \bibitem{41:ltnews35} \LaTeX{} Project Team.
   \emph{\LaTeXe{} news 35}. June 2022.
   \url{https://latex-project.org/news/latex2e-news/ltnews35.pdf}
 
-\bibitem{41:ltnews38} \LaTeX{} Project Team.
-  \emph{\LaTeXe{} news 38}. November 2023.
-  \url{https://latex-project.org/news/latex2e-news/ltnews38.pdf}
-
 \bibitem{41:ltnews40} \LaTeX{} Project Team.
   \emph{\LaTeXe{} news 40}. November 2024.
   \url{https://latex-project.org/news/latex2e-news/ltnews40.pdf}
diff --git a/base/ltfssbas.dtx b/base/ltfssbas.dtx
index 4e376d376..e913bbefe 100644
--- a/base/ltfssbas.dtx
+++ b/base/ltfssbas.dtx
@@ -35,7 +35,7 @@
 %
 %
 \ProvidesFile{ltfssbas.dtx}
-             [2024/11/19 v3.2n LaTeX Kernel (NFSS Basic Macros)]
+             [2024/11/30 v3.2o LaTeX Kernel (NFSS Basic Macros)]
 % \iffalse
 \documentclass{ltxdoc}
 \begin{document}
@@ -1184,18 +1184,28 @@
 % \changes{v1.2g}{1990/02/16}{\cs{@nomath} added.}
 % \changes{v2.1a}{1994/01/17}{New math font setup}
 % \changes{v3.2l}{2023/04/01}{Reset frozen mathversion gh/1028}
+% \changes{v3.2o}{2024/11/30}{New appoach to
+%    \texttt{localmathalphabets} (gh/1101)}
 %    \begin{macrocode}
 \DeclareRobustCommand\mathversion[1]
          {\@nomath\mathversion
           \expandafter\ifx\csname mv@#1\endcsname\relax
           \@latex at error{Math version `#1' is not defined}\@eha\else
 %    \end{macrocode}
-%  If there has been a frozen math version reset locally. See GH 1028.
-%    \begin{macrocode}
-          \ifcsname mv@\math at version @frozen\endcsname
-            \expandafter\let
-            \csname mv@\math at version @frozen\expandafter\endcsname
-            \csname mv@\math at version\endcsname
+%    If there has been a frozen math version reset unconditionally to
+%    it if we are at \cs{@math at level} one, so that in the typical case
+%    of one bold symbol within the normal version this doesn't
+%    allocate an additional math alphabet.
+%    If if the nesting is deeper we we do nothing, which means
+%    alphabet allocations accumulate until the end of the formula. One
+%    could do slightly better but that would mean keeping track of the
+%    allocations on all levels severately and this is likely to be
+%    overkill in nearly all situations.
+%    \begin{macrocode}
+          \ifcsname mv@#1 at frozen\endcsname
+            \ifnum \@math at level = \@ne
+              \unconditionally at reset@math at version {#1}%
+            \fi
           \fi
 %    \end{macrocode}
 %    \begin{macrocode}
@@ -1220,6 +1230,21 @@
           \aftergroup\glb at settings
           \fi}
 %    \end{macrocode}
+%
+%    Reseting the math version unconditionally means that we have to
+%    copy the frozen version to \verb=\mv@#1= and also reset the
+%    counter \verb=\c at mv@#1= to the number of math alphabets allocated
+%    in the frozen version.
+% \changes{v3.2o}{2024/11/30}{New appoach to
+%    \texttt{localmathalphabets} (gh/1101)}
+%    \begin{macrocode}
+\ExplSyntaxOn
+\cs_new_protected:Npn \unconditionally at reset@math at version #1 {
+   \cs_gset_eq:cc { mv@#1 }{ mv@#1 at frozen }
+   \int_gset:cn { c at mv@#1 }{ \tl_use:c {g__nfss_frozen_mv_ #1 _tl} }
+}
+\ExplSyntaxOff
+%    \end{macrocode}
 % \end{macro}
 % \end{macro}
 %
@@ -1273,6 +1298,14 @@
 %
 %
 
+%  \begin{macro}{\@math at level}
+%    This counter records the nesting level of math within math.
+% \changes{v3.2o}{2024/11/30}{New appoach to
+%    \texttt{localmathalphabets} (gh/1101)}
+%    \begin{macrocode}
+\newcount\@math at level
+%    \end{macrocode}
+%  \end{macro}
 %
 % \begin{macro}{\frozen at everydisplay}
 % \changes{v2.1a}{1994/01/17}{New math font setup}
@@ -1291,6 +1324,8 @@
 % \changes{v3.2k}{2022/07/04}{Ignore spaces if necessary (gh/886)}
 %    The issue with handling of spaces was found in 2022, but it is
 %    really a bug fix for the code added in 2021/11.
+% \changes{v3.2o}{2024/11/30}{New appoach to
+%    \texttt{localmathalphabets} (gh/1101)}
 %    \begin{macrocode}
 %</2ekernel>
 %<latexrelease>\IncludeInRelease{2021/11/15}
@@ -1298,10 +1333,17 @@
 %<*2ekernel|latexrelease>
 \frozen at everydisplay = {%
   \aftergroup\@ignoretrue  \aftergroup\ignorespaces
+%    \end{macrocode}
+%    Record that we entered another math level.
+% \changes{v3.2o}{2024/11/30}{New appoach to
+%    \texttt{localmathalphabets} (gh/1101)}
+%    \begin{macrocode}
+  \advance\@math at level\@ne
   \check at mathfonts
   \the\everydisplay}
 %    \end{macrocode}
 % \end{macro}
+%
 
 
 % \begin{macro}{\frozen at everymath}
@@ -1312,6 +1354,12 @@
 %    \begin{macrocode}
 \frozen at everymath = {%
   \aftergroup\@ignorefalse
+%    \end{macrocode}
+%    Record that we entered another math level.
+% \changes{v3.2o}{2024/11/30}{New appoach to
+%    \texttt{localmathalphabets} (gh/1101)}
+%    \begin{macrocode}
+  \advance\@math at level\@ne
   \check at mathfonts
   \the\everymath}
 %    \end{macrocode}
diff --git a/base/ltfssdcl.dtx b/base/ltfssdcl.dtx
index c88fe6e1b..7695e6740 100644
--- a/base/ltfssdcl.dtx
+++ b/base/ltfssdcl.dtx
@@ -36,7 +36,7 @@
 %
 %
 \ProvidesFile{ltfssdcl.dtx}
-            [2024/11/19 v3.1c LaTeX Kernel (NFSS Declarative Interface)]
+            [2024/11/27 v3.1d LaTeX Kernel (NFSS Declarative Interface)]
 % \iffalse
 \documentclass{ltxdoc}
 \begin{document}
@@ -714,33 +714,67 @@
 %    \begin{macrocode}
   \cs_gset:cpn{mv@#1 at reset}
      {
+%    \end{macrocode}
+%    If we are back at top-level, or more precisely outside of any
+%    (nested) math, we may have to reset the math version back to its
+%    frozen version, if that exists and has fewer alphabets allocated.
+% \changes{v3.1d}{2024/11/27}{Reset math version if necessary (gh/1101 and gh/1028)}
+%    \begin{macrocode}
+       \int_compare:nNnTF \@math at level = 0
+       {
          \int_compare:nNnTF { \int_use:c{c at mv@#1} } > 
                             { \tl_use:c{g__nfss_frozen_mv_ #1 _tl} }
              {
-               \@font at info{Undo~ math~ alphabet~ allocation~ in~ version~ #1}
+               \@font at 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 at frozen }
                \int_gset:cn { c at mv@#1 }{ \tl_use:c {g__nfss_frozen_mv_ #1 _tl} }
 %    \end{macrocode}
-%    But we also should undo changes to the math alphabet
+%    But we also should undo changes to the top-level math alphabet
 %    definitions. We therefore run this code with a modified
 %    definition for \cs{getanddefine at 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 at fonts \use_none:nn
-                 \use:c {mv@#1}
-               \group_end:
+%    However, we do this only if the resetting was for the current
+%    math version, because otherwise we would give the top-level
+%    definitions the values for the last math version being resetted
+%    (e.g., bold if there are just two).
+% \changes{v3.1d}{2024/11/27}{Reset top-level alphabet definitions
+%    only for the current math version (gh/1101 and gh/1028)}
+%    \begin{macrocode}
+               \tl_if_eq:NnTF \math at version {#1}
+               {
+                 \group_begin:
+                   \cs_set_eq:NN \getanddefine at fonts \use_none:nn
+                   \use:c {mv@ \math at version }
+                 \group_end:
+               }
+               {
+%    \end{macrocode}
+%    Once we have hit the boundary and have to revert to the frozen
+%    version that happens quite often, but typically only for the
+%    normal version. Thus, it is better to report only when we do not
+%    revert the top-level definition as this is the exceptional case
+%    and happens only if several math versions are used in parallel.
+%    \begin{macrocode}
+                 \@font at info{ ...~ but~ do~ not~ reset~ the~
+                      top-level~ math~ alphabet~ definitions }
+               }
              }
              {
 %    \end{macrocode}
 %    If there was no change, we report that in the log (but this
 %    branch could go completely).
 %    \begin{macrocode}
-               \@font at info{No~ math~ alphabet~ change~ to~ frozen~ version~ #1}
+               \@font at info{ No~ math~ alphabet~ change~
+                            to~ frozen~ version~ #1 }
              }
+       }
+       {
+         \@font at info{ Nested~ math:~ keeping~ math~ alphabet~
+                      allocation~ in~ 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
diff --git a/base/testfiles/github-1028.luatex.tlg b/base/testfiles/github-1028.luatex.tlg
index 273727a7d..59a6d5f30 100644
--- a/base/testfiles/github-1028.luatex.tlg
+++ b/base/testfiles/github-1028.luatex.tlg
@@ -1,5 +1,8 @@
 This is a generated file for the LaTeX2e validation system.
 Don't change this file in any respect.
+> \mv at normal=macro:
+->\getanddefine at fonts \symoperators \OT1/cmr/m/n \getanddefine at fonts \symletters \OML/cmm/m/it \getanddefine at fonts \symsymbols \OMS/cmsy/m/n \getanddefine at fonts \symlargesymbols \OMX/cmex/m/n \install at mathalphabet \mathbf  {\select at group \mathbf  \M at OT1 \OT1/cmr/bx/n }\install at mathalphabet \mathsf  {\select at group \mathsf  \M at OT1 \OT1/cmss/m/n }\install at mathalphabet \mathit  {\select at group \mathit  \M at OT1 \OT1/cmr/m/it }\install at mathalphabet \mathtt  {\select at group \mathtt  \M at OT1 \OT1/cmtt/m/n }\getanddefine at fonts \symsymbols1 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols2 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols3 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols4 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols5 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols6 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols7 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols8 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols9 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols10 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols11 \OMS/cmsy/m/n .
+l. ...\makeatletter \show\mv at normal
 LaTeX Font Info:    External font `cmex10' loaded for size
 (Font)              <7> on input line ....
 LaTeX Font Info:    External font `cmex10' loaded for size
@@ -14,7 +17,7 @@ Completed box being shipped out [1]
 ....\hbox(0.0+0.0)x345.0, direction TLT
 ..\glue 25.0
 ..\glue(\lineskip) 0.0
-..\vbox(550.0+0.0)x345.0, glue set 515.94489fil, direction TLT
+..\vbox(550.0+0.0)x345.0, glue set 491.94745fil, direction TLT
 ...\write-{}
 ...\glue(\topskip) 3.05556
 ...\hbox(6.94444+1.25)x345.0, glue set 317.63885fil, direction TLT
@@ -78,6 +81,81 @@ Completed box being shipped out [1]
 ....\penalty 10000
 ....\glue(\parfillskip) 0.0 plus 1.0fil
 ....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\parskip) 0.0
+...\glue(\baselineskip) 3.80556
+...\hbox(6.94444+1.94444)x345.0, glue set 217.0282fil, direction TLT
+....\localpar
+.....\localinterlinepenalty=0
+.....\localbrokenpenalty=0
+.....\localleftbox=null
+.....\localrightbox=null
+....\hbox(0.0+0.0)x15.0, direction TLT
+....\mathon
+....\OML/cmm/m/it/10 Q
+....\OT1/cmr/m/n/10 5
+....\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217
+....\OT1/cmr/m/n/10 +
+....\penalty 700
+....\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217
+....\hbox(6.94444+0.0)x27.92513, direction TLT
+.....\mathon
+.....\hbox(6.94444+0.0)x27.92513, direction TLT
+......\OT1/cmss/bx/n/10 b
+......\kern0.30556 (font)
+......\OT1/cmss/bx/n/10 o
+......\OT1/cmss/bx/n/10 l
+......\OT1/cmss/bx/n/10 d
+......\OT1/cmss/bx/n/10 s
+......\OT1/cmss/bx/n/10 f
+......\kern0.7639 (italic)
+.....\mathoff
+....\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217
+....\OT1/cmr/m/n/10 +
+....\penalty 700
+....\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217
+....\hbox(6.94444+0.0)x27.89136, direction TLT
+.....\mathon
+.....\hbox(6.94444+0.0)x27.89136, direction TLT
+......\OT1/cmr/bx/it/10 b
+......\kern-0.5889 (font)
+......\OT1/cmr/bx/it/10 o
+......\OT1/cmr/bx/it/10 l
+......\OT1/cmr/bx/it/10 d
+......\OT1/cmr/bx/it/10 i
+......\OT1/cmr/bx/it/10 t
+......\kern0.9639 (italic)
+.....\mathoff
+....\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217
+....\OT1/cmr/m/n/10 +
+....\penalty 700
+....\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217
+....\hbox(6.94444+0.0)x7.58334, direction TLT
+.....\OT1/cmss/m/n/10 s
+.....\OT1/cmss/m/n/10 f
+.....\kern0.69444 (italic)
+....\mathoff
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\parskip) 0.0
+...\glue(\baselineskip) 3.11111
+...\hbox(6.94444+1.25)x345.0, glue set 317.63885fil, direction TLT
+....\localpar
+.....\localinterlinepenalty=0
+.....\localbrokenpenalty=0
+.....\localleftbox=null
+.....\localrightbox=null
+....\hbox(0.0+0.0)x15.0, direction TLT
+....\mathon
+....\hbox(6.94444+1.25)x12.36113, direction TLT
+.....\OT1/cmss/m/n/10 Q
+.....\OT1/cmss/m/n/10 7
+....\mathoff
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
 ...\glue -1.25
 ...\glue 0.0 plus 1.0fil
 ...\glue 0.0
diff --git a/base/testfiles/github-1028.lvt b/base/testfiles/github-1028.lvt
index f50f46864..14c4cfa2e 100644
--- a/base/testfiles/github-1028.lvt
+++ b/base/testfiles/github-1028.lvt
@@ -22,11 +22,12 @@
 
 \begin{document}
 
-
 \showoutput
 
 \START
 
+\makeatletter \show\mv at normal
+
 $\mathsf{Q1}$
 
 % Q2 should not be bold
@@ -39,4 +40,15 @@ $
 
 $\mathsf{Q4}$
 
+$
+%\mathtt{tt}
+Q5 +
+\mbox{\boldmath $\mathsf{bold sf}$}
++
+\mbox{\boldmath $\mathit{bold it}$}
++
+\mathsf{sf}
+$
+
+$\mathsf{Q7}$
 \end{document}
diff --git a/base/testfiles/github-1028.tlg b/base/testfiles/github-1028.tlg
index 5f3029f56..d8a38aac2 100644
--- a/base/testfiles/github-1028.tlg
+++ b/base/testfiles/github-1028.tlg
@@ -1,5 +1,8 @@
 This is a generated file for the LaTeX2e validation system.
 Don't change this file in any respect.
+> \mv at normal=macro:
+->\getanddefine at fonts \symoperators \OT1/cmr/m/n \getanddefine at fonts \symletters \OML/cmm/m/it \getanddefine at fonts \symsymbols \OMS/cmsy/m/n \getanddefine at fonts \symlargesymbols \OMX/cmex/m/n \install at mathalphabet \mathbf  {\select at group \mathbf  \M at OT1 \OT1/cmr/bx/n }\install at mathalphabet \mathsf  {\select at group \mathsf  \M at OT1 \OT1/cmss/m/n }\install at mathalphabet \mathit  {\select at group \mathit  \M at OT1 \OT1/cmr/m/it }\install at mathalphabet \mathtt  {\select at group \mathtt  \M at OT1 \OT1/cmtt/m/n }\getanddefine at fonts \symsymbols1 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols2 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols3 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols4 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols5 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols6 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols7 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols8 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols9 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols10 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols11 \OMS/cmsy/m/n .
+l. ...\makeatletter \show\mv at normal
 LaTeX Font Info:    External font `cmex10' loaded for size
 (Font)              <7> on input line ....
 LaTeX Font Info:    External font `cmex10' loaded for size
@@ -9,11 +12,21 @@ LaTeX Font Info:    Freeze math alphabet allocation in version normal.
 LaTeX Font Info:    Undo math alphabet allocation in version normal on input line ....
 LaTeX Font Info:    Freeze math alphabet allocation in version bold.
 (Font)              Allocated math groups: 15 (local: 2) on input line ....
+LaTeX Font Info:    Nested math: keeping math alphabet allocation in version normal on input line ....
+LaTeX Font Info:    Nested math: keeping math alphabet allocation in version bold on input line ....
 LaTeX Font Info:    Undo math alphabet allocation in version normal on input line ....
 LaTeX Font Info:    Undo math alphabet allocation in version bold on input line ....
-LaTeX Font Info:    No math alphabet change to frozen version normal on input line ....
+LaTeX Font Info:    ... but do not reset the top-level math alphabet definitions on input line ....
+LaTeX Font Info:    Undo math alphabet allocation in version normal on input line ....
 LaTeX Font Info:    No math alphabet change to frozen version bold on input line ....
-LaTeX Font Info:    No math alphabet change to frozen version normal on input line ....
+LaTeX Font Info:    Nested math: keeping math alphabet allocation in version normal on input line ....
+LaTeX Font Info:    Nested math: keeping math alphabet allocation in version bold on input line ....
+LaTeX Font Info:    Nested math: keeping math alphabet allocation in version normal on input line ....
+LaTeX Font Info:    Nested math: keeping math alphabet allocation in version bold on input line ....
+LaTeX Font Info:    Undo math alphabet allocation in version normal on input line ....
+LaTeX Font Info:    Undo math alphabet allocation in version bold on input line ....
+LaTeX Font Info:    ... but do not reset the top-level math alphabet definitions on input line ....
+LaTeX Font Info:    Undo math alphabet allocation in version normal on input line ....
 LaTeX Font Info:    No math alphabet change to frozen version bold on input line ....
 Completed box being shipped out [1]
 \vbox(633.0+0.0)x407.0
@@ -25,7 +38,7 @@ Completed box being shipped out [1]
 ....\hbox(0.0+0.0)x345.0
 ..\glue 25.0
 ..\glue(\lineskip) 0.0
-..\vbox(550.0+0.0)x345.0, glue set 515.94489fil
+..\vbox(550.0+0.0)x345.0, glue set 491.94745fil
 ...\write-{}
 ...\glue(\topskip) 3.05556
 ...\hbox(6.94444+1.25)x345.0, glue set 317.63887fil
@@ -74,6 +87,71 @@ Completed box being shipped out [1]
 ....\penalty 10000
 ....\glue(\parfillskip) 0.0 plus 1.0fil
 ....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\parskip) 0.0
+...\glue(\baselineskip) 3.80556
+...\hbox(6.94444+1.94444)x345.0, glue set 217.0282fil
+....\hbox(0.0+0.0)x15.0
+....\mathon
+....\OML/cmm/m/it/10 Q
+....\OT1/cmr/m/n/10 5
+....\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217
+....\OT1/cmr/m/n/10 +
+....\penalty 700
+....\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217
+....\hbox(6.94444+0.0)x27.92513
+.....\mathon
+.....\hbox(6.94444+0.0)x27.92513
+......\OT1/cmss/bx/n/10 b
+......\kern0.30556
+......\OT1/cmss/bx/n/10 o
+......\OT1/cmss/bx/n/10 l
+......\OT1/cmss/bx/n/10 d
+......\OT1/cmss/bx/n/10 s
+......\OT1/cmss/bx/n/10 f
+......\kern0.7639
+.....\mathoff
+....\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217
+....\OT1/cmr/m/n/10 +
+....\penalty 700
+....\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217
+....\hbox(6.94444+0.0)x27.89136
+.....\mathon
+.....\hbox(6.94444+0.0)x27.89136
+......\OT1/cmr/bx/it/10 b
+......\kern-0.5889
+......\OT1/cmr/bx/it/10 o
+......\OT1/cmr/bx/it/10 l
+......\OT1/cmr/bx/it/10 d
+......\OT1/cmr/bx/it/10 i
+......\OT1/cmr/bx/it/10 t
+......\kern0.9639
+.....\mathoff
+....\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217
+....\OT1/cmr/m/n/10 +
+....\penalty 700
+....\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217
+....\hbox(6.94444+0.0)x7.58334
+.....\OT1/cmss/m/n/10 s
+.....\OT1/cmss/m/n/10 f
+.....\kern0.69444
+....\mathoff
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\parskip) 0.0
+...\glue(\baselineskip) 3.11111
+...\hbox(6.94444+1.25)x345.0, glue set 317.63887fil
+....\hbox(0.0+0.0)x15.0
+....\mathon
+....\hbox(6.94444+1.25)x12.36113
+.....\OT1/cmss/m/n/10 Q
+.....\OT1/cmss/m/n/10 7
+....\mathoff
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
 ...\glue -1.25
 ...\glue 0.0 plus 1.0fil
 ...\glue 0.0
diff --git a/base/testfiles/github-1028.xetex.tlg b/base/testfiles/github-1028.xetex.tlg
index 91d3256a2..18dababe7 100644
--- a/base/testfiles/github-1028.xetex.tlg
+++ b/base/testfiles/github-1028.xetex.tlg
@@ -1,5 +1,8 @@
 This is a generated file for the LaTeX2e validation system.
 Don't change this file in any respect.
+> \mv at normal=macro:
+->\getanddefine at fonts \symoperators \OT1/cmr/m/n \getanddefine at fonts \symletters \OML/cmm/m/it \getanddefine at fonts \symsymbols \OMS/cmsy/m/n \getanddefine at fonts \symlargesymbols \OMX/cmex/m/n \install at mathalphabet \mathbf  {\select at group \mathbf  \M at OT1 \OT1/cmr/bx/n }\install at mathalphabet \mathsf  {\select at group \mathsf  \M at OT1 \OT1/cmss/m/n }\install at mathalphabet \mathit  {\select at group \mathit  \M at OT1 \OT1/cmr/m/it }\install at mathalphabet \mathtt  {\select at group \mathtt  \M at OT1 \OT1/cmtt/m/n }\getanddefine at fonts \symsymbols1 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols2 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols3 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols4 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols5 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols6 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols7 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols8 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols9 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols10 \OMS/cmsy/m/n \getanddefine at fonts \symsymbols11 \OMS/cmsy/m/n .
+l. ...\makeatletter \show\mv at normal
 LaTeX Font Info:    External font `cmex10' loaded for size
 (Font)              <7> on input line ....
 LaTeX Font Info:    External font `cmex10' loaded for size
@@ -14,7 +17,7 @@ Completed box being shipped out [1]
 ....\hbox(0.0+0.0)x345.0
 ..\glue 25.0
 ..\glue(\lineskip) 0.0
-..\vbox(550.0+0.0)x345.0, glue set 515.94489fil
+..\vbox(550.0+0.0)x345.0, glue set 491.94745fil
 ...\write-{}
 ...\glue(\topskip) 3.05556
 ...\hbox(6.94444+1.25)x345.0, glue set 317.63887fil
@@ -63,6 +66,71 @@ Completed box being shipped out [1]
 ....\penalty 10000
 ....\glue(\parfillskip) 0.0 plus 1.0fil
 ....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\parskip) 0.0
+...\glue(\baselineskip) 3.80556
+...\hbox(6.94444+1.94444)x345.0, glue set 217.0282fil
+....\hbox(0.0+0.0)x15.0
+....\mathon
+....\OML/cmm/m/it/10 Q
+....\OT1/cmr/m/n/10 5
+....\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217
+....\OT1/cmr/m/n/10 +
+....\penalty 700
+....\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217
+....\hbox(6.94444+0.0)x27.92513
+.....\mathon
+.....\hbox(6.94444+0.0)x27.92513
+......\OT1/cmss/bx/n/10 b
+......\kern0.30556
+......\OT1/cmss/bx/n/10 o
+......\OT1/cmss/bx/n/10 l
+......\OT1/cmss/bx/n/10 d
+......\OT1/cmss/bx/n/10 s
+......\OT1/cmss/bx/n/10 f
+......\kern0.7639
+.....\mathoff
+....\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217
+....\OT1/cmr/m/n/10 +
+....\penalty 700
+....\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217
+....\hbox(6.94444+0.0)x27.89136
+.....\mathon
+.....\hbox(6.94444+0.0)x27.89136
+......\OT1/cmr/bx/it/10 b
+......\kern-0.5889
+......\OT1/cmr/bx/it/10 o
+......\OT1/cmr/bx/it/10 l
+......\OT1/cmr/bx/it/10 d
+......\OT1/cmr/bx/it/10 i
+......\OT1/cmr/bx/it/10 t
+......\kern0.9639
+.....\mathoff
+....\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217
+....\OT1/cmr/m/n/10 +
+....\penalty 700
+....\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217
+....\hbox(6.94444+0.0)x7.58334
+.....\OT1/cmss/m/n/10 s
+.....\OT1/cmss/m/n/10 f
+.....\kern0.69444
+....\mathoff
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\parskip) 0.0
+...\glue(\baselineskip) 3.11111
+...\hbox(6.94444+1.25)x345.0, glue set 317.63887fil
+....\hbox(0.0+0.0)x15.0
+....\mathon
+....\hbox(6.94444+1.25)x12.36113
+.....\OT1/cmss/m/n/10 Q
+.....\OT1/cmss/m/n/10 7
+....\mathoff
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
 ...\glue -1.25
 ...\glue 0.0 plus 1.0fil
 ...\glue 0.0
diff --git a/base/testfiles/github-1101.luatex.tlg b/base/testfiles/github-1101.luatex.tlg
new file mode 100644
index 000000000..6b2b399f6
--- /dev/null
+++ b/base/testfiles/github-1101.luatex.tlg
@@ -0,0 +1,32 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+> \mv at normal=macro:
+->\getanddefine at fonts \symoperators \OT1/cmr/m/n \getanddefine at fonts \symletters \OML/cmm/m/it \getanddefine at fonts \symsymbols \OMS/cmsy/m/n \getanddefine at fonts \symlargesymbols \OMX/cmex/m/n \install at mathalphabet \mathbf  {\select at group \mathbf  \M at OT1 \OT1/cmr/bx/n }\install at mathalphabet \mathsf  {\select at group \mathsf  \M at OT1 \OT1/cmss/m/n }\install at mathalphabet \mathit  {\select at group \mathit  \M at OT1 \OT1/cmr/m/it }\install at mathalphabet \mathtt  {\select at group \mathtt  \M at OT1 \OT1/cmtt/m/n }\getanddefine at fonts \symabc1 \OT1/cmr/m/n \getanddefine at fonts \symabc2 \OT1/cmr/m/n \getanddefine at fonts \symabc3 \OT1/cmr/m/n \getanddefine at fonts \symabc4 \OT1/cmr/m/n \getanddefine at fonts \symabc5 \OT1/cmr/m/n \getanddefine at fonts \symabc6 \OT1/cmr/m/n \getanddefine at fonts \symabc7 \OT1/cmr/m/n \getanddefine at fonts \symabc8 \OT1/cmr/m/n \getanddefine at fonts \symabc9 \OT1/cmr/m/n \getanddefine at fonts \symabca \OT1/cmr/m/n \install at mathalphabet \mathscr  {\select at group \mathscr  \M at OT1 \OT1/cmr/m/it }\install at mathalphabet \mathfrak  {\select at group \mathfrak  \M at T1 \T1/lmss/m/n }.
+l. ...\show\mv at normal
+> \nullfont .
+\x #1->\showthe \textfont 14 
+l. ...\x0
+LaTeX Font Info:    External font `cmex10' loaded for size
+(Font)              <7> on input line ....
+LaTeX Font Info:    External font `cmex10' loaded for size
+(Font)              <5> on input line ....
+> \OT1/cmr/m/it/10 .
+\x #1->\showthe \textfont 14 
+l. ...   $M\x1
+           $\x2
+> \OT1/cmr/m/it/10 .
+\x #1->\showthe \textfont 14 
+l. ...   $M\x1$\x2
+LaTeX Font Info:    Trying to load font information for T1+lmss on input line ....
+> \OT1/cmr/m/it/10 .
+\x #1->\showthe \textfont 14 
+l. ... \mathfrak{p}\x3
+                   $
+> \OT1/cmr/m/it/10 .
+\x #1->\showthe \textfont 14 
+l. ...\x4
+> \OT1/cmr/m/it/10 .
+\x #1->\showthe \textfont 14 
+l. ...\x5
+[1
+]
diff --git a/base/testfiles/github-1101.lvt b/base/testfiles/github-1101.lvt
new file mode 100644
index 000000000..353ada4cb
--- /dev/null
+++ b/base/testfiles/github-1101.lvt
@@ -0,0 +1,43 @@
+\documentclass{article}
+
+\input{test2e}
+
+\DeclareSymbolFont{abc1}{OT1}{cmr}{m}{n}
+\DeclareSymbolFont{abc2}{OT1}{cmr}{m}{n}
+\DeclareSymbolFont{abc3}{OT1}{cmr}{m}{n}
+\DeclareSymbolFont{abc4}{OT1}{cmr}{m}{n}
+\DeclareSymbolFont{abc5}{OT1}{cmr}{m}{n}
+\DeclareSymbolFont{abc6}{OT1}{cmr}{m}{n}
+\DeclareSymbolFont{abc7}{OT1}{cmr}{m}{n}
+\DeclareSymbolFont{abc8}{OT1}{cmr}{m}{n}
+\DeclareSymbolFont{abc9}{OT1}{cmr}{m}{n}
+\DeclareSymbolFont{abca}{OT1}{cmr}{m}{n}
+\DeclareMathAlphabet\mathscr{OT1}{cmr}{m}{it}
+\DeclareMathAlphabet\mathfrak{T1}{lmss}{m}{n}
+
+\def\x#1{\showthe\textfont14 }
+
+\begin{document}
+
+\START
+
+\makeatletter
+
+\show\mv at normal
+
+% incorrect
+\x0
+$\mathscr{F}_x
+ \hbox{
+   $M\x1$\x2
+ }
+ \mathfrak{p}\x3$
+\x4
+
+% correct
+$\mathscr{F}_x M \mathfrak{p}$
+\x5
+
+\newpage
+\OMIT
+\end{document}
diff --git a/base/testfiles/github-1101.tlg b/base/testfiles/github-1101.tlg
new file mode 100644
index 000000000..8ff869fc9
--- /dev/null
+++ b/base/testfiles/github-1101.tlg
@@ -0,0 +1,37 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+> \mv at normal=macro:
+->\getanddefine at fonts \symoperators \OT1/cmr/m/n \getanddefine at fonts \symletters \OML/cmm/m/it \getanddefine at fonts \symsymbols \OMS/cmsy/m/n \getanddefine at fonts \symlargesymbols \OMX/cmex/m/n \install at mathalphabet \mathbf  {\select at group \mathbf  \M at OT1 \OT1/cmr/bx/n }\install at mathalphabet \mathsf  {\select at group \mathsf  \M at OT1 \OT1/cmss/m/n }\install at mathalphabet \mathit  {\select at group \mathit  \M at OT1 \OT1/cmr/m/it }\install at mathalphabet \mathtt  {\select at group \mathtt  \M at OT1 \OT1/cmtt/m/n }\getanddefine at fonts \symabc1 \OT1/cmr/m/n \getanddefine at fonts \symabc2 \OT1/cmr/m/n \getanddefine at fonts \symabc3 \OT1/cmr/m/n \getanddefine at fonts \symabc4 \OT1/cmr/m/n \getanddefine at fonts \symabc5 \OT1/cmr/m/n \getanddefine at fonts \symabc6 \OT1/cmr/m/n \getanddefine at fonts \symabc7 \OT1/cmr/m/n \getanddefine at fonts \symabc8 \OT1/cmr/m/n \getanddefine at fonts \symabc9 \OT1/cmr/m/n \getanddefine at fonts \symabca \OT1/cmr/m/n \install at mathalphabet \mathscr  {\select at group \mathscr  \M at OT1 \OT1/cmr/m/it }\install at mathalphabet \mathfrak  {\select at group \mathfrak  \M at T1 \T1/lmss/m/n }.
+l. ...\show\mv at normal
+> \nullfont .
+\x #1->\showthe \textfont 14 
+l. ...\x0
+LaTeX Font Info:    External font `cmex10' loaded for size
+(Font)              <7> on input line ....
+LaTeX Font Info:    External font `cmex10' loaded for size
+(Font)              <5> on input line ....
+LaTeX Font Info:    Freeze math alphabet allocation in version normal.
+(Font)              Allocated math groups: 14 (local: 2) on input line ....
+> \OT1/cmr/m/it/10 .
+\x #1->\showthe \textfont 14 
+l. ...   $M\x1
+             $\x2
+LaTeX Font Info:    Nested math: keeping math alphabet allocation in version normal on input line ....
+> \OT1/cmr/m/it/10 .
+\x #1->\showthe \textfont 14 
+l. ...   $M\x1$\x2
+LaTeX Font Info:    Trying to load font information for T1+lmss on input line ....
+> \OT1/cmr/m/it/10 .
+\x #1->\showthe \textfont 14 
+l. ... \mathfrak{p}\x3
+                     $
+LaTeX Font Info:    Undo math alphabet allocation in version normal on input line ....
+> \OT1/cmr/m/it/10 .
+\x #1->\showthe \textfont 14 
+l. ...\x4
+LaTeX Font Info:    Undo math alphabet allocation in version normal on input line ....
+> \OT1/cmr/m/it/10 .
+\x #1->\showthe \textfont 14 
+l. ...\x5
+[1
+]
diff --git a/base/testfiles/github-1101.xetex.tlg b/base/testfiles/github-1101.xetex.tlg
new file mode 100644
index 000000000..f73f102af
--- /dev/null
+++ b/base/testfiles/github-1101.xetex.tlg
@@ -0,0 +1,32 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+> \mv at normal=macro:
+->\getanddefine at fonts \symoperators \OT1/cmr/m/n \getanddefine at fonts \symletters \OML/cmm/m/it \getanddefine at fonts \symsymbols \OMS/cmsy/m/n \getanddefine at fonts \symlargesymbols \OMX/cmex/m/n \install at mathalphabet \mathbf  {\select at group \mathbf  \M at OT1 \OT1/cmr/bx/n }\install at mathalphabet \mathsf  {\select at group \mathsf  \M at OT1 \OT1/cmss/m/n }\install at mathalphabet \mathit  {\select at group \mathit  \M at OT1 \OT1/cmr/m/it }\install at mathalphabet \mathtt  {\select at group \mathtt  \M at OT1 \OT1/cmtt/m/n }\getanddefine at fonts \symabc1 \OT1/cmr/m/n \getanddefine at fonts \symabc2 \OT1/cmr/m/n \getanddefine at fonts \symabc3 \OT1/cmr/m/n \getanddefine at fonts \symabc4 \OT1/cmr/m/n \getanddefine at fonts \symabc5 \OT1/cmr/m/n \getanddefine at fonts \symabc6 \OT1/cmr/m/n \getanddefine at fonts \symabc7 \OT1/cmr/m/n \getanddefine at fonts \symabc8 \OT1/cmr/m/n \getanddefine at fonts \symabc9 \OT1/cmr/m/n \getanddefine at fonts \symabca \OT1/cmr/m/n \install at mathalphabet \mathscr  {\select at group \mathscr  \M at OT1 \OT1/cmr/m/it }\install at mathalphabet \mathfrak  {\select at group \mathfrak  \M at T1 \T1/lmss/m/n }.
+l. ...\show\mv at normal
+> \nullfont .
+\x #1->\showthe \textfont 14 
+l. ...\x0
+LaTeX Font Info:    External font `cmex10' loaded for size
+(Font)              <7> on input line ....
+LaTeX Font Info:    External font `cmex10' loaded for size
+(Font)              <5> on input line ....
+> \OT1/cmr/m/it/10 .
+\x #1->\showthe \textfont 14 
+l. ...   $M\x1
+             $\x2
+> \OT1/cmr/m/it/10 .
+\x #1->\showthe \textfont 14 
+l. ...   $M\x1$\x2
+LaTeX Font Info:    Trying to load font information for T1+lmss on input line ....
+> \OT1/cmr/m/it/10 .
+\x #1->\showthe \textfont 14 
+l. ... \mathfrak{p}\x3
+                     $
+> \OT1/cmr/m/it/10 .
+\x #1->\showthe \textfont 14 
+l. ...\x4
+> \OT1/cmr/m/it/10 .
+\x #1->\showthe \textfont 14 
+l. ...\x5
+[1
+]





More information about the latex3-commits mailing list.