texlive[52136] Master/texmf-dist: mathastext (20sep19)

commits+karl at tug.org commits+karl at tug.org
Fri Sep 20 23:33:41 CEST 2019


Revision: 52136
          http://tug.org/svn/texlive?view=revision&revision=52136
Author:   karl
Date:     2019-09-20 23:33:41 +0200 (Fri, 20 Sep 2019)
Log Message:
-----------
mathastext (20sep19)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/mathastext/ChangeLog.md
    trunk/Master/texmf-dist/doc/latex/mathastext/README.md
    trunk/Master/texmf-dist/doc/latex/mathastext/mathastext.pdf
    trunk/Master/texmf-dist/doc/latex/mathastext/mathastexttestalphabets.pdf
    trunk/Master/texmf-dist/source/latex/mathastext/mathastext.dtx
    trunk/Master/texmf-dist/tex/latex/mathastext/mathastext.sty

Modified: trunk/Master/texmf-dist/doc/latex/mathastext/ChangeLog.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/mathastext/ChangeLog.md	2019-09-20 21:33:28 UTC (rev 52135)
+++ trunk/Master/texmf-dist/doc/latex/mathastext/ChangeLog.md	2019-09-20 21:33:41 UTC (rev 52136)
@@ -1,6 +1,55 @@
 MATHASTEXT CHANGE LOG
 =====================
 
+1.3v \[2019/09/19\]
+----
+
+* LaTeX 2019-10-01 release has made more math macros robust.
+  This applies in particular to the math accents and to the
+  `\hbar`. This required for mathastext to adapt. Also
+  `\leftarrowfill` and `\rightarrowfill` are now defined
+  robust by the kernel, hence mathastext does the same. These
+  changes are dropped if mathastext detects an older LaTeX
+  format.
+
+* These LaTeX kernel changes motivated an examination of some
+  redefinitions done (optionally) by mathastext:
+
+  - The user math alphabet macros got redefined as expanding
+  to some other (robust) math alphabet macros, but were not
+  robust in the strict sense. This does cause some issues for
+  moving arguments in the context of multiple math versions,
+  hence it was a bug. The special behaviour of the math
+  alphabet commands (they redefine themselves and other macros
+  on first use) makes is somewhat problematic for mathastext
+  to keep them updated across math versions and at the same
+  time strictly LaTeX2e robust. Thus mathastext now requires
+  the e-TeX primitive `\protected` and uses it for the
+  definitions of the user level math alphabet macros.
+
+  - There are a number of `\mathchardef` tokens which (under
+  certain options and/or configuration via the package user
+  interface), mathastext redefines as macros. These macros
+  cause no issue in moving arguments (they are not "fragile"),
+  still it is probably better if they expand only at the time
+  of typesetting. To this effect they are now also
+  `\protected`: `\exists`, `\forall`, `\colon`, `\setminus`,
+  `\mid`, `\prod`, `\sum`, `\imath`, `\jmath`.
+
+  - The macro `\vert` (which expands to a `\delimiter`) is now
+  defined robust by LaTeX. Its mathastext redefinition is a
+  `\protected` one rather.
+
+  - The `\{` and `\}` (which get redefined only under
+  `\MTexplicitbracesobeymathxx` regime) are now strictly
+  robust in the LaTeX2e sense (formerly they were `\let` to
+  some robust macros, and this did not make them strictly
+  LaTeX2e-robust entities).
+
+* The various changes in mathastext described in the previous item
+  apply independently of the LaTeX release version. The
+  LaTeX format itself requires the e-TeX extensions since 2015.
+
 1.3u \[2019/08/20\]
 ----
 

Modified: trunk/Master/texmf-dist/doc/latex/mathastext/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/mathastext/README.md	2019-09-20 21:33:28 UTC (rev 52135)
+++ trunk/Master/texmf-dist/doc/latex/mathastext/README.md	2019-09-20 21:33:41 UTC (rev 52136)
@@ -14,7 +14,7 @@
 
 Copyright (C) 2011-2019 Jean-Francois Burnol (`jfbu at free dot fr`)
 
-      Source: mathastext.dtx 1.3u 2019/08/20
+      Source: mathastext.dtx 1.3v 2019/09/19
 
 
 DESCRIPTION
@@ -82,6 +82,52 @@
 RECENT CHANGES
 ==============
 
+1.3v \[2019/09/19\]
+----
+
+* LaTeX 2019-10-01 release has made more math macros robust.
+  This applies in particular to the math accents and to the
+  `\hbar`. This required for mathastext to adapt. Also
+  `\leftarrowfill` and `\rightarrowfill` are now defined
+  robust by the kernel, hence mathastext does the same. These
+  changes are dropped if mathastext detects an older LaTeX
+  format.
+
+* These LaTeX kernel changes motivated an examination of some
+  redefinitions done (optionally) by mathastext:
+  - The user math alphabet macros got redefined as expanding
+    to some other (robust) math alphabet macros, but were not
+    robust in the strict sense. This does cause some issues
+    for moving arguments in the context of multiple math
+    versions, hence it was a bug. The special behaviour of the
+    math alphabet commands (they redefine themselves and other
+    macros on first use) makes is somewhat problematic for
+    mathastext to keep them updated across math versions and
+    at the same time strictly LaTeX2e robust. Thus mathastext
+    now requires the e-TeX primitive `\protected` and uses it
+    for the definitions of the user level math alphabet
+    macros.
+  - There are a number of `\mathchardef` tokens which (under
+    certain options and/or configuration via the package user
+    interface), mathastext redefines as macros. These macros
+    cause no issue in moving arguments (they are not
+    "fragile"), still it is probably better if they expand
+    only at the time of typesetting. To this effect they are
+    now also `\protected`: `\exists`, `\forall`, `\colon`,
+    `\setminus`, `\mid`, `\prod`, `\sum`, `\imath`, `\jmath`.
+  - The macro `\vert` (which expands to a `\delimiter`) is now
+    defined robust by LaTeX. Its mathastext redefinition is a
+    `\protected` one rather.
+  - The `\{` and `\}` (which get redefined only under
+    `\MTexplicitbracesobeymathxx` regime) are now strictly
+    robust in the LaTeX2e sense (formerly they were `\let` to
+    some robust macros, and this did not make them strictly
+    LaTeX2e-robust entities).
+
+* The various changes in mathastext described in the previous item
+  apply independently of the LaTeX release version. The
+  LaTeX format itself requires the e-TeX extensions since 2015.
+
 1.3u (2019/08/20)
 ---
 

Modified: trunk/Master/texmf-dist/doc/latex/mathastext/mathastext.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/mathastext/mathastexttestalphabets.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/mathastext/mathastext.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/mathastext/mathastext.dtx	2019-09-20 21:33:28 UTC (rev 52135)
+++ trunk/Master/texmf-dist/source/latex/mathastext/mathastext.dtx	2019-09-20 21:33:41 UTC (rev 52136)
@@ -2,12 +2,12 @@
 % N.B.: this dtx file does NOT use \DocInput, it only uses docstrip.
 % The LaTeX source of the documentation is NOT prefixed with percent characters.
 %<*dtx>
-\def\dtxtimestamp {Time-stamp: <20-08-2019 at 11:13:40 CEST>}%
-\def\docdate{2019/08/20}
+\def\dtxtimestamp {Time-stamp: <19-09-2019 at 22:52:52 CEST>}%
+\def\docdate{2019/09/19}
 %</dtx>
 %<*drv>
-\def\MSTpkgdate    {2019/08/20}
-\def\MSTpkgversion {1.3u}
+\def\MSTpkgdate    {2019/09/19}
+\def\MSTpkgversion {1.3v}
 %</drv>
 %<*dtx>
 \iffalse % meta-comment
@@ -29,7 +29,7 @@
 
 Copyright (C) 2011-2019 Jean-Francois Burnol (`jfbu at free dot fr`)
 
-      Source: mathastext.dtx 1.3u 2019/08/20
+      Source: mathastext.dtx 1.3v 2019/09/19
 
 %</readme>
 %<*dtx>
@@ -45,7 +45,7 @@
 %%----------------------------------------------------------------
 %% Package: mathastext
 %% Info:    Use the text font in math mode (JFB)
-%% Version: 1.3u 2019/08/20
+%% Version: 1.3v 2019/09/19
 %% License: LPPL 1.3c (http://www.latex-project.org/lppl/lppl-1-3c.txt)
 %% Copyright (C) 2011-2019 Jean-Francois Burnol <jfbu at free dot fr>
 %% Examples of use of mathastext:
@@ -193,6 +193,53 @@
 RECENT CHANGES
 ==============
 
+1.3v \[2019/09/19\]
+----
+
+* LaTeX 2019-10-01 release has made more math macros robust.
+  This applies in particular to the math accents and to the
+  `\hbar`. This required for mathastext to adapt. Also
+  `\leftarrowfill` and `\rightarrowfill` are now defined
+  robust by the kernel, hence mathastext does the same. These
+  changes are dropped if mathastext detects an older LaTeX
+  format.
+
+* These LaTeX kernel changes motivated an examination of some
+  redefinitions done (optionally) by mathastext:
+  - The user math alphabet macros got redefined as expanding
+    to some other (robust) math alphabet macros, but were not
+    robust in the strict sense. This does cause some issues
+    for moving arguments in the context of multiple math
+    versions, hence it was a bug. The special behaviour of the
+    math alphabet commands (they redefine themselves and other
+    macros on first use) makes is somewhat problematic for
+    mathastext to keep them updated across math versions and
+    at the same time strictly LaTeX2e robust. Thus mathastext
+    now requires the e-TeX primitive `\protected` and uses it
+    for the definitions of the user level math alphabet
+    macros.
+  - There are a number of `\mathchardef` tokens which (under
+    certain options and/or configuration via the package user
+    interface), mathastext redefines as macros. These macros
+    cause no issue in moving arguments (they are not
+    "fragile"), still it is probably better if they expand
+    only at the time of typesetting. To this effect they are
+    now also `\protected`: `\exists`, `\forall`, `\colon`,
+    `\setminus`, `\mid`, `\prod`, `\sum`, `\imath`, `\jmath`.
+  - The macro `\vert` (which expands to a `\delimiter`) is now
+    defined robust by LaTeX. Its mathastext redefinition is a
+    `\protected` one rather.
+  - The `\{` and `\}` (which get redefined only under
+    `\MTexplicitbracesobeymathxx` regime) are now strictly
+    robust in the LaTeX2e sense (formerly they were `\let` to
+    some robust macros, and this did not make them strictly
+    LaTeX2e-robust entities).
+
+* The various changes in mathastext described in the previous item
+  apply independently of the LaTeX release version. The
+  LaTeX format itself requires the e-TeX extensions since 2015.
+
+
 1.3u (2019/08/20)
 ---
 
@@ -242,6 +289,56 @@
 MATHASTEXT CHANGE LOG
 =====================
 
+1.3v \[2019/09/19\]
+----
+
+* LaTeX 2019-10-01 release has made more math macros robust.
+  This applies in particular to the math accents and to the
+  `\hbar`. This required for mathastext to adapt. Also
+  `\leftarrowfill` and `\rightarrowfill` are now defined
+  robust by the kernel, hence mathastext does the same. These
+  changes are dropped if mathastext detects an older LaTeX
+  format.
+
+* These LaTeX kernel changes motivated an examination of some
+  redefinitions done (optionally) by mathastext:
+
+  - The user math alphabet macros got redefined as expanding
+  to some other (robust) math alphabet macros, but were not
+  robust in the strict sense. This does cause some issues for
+  moving arguments in the context of multiple math versions,
+  hence it was a bug. The special behaviour of the math
+  alphabet commands (they redefine themselves and other macros
+  on first use) makes is somewhat problematic for mathastext
+  to keep them updated across math versions and at the same
+  time strictly LaTeX2e robust. Thus mathastext now requires
+  the e-TeX primitive `\protected` and uses it for the
+  definitions of the user level math alphabet macros.
+
+  - There are a number of `\mathchardef` tokens which (under
+  certain options and/or configuration via the package user
+  interface), mathastext redefines as macros. These macros
+  cause no issue in moving arguments (they are not "fragile"),
+  still it is probably better if they expand only at the time
+  of typesetting. To this effect they are now also
+  `\protected`: `\exists`, `\forall`, `\colon`, `\setminus`,
+  `\mid`, `\prod`, `\sum`, `\imath`, `\jmath`.
+
+  - The macro `\vert` (which expands to a `\delimiter`) is now
+  defined robust by LaTeX. Its mathastext redefinition is a
+  `\protected` one rather.
+
+  - The `\{` and `\}` (which get redefined only under
+  `\MTexplicitbracesobeymathxx` regime) are now strictly
+  robust in the LaTeX2e sense (formerly they were `\let` to
+  some robust macros, and this did not make them strictly
+  LaTeX2e-robust entities).
+
+* The various changes in mathastext described in the previous item
+  apply independently of the LaTeX release version. The
+  LaTeX format itself requires the e-TeX extensions since 2015.
+
+
 1.3u \[2019/08/20\]
 ----
 
@@ -2442,8 +2539,8 @@
 
 \begingroup\MTversion{upright}\renewcommand\familydefault\sfdefault
 \makeatletter % c'est parce que sinon ils sont pris dans Symbol
-\let\mst at stdexists\oldexists
-\let\mst at stdforall\oldforall
+\let\mst at exists@original\oldexists
+\let\mst at forall@original\oldforall
 \makeatother
 
 \csb{MTforallskip}, \csb{MTexistsskip}, and \csb{MTprimeskip} are three
@@ -4286,11 +4383,20 @@
 % partial efforts to achieve some sort of coherence; as a result some are a
 % bit strange or obsolete to various degrees. And the similar remark
 % applies to some ancient parts of the code itself!
+%
+% Should I require |2005/12/01| \LaTeX? (not sure about the month).
 %    \begin{macrocode}
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage {mathastext}
-  [2019/08/20 v1.3u Use the text font in math mode (JFB)]
+  [2019/09/19 v1.3v Use the text font in math mode (JFB)]
 %    \end{macrocode}
+% \LaTeX{} |2019-10-01| release has made robust math macros such as the math
+% accents and \cs{hbar}. 
+%    \begin{macrocode}
+\newif\ifmst at robust@obsessed at LaTeX@era
+\@ifl at t@r\fmtversion{2019/10/01}{\mst at robust@obsessed at LaTeX@eratrue}{}
+\edef\mst at robustifyingspace{\ifmst at robust@obsessed at LaTeX@era\space\fi}
+%    \end{macrocode}
 % Testing for \XeTeX\ and \LuaLaTeX.
 %
 % |1.3g 2015/10/15|: update for the naming of primitives, the situation has
@@ -4567,7 +4673,7 @@
 %      |1.3j| adds \cs{MTnormalexists}, \cs{MTexistsdoesskip},
 %      \cs{MTnormalforall}, \cs{MTforalldoesskip}.
 %
-%      Earlier to |1.3j|, |\let\mst at stdexists\exists| was done at End of
+%      Earlier to |1.3j|, |\let\mst at exists@original\exists| was done at End of
 %      Package, now it is done at Begin Document, and same for |\forall|. We
 %      pay attention that use of \cs{MTnormalexists} etc... inside the
 %      preamble does not create self-let's.
@@ -4579,6 +4685,11 @@
 %      For some (random, legacy) reason, the handling of $\exists$ and
 %      $\forall$ is part of the things
 %      not included inside |\everymath/\everydisplay|.
+%
+%      |1.3v| The \mst-defined \cs{exists} and \cs{forall} are created
+%      \cs{protected}. We feel this matches better with their default
+%      definition as \cs{mathchardef} tokens than dealing with \LaTeX2e robust
+%      macros. Besides, the coding is simpler.
 %    \begin{macrocode}
 \newmuskip\mst at exists@muskip  %% v 1.15e
 \newmuskip\mst at forall@muskip
@@ -4589,15 +4700,15 @@
     \def\mst at forall@skip{0mu}
     \def\mst at prime@skip {0mu}
 \fi\fi
-\def\mst at exists{\mst at stdexists\mskip\mst at exists@muskip}
-\def\mst at forall{\mst at stdforall\mskip\mst at forall@muskip}
+\protected\def\mst at exists{\mst at exists@original\mskip\mst at exists@muskip}
+\protected\def\mst at forall{\mst at forall@original\mskip\mst at forall@muskip}
 \AtBeginDocument{%
-   \let\mst at stdexists\exists
-   \let\mst at stdforall\forall
-   \def\MTnormalexists {\let\exists\mst at stdexists }%
-   \def\MTexistsdoesskip  {\let\exists\mst at exists }%
-   \def\MTnormalforall {\let\forall\mst at stdforall }%
-   \def\MTforalldoesskip  {\let\forall\mst at forall }%
+   \let\mst at exists@original\exists
+   \let\mst at forall@original\forall
+   \def\MTnormalexists   {\let\exists\mst at exists@original }%
+   \def\MTexistsdoesskip {\let\exists\mst at exists }%
+   \def\MTnormalforall   {\let\forall\mst at forall@original }%
+   \def\MTforalldoesskip {\let\forall\mst at forall }%
 %    \end{macrocode}
 % The document body starts in the normal math version, whether or not
 % \cs{Mathastext} command as been used in the preamble (which either re-defines
@@ -5300,11 +5411,13 @@
 % All in all this is a great deal of trouble and I understand I postponed back
 % in 2012! I spent some hours on this small thing, with consequent testing and
 % for example this TeX Ligature issue with Unicode engines.
+%
+% Since |1.3v| we require e-\TeX{} extensions, so a test for
+% \cs{numexpr} has been dropped here.
 %    \begin{macrocode}
-\ifmst at basic\else
-\ifx\numexpr\undefined
+\ifmst at basic
 \else
-  \ifmst at XeOrLua
+ \ifmst at XeOrLua
   \AtBeginDocument {%
   \ifx\newmcodes@\@undefined\else
   \edef\mst at newmcodes@{%
@@ -5329,8 +5442,8 @@
   }%
   \let\mst at originalnewmcodes@\newmcodes@
   \fi
-  }
-  \else
+  }% end of AtBeginDocument
+ \else
   \AtBeginDocument {%
   \ifx\newmcodes@\@undefined\else
   \edef\mst at newmcodes@{%
@@ -5349,9 +5462,9 @@
     }%
   \let\mst at originalnewmcodes@\newmcodes@
   \fi
-  }
-  \fi
-\fi\fi
+  }% end of second AtBeginDocument
+ \fi % mst at XeOrLua
+\fi % mst at basic
 \newcommand*\MTresetnewmcodes{\ifx\mst at originalnewmcodes@\undefined\else
                                \let\newmcodes@\mst at originalnewmcodes@\fi}
 \newcommand*\MTcustomizenewmcodes{\ifx\mst at originalnewmcodes@\undefined\else
@@ -5486,9 +5599,8 @@
 % \begin{macro}{\Mathtt}
 % \begin{macro}{\mathnormalbold}
 %   We redefine the default normal, rm, bf, it, sf, and tt alphabets,
-%   but this will be done via |\renewcommand{\mathrm}{\Mathrm}| etc\dots
-%   and (|1.15f|) the previous status of the math alphabets is recorded for the
-%   sake of the |subdued| option. 
+%   but this will be done via |\renewcommand*{\mathrm}{\Mathrm}| etc\dots
+%   (not anymore, see comment below).
 %
 %   We follow the standard \LaTeX{} behavior for \cs{mathbf}, which is
 %   to pick up the bold series of the roman font (digits and operator
@@ -5499,6 +5611,29 @@
 %   upright option does not have an upright omicron obtainable by simply
 %   typing \cs{mathnormal}|{o}|. So if |fourier| is loaded we use
 %   \cs{mathrm} and not \cs{mathnormal}.
+%
+%   Actually math alphabet macros are created robust since \LaTeX{} from 2005,
+%   so at |1.3v 2019/09/19| I decided to modify the old \mst approach a bit.
+%   Indeed with the old approach a \cs{mathtt} in a moving argument translates
+%   ultimately into \cs{Mathtt} but if for example the new context where it
+%   gets expanded is a subdued normal math version, this does not give the same
+%   as \cs{mathtt} would have given there. This was a bug: imagine
+%   |\section{$\mathtt{X}$}| issued in a math version, but the TOC is done in
+%   subdued normal version; the output in TOC will often differ (fontsize being
+%   put aside) both from out it looked at the section title and from what
+%   direct usage of \cs{mathtt} in the TOC would have given. I have no strong
+%   preference between the two possibilities (to be as in section title, or to
+%   be as if \cs{mathtt} gets executed in TOC and obeys its local regime), but
+%   it is a bug if the result is still a third one. Thus I decided to follow
+%   \LaTeX2e and that \cs{mathtt} had to remain \cs{mathtt} when moving.
+%
+%   But a math alphabet command such as \cs{Mathtt} redefines its unprotected
+%   meaning on first use as well as the one of the math version macro, hence a
+%   |\letrobustmacro\mathtt\Mathtt| of sorts is no good at all. I thus opted to
+%   not hack into the math \LaTeX{} font support across math versions and to
+%   simply use |\protected\def| in place of obeying strictly \LaTeX2e
+%   robustness (except of course in the subdued math versions as there the math
+%   alphabets acquire back their original robust meanings.)
 %    \begin{macrocode}
 \let\mst at alph@omicron\mathnormal 
 \@ifpackageloaded{fourier}{\ifsloped\else\let\mst at alph@omicron\mathrm\fi}{}
@@ -5519,6 +5654,10 @@
 \ifmst at defaulttt\else
    \DeclareMathAlphabet{\Mathtt}{\mst at enc}{\ttdefault}{\mst at ser}{\mst at opsh}
 \fi
+%    \end{macrocode}
+% The \cs{mathxx} macros being \LaTeX2e robust, or course the meanings here
+% are known, and \xABoriginal\xBB macros are sort of superfluous but well it works.
+%    \begin{macrocode}
 \let\mst at original@normal\mathnormal
 \let\mst at original@rm\mathrm
 \let\mst at original@bf\mathbf
@@ -5533,12 +5672,12 @@
     \let\mathsf\mst at original@sf
     \let\mathtt\mst at original@tt}
 \def\mst at setalphabets{%
-    \ifmst at defaultnormal\else\renewcommand{\mathnormal}{\Mathnormal}\fi
-    \ifmst at defaultrm\else\renewcommand{\mathrm}{\Mathrm}\fi
-    \ifmst at defaultbf\else\renewcommand{\mathbf}{\Mathbf}\fi
-    \ifmst at defaultit\else\renewcommand{\mathit}{\Mathit}\fi
-    \ifmst at defaultsf\else\renewcommand{\mathsf}{\Mathsf}\fi
-    \ifmst at defaulttt\else\renewcommand{\mathtt}{\Mathtt}\fi}
+    \ifmst at defaultnormal\else\protected\def\mathnormal{\Mathnormal}\fi
+    \ifmst at defaultrm\else\protected\def\mathrm{\Mathrm}\fi
+    \ifmst at defaultbf\else\protected\def\mathbf{\Mathbf}\fi
+    \ifmst at defaultit\else\protected\def\mathit{\Mathit}\fi
+    \ifmst at defaultsf\else\protected\def\mathsf{\Mathsf}\fi
+    \ifmst at defaulttt\else\protected\def\mathtt{\Mathtt}\fi}
 \ifmst at subdued\else\mst at setalphabets\fi
 %    \end{macrocode}
 % \end{macro}
@@ -5955,7 +6094,10 @@
   % shamelessly overwrite...)
     \DeclareMathSymbol{\colon}{\mathpunct}{\mst at font@tbu}{"3A}
     \mst at do@nonletters\expandafter{\the\mst at do@nonletters
-        \def\colon{\mathpunct{\mst at varfam@colon}}}} 
+%    \end{macrocode}
+% |1.3v| uses \cs{protected} for the (optional) \cs{colon} redefinition.
+%    \begin{macrocode}
+        \protected\def\colon{\mathpunct{\mst at varfam@colon}}}} 
 \DeclareMathSymbol{;}{\mathpunct}{\mst at font@tbu}{"3B}
 \DeclareMathSymbol{\mst at varfam@pointvirgule}{\mathalpha}{\mst at font@tbu}{"3B}
 \expandafter\mst at addtodo@nonletters\string;\mathpunct\mst at varfam@pointvirgule
@@ -5971,23 +6113,34 @@
 % However, for the time being I can do it in an easy way only for
 % \XeTeX, not for \LuaLaTeX. Also I do my modifications to \cs{relbar}
 % in a manner testing for the presence of amsmath.
+%
+% |1.3v 2019/09/19|: \LaTeX{} of |2019-10-01| defines \cs{leftarrowfill}
+% and \cs{rightarrowfill} as robust macros, so we do the same.
+%
+% I need to put amsmath under surveillance to check if it decides to
+% robustify \cs{relbar} at some point, now that the \LaTeX\ team has
+% taken over maintenance.
 %    \begin{macrocode}
 \ifmst at nominus
 \else
   \ifmst at XeOrLua
     \mst at Umathcharnumdef\mst at minus@sign=\mst at Umathcodenum`\-\relax
-%% I used this prior to the new \luatexUmathcodenum, as available since TL2013:
-%% \mathchardef\mst at minus@sign=8704\relax % "2200
+%^^A I used this prior to the new \luatexUmathcodenum, as available since TL2013:
+%^^A \mathchardef\mst at minus@sign=8704\relax % "2200
   \else
     \mathchardef\mst at minus@sign=\mathcode`\-\relax
   \fi
-\@ifpackageloaded{amsmath}
-{\def\relbar{\mathrel{\mathpalette\mathsm at sh\mst at minus@sign}}}
-{\DeclareRobustCommand\relbar{\mathrel{\smash\mst at minus@sign}}}
-\def\rightarrowfill{$\m at th\mathord{\relbar}\mkern-7mu%
+  \@ifpackageloaded{amsmath}
+    {\def\relbar{\mathrel{\mathpalette\mathsm at sh\mst at minus@sign}}}
+    {\DeclareRobustCommand\relbar{\mathrel{\smash\mst at minus@sign}}}
+  \ifmst at robust@obsessed at LaTeX@era\expandafter\DeclareRobustCommand
+   \else\expandafter\def\fi
+  \rightarrowfill{$\m at th\mathord{\relbar}\mkern-7mu%
   \cleaders\hbox{$\mkern-2mu\relbar\mkern-2mu$}\hfill
   \mkern-7mu\mathord\rightarrow$}
-\def\leftarrowfill{$\m at th\mathord\leftarrow\mkern-7mu%
+  \ifmst at robust@obsessed at LaTeX@era\expandafter\DeclareRobustCommand
+   \else\expandafter\def\fi
+  \leftarrowfill{$\m at th\mathord\leftarrow\mkern-7mu%
   \cleaders\hbox{$\mkern-2mu\relbar\mkern-2mu$}\hfill
   \mkern-7mu\mathord{\relbar}$}
 \fi
@@ -6100,13 +6253,24 @@
 %
 %   On this occasion I replace |h| by |\mst at h| because the mechanism for
 %   before and after skips does not interact well with the rlap construct.
+%
+%   |1.3v 2019/09/19| adapts to maintain the robustness of \cs{hbar} which now
+%   applies with \LaTeX{} |2019-10-01|. The \cs{mst at original@hbar} is a
+%   meaning holder and there is no need for this macro to be robust in
+%   \LaTeX{} sense. Same for the hbar-macros whose names get indexed by math
+%   version names. We use them as meaning-holders and suitably access them via
+%   \cs{let}. The \cs{mst at ltbar@mv<version>} macros will be robust as they get
+%   declared via \cs{DeclareMathAccent}, but this is other matter.
 %    \begin{macrocode}
 \let\mst at subduedhbar\@empty
 \let\mst at nonsubduedhbar\@empty
 \ifmst at nohbar\else
-  \def\mst at subduedhbar{\let\hbar\mst at original@hbar}%
+  \def\mst at subduedhbar{%
+      \expandafter\let\csname hbar\mst at robustifyingspace\endcsname
+                  \mst at original@hbar
+  }%
   \def\mst at nonsubduedhbar{%
-      \expandafter\let\expandafter\hbar
+      \expandafter\let\csname hbar\mst at robustifyingspace\expandafter\endcsname
                   \csname mst at hbar@mv\math at version\endcsname
   }%
 \fi
@@ -6264,8 +6428,11 @@
             \let\backslash\mst at varfam@backslash}
 \DeclareMathSymbol{\setminus}{\mathbin}{mtoperatorfont}{"5C}
 \DeclareMathSymbol{\mst at varfam@setminus}{\mathalpha}{mtoperatorfont}{"5C}
+%    \end{macrocode}
+% |1.3v| adds a \cs{protected} here for \cs{setminus}.
+%    \begin{macrocode}
 \mst at do@nonletters\expandafter{\the\mst at do@nonletters
-            \def\setminus{\mathbin{\mst at varfam@setminus}}}
+            \protected\def\setminus{\mathbin{\mst at varfam@setminus}}}
 %    \end{macrocode}
 % \end{macro}\end{macro}\end{macro}
 % \begin{macro}{\models}
@@ -6282,7 +6449,14 @@
 % \begin{macro}{|,\mid,\vert}
 %   (2011) I did not do anything then to try to emulate \cs{Vert} with the
 %   vertical bar from the text font... and now (2012) \mst is not as radical as
-%   it used to be anyhow, so it is too late.
+%   it used to be anyhow, so it is too late. Or not (2019)? maybe I
+%   \emph{should} do something here...
+%
+%   |1.3v 2019/09/19|: I discover this rather radical legacy
+%   \verb+\def\vert{|}+, which is done here once in the preamble, but I leave
+%   it unmodified apart from prefixing it with \cs{protected}. I also add a
+%   \cs{protected} for the definition of \cs{mid} (which applies only under
+%   \cs{MTnonlettersobeymathxx} regime).
 %    \begin{macrocode}
 \ifmst at nosmalldelims
     \DeclareMathSymbol{|}{\mathord}{\mst at font@tbu}{124}
@@ -6289,13 +6463,13 @@
 \else
     \DeclareMathDelimiter{|}{\mathord}{\mst at font@tbu}{124}{largesymbols}{"0C}
 \fi    
-\def\vert{|}
+\protected\def\vert{|}
 \DeclareMathSymbol{\mst at varfam@vbar}{\mathalpha}{\mst at font@tbu}{124}
 \mst at addtodo@easynonletters\|\mst at varfam@vbar
 \let\mid\undefined % 1.3: to avoid problems with some packages
 \DeclareMathSymbol{\mid}{\mathrel}{\mst at font@tbu}{124}
 \mst at do@nonletters\expandafter{\the\mst at do@nonletters
-    \def\mid{\mathrel\mst at varfam@vbar}}
+    \protected\def\mid{\mathrel\mst at varfam@vbar}}
 %    \end{macrocode}
 % \begin{macro}{\MTexplicitbraces-}\begin{macro}{obeymathxx}
 % \begin{macro}{\MTexplicitbraces-}\begin{macro}{donotobeymathxx}
@@ -6305,9 +6479,21 @@
 %       preserve robustness.
 %
 %       For |1.3| I make |\lbrace| and |\rbrace| undefined first, else problems
-%       may arise with some packages. |1.3e| suppresses under option
+%       may arise with some packages.
+%
+%       |1.3e| suppresses under option
 %       |nosmalldelims| the definitions of |\lbrace| and |\rbrace| as math
-%       symbols as this bug made |\left\lbrace| cause an error, naturally.
+%       symbols as this made |\left\lbrace| cause an error, it was a bug.
+%
+%       LaTeX2e defines |\{| and |\}| as robust commands for a long time
+%       (I don't know since when). The \mst redefinition is done only if user
+%       has executed \cs{MTexplicitbracesobeymathxx}, and it is done only when
+%       entering math mode, but there could be some |\hbox| inside math, hence
+%       it has to be careful to be valid in text too.
+%
+%       |1.3v| maintains strict \LaTeX2e robustness for |\{| and |\}|.
+%       This assumes no one fiddled with |\{| and |\}| proper (without space
+%       in the name).
 %    \begin{macrocode}
   \ifmst at nosmalldelims
   \else
@@ -6324,7 +6510,10 @@
 \DeclareRobustCommand*{\mst at rbrace}
         {\ifmmode\mathclose\mst at varfam@rbrace\else\textbraceright\fi}
 \mst at do@nonletters\expandafter{\the\mst at do@nonletters
-    \mst at dobraces{\let\{\mst at lbrace\let\}\mst at rbrace}}
+    \mst at dobraces{\expandafter\let\csname\string{ \expandafter\endcsname
+                                  \csname mst at lbrace \endcsname
+                  \expandafter\let\csname\string} \expandafter\endcsname
+                                  \csname mst at rbrace \endcsname}}
 \fi % end of \ifmst at alldelims
 \newcommand*{\MTexplicitbracesobeymathxx}{\let\mst at dobraces\@firstofone}
 \newcommand*{\MTexplicitbracesdonotobeymathxx}{\let\mst at dobraces\@gobble}
@@ -6432,20 +6621,24 @@
 %   |\renewcommand{\prod}{\mathchoice{\mst at prod}{\prodpsy}{\prodpsy}{\prodpsy}}|\\
 %   but this did not go well with subscripts and exponents. 
 %    
-% Note oct 2012: maybe I should re-examine what I did?
+% October 2012: maybe I should re-examine what I did?
+%
 % |1.3c| (|2013/12/14|) renames |\defaultprod| to |\MToriginalprod| and
 % |\defaultsum| to 
-% |\MToriginalsum|. 
+% |\MToriginalsum|.
+%
+% |1.3v| hesitates about making robust here \cs{prod} and \cs{sum}. Finally I
+% use \cs{protected} for them.
 %    \begin{macrocode}
 \ifmst at symbolmisc\typeout{** symbolmisc: miscellaneous math symbols from Symbol font}
 \let\mst at prod\prod
 \let\MToriginalprod\prod
 \DeclareMathSymbol{\prodpsy}{\mathop}{mtpsymbol}{213}
-\renewcommand*{\prod}{\ifinner\prodpsy\else\mst at prod\fi}
+\protected\def\prod{\ifinner\prodpsy\else\mst at prod\fi}
 \let\mst at sum\sum
 \let\MToriginalsum\sum
 \DeclareMathSymbol{\sumpsy}{\mathop}{mtpsymbol}{229}
-\renewcommand*{\sum}{\ifinner\sumpsy\else\mst at sum\fi}
+\protected\def\sum{\ifinner\sumpsy\else\mst at sum\fi}
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
@@ -7021,6 +7214,8 @@
 %
 % |1.3u| lets the \cs{imath} and \cs{jmath} react to the font encoding at each
 % math version.
+%
+% |1.3v| lets the redefined \cs{imath} and \cs{jmath} be \cs{protected}.
 %    \begin{macrocode}
 \def\mst at subduedinodot{%
    \let\inodot\mst at original@imath
@@ -7046,8 +7241,8 @@
   \fi}% \mst at dothe@inodotstuff
 \ifmst at defaultimath\else\typeout{** \string\imath\space and \string\jmath\space}
     \AtEndOfPackage{\AtBeginDocument{%
-        \renewcommand*{\imath}{\inodot}%
-        \renewcommand*{\jmath}{\jnodot}%
+        \protected\def\imath{\inodot}%
+        \protected\def\jmath{\jnodot}%
     }}%
 \fi
 %    \end{macrocode}
@@ -7080,6 +7275,14 @@
 %
 %   Also at |1.3u| the math accents adapt to the font encoding at each math
 %   version.
+%
+%   |1.3v| adapts to \LaTeX{} |2019-10-01| which now comes with robust math
+%   accent macros. The \xABoriginal\xBB-named macros are without the robustifying
+%   space, as they only serve as meaning holders. On the other hand the macros
+%   indexed by math version names are (in the pdflatex branch) always defined
+%   via \cs{DeclareMathAccent} hence they will be robust with |2019-10-01| or
+%   later and we must use the \cs{mst at robustifyingspace} with them to access
+%   their real meaning (this thus differs from the situation with \cs{hbar}).
 %    \begin{macrocode}
 \let\mst at subduedmathaccents\@empty
 \let\mst at nonsubduedmathaccents\@empty
@@ -7088,7 +7291,7 @@
   \@tfor\@tempa:={grave}{acute}{check}{breve}{bar}%
                  {dot}{ddot}{mathring}{hat}{tilde}%
   \do
-  {\expandafter\let\csname\@tempa\expandafter\endcsname
+  {\expandafter\let\csname\@tempa\mst at robustifyingspace\expandafter\endcsname
                    \csname mst at original@\@tempa\endcsname}%
 }%
 \def\mst at nonsubduedmathaccents{%
@@ -7095,8 +7298,8 @@
   \@tfor\@tempa:={grave}{acute}{check}{breve}{bar}%
                  {dot}{ddot}{mathring}{hat}{tilde}%
   \do
-  {\expandafter\let\csname\@tempa\expandafter\endcsname
-                   \csname mst@\@tempa @mv\math at version\endcsname}%
+  {\expandafter\let\csname\@tempa\mst at robustifyingspace\expandafter\endcsname
+                   \csname mst@\@tempa @mv\math at version\mst at robustifyingspace\endcsname}%
 }%
 \def\mst at dothe@mathaccentsstuff#1#2{%
   \begingroup
@@ -7107,73 +7310,119 @@
   \if1\mst at OneifUniEnc
     \ifmst at unimathaccents
       % \` -> \grave
-      \expandafter\xdef\csname mst at grave@mv#1\endcsname
+      \expandafter\xdef\csname mst at grave@mv#1\mst at robustifyingspace\endcsname
        {\mst at Umathaccent
         7
         \number\symmtoperatorfont\space
         \csname#2\string\`\endcsname{}\relax}%
       % \' -> \acute
-      \expandafter\xdef\csname mst at acute@mv#1\endcsname
+      \expandafter\xdef\csname mst at acute@mv#1\mst at robustifyingspace\endcsname
        {\mst at Umathaccent
         7
         \number\symmtoperatorfont\space
         \csname#2\string\'\endcsname{}\relax}%
       % \v -> \check
-      \expandafter\xdef\csname mst at check@mv#1\endcsname
+      \expandafter\xdef\csname mst at check@mv#1\mst at robustifyingspace\endcsname
        {\mst at Umathaccent
         7
         \number\symmtoperatorfont\space
         \csname#2\string\v\endcsname{}\relax}%
       % \u -> \breve
-      \expandafter\xdef\csname mst at breve@mv#1\endcsname
+      \expandafter\xdef\csname mst at breve@mv#1\mst at robustifyingspace\endcsname
        {\mst at Umathaccent
         7
         \number\symmtoperatorfont\space
         \csname#2\string\u\endcsname{}\relax}%
       % \= -> \bar
-      \expandafter\xdef\csname mst at bar@mv#1\endcsname
+      \expandafter\xdef\csname mst at bar@mv#1\mst at robustifyingspace\endcsname
        {\mst at Umathaccent
         7
         \number\symmtoperatorfont\space
         \csname#2\string\=\endcsname{}\relax}%
       % \. -> \dot
-      \expandafter\xdef\csname mst at dot@mv#1\endcsname
+      \expandafter\xdef\csname mst at dot@mv#1\mst at robustifyingspace\endcsname
        {\mst at Umathaccent
         7
         \number\symmtoperatorfont\space
         \csname#2\string\.\endcsname{}\relax}%
       % \" -> \ddot
-      \expandafter\xdef\csname mst at ddot@mv#1\endcsname
+      \expandafter\xdef\csname mst at ddot@mv#1\mst at robustifyingspace\endcsname
        {\mst at Umathaccent
         7
         \number\symmtoperatorfont\space
         \csname#2\string\"\endcsname{}\relax}%
       % \r -> \mathring
-      \expandafter\xdef\csname mst at mathring@mv#1\endcsname
+      \expandafter\xdef\csname mst at mathring@mv#1\mst at robustifyingspace\endcsname
        {\mst at Umathaccent
         7
         \number\symmtoperatorfont\space
         \csname#2\string\r\endcsname{}\relax}%
       % \^ -> \hat
-      \expandafter\xdef\csname mst at hat@mv#1\endcsname
+      \expandafter\xdef\csname mst at hat@mv#1\mst at robustifyingspace\endcsname
        {\mst at Umathaccent
         7
         \number\symmtoperatorfont\space
         \csname#2\string\^\endcsname{}\relax}%
       % \~ -> \tilde
-      \expandafter\xdef\csname mst at tilde@mv#1\endcsname
+      \expandafter\xdef\csname mst at tilde@mv#1\mst at robustifyingspace\endcsname
        {\mst at Umathaccent
         7
         \number\symmtoperatorfont\space
         \csname#2\string\~\endcsname{}\relax}%
-    \else
+    \else % false branch of ifmst at unimathaccents
+%    \end{macrocode}
+% |1.3u| used some \cs{def} but this made the accent macro meanings look
+% slightly different depending on whether the math version being set-up was
+% with an 8bit encoding or TU encoding.
+%
+% For the sake of uniform treatment we modify this at |1.3v|, but this is a
+% bit complicated regarding timing: we need, in absence of |unimathaccents|
+% option, in math versions with an OpenType font, to let the \cs{acute} etc...
+% acquire back some prior non-\mst meanings. To allow maximal flexibility,
+% these original meaning get stored at begin document only. But
+% \cs{mst at nonsubduedmathaccents} assigns to \cs{acute} etc... (in the robust
+% sense with \LaTeX{} |2019-10-01| or later) the meaning stored in the macros
+% with the math version in their names. Such \cs{mst at acute@mvnormal} etc...
+% must thus be ready before \cs{mst at nonsubduedmathaccents} (or at least before
+% the last such) execution: the code here must get executed after the
+% definition of the \xABoriginal\xBB-named macros but prior to the (last one, if
+% multiple) \cs{mst at nonsubduedmathaccents}.
+%
+% Hence |1.3v| delayed a bit the initial execution of this macro (see further
+% down in the code) compared to what happened in |1.3u|.
+%
+% We are in a group but \cs{AtEndOfPackage} does the right thing.
+%    \begin{macrocode}
+      \AtEndOfPackage{\AtBeginDocument{%
       \@tfor\@tempa:={grave}{acute}{check}{breve}{bar}%
                      {dot}{ddot}{mathring}{hat}{tilde}%
       \do
-      {\expandafter\gdef\csname mst@\@tempa @mv#1\expandafter\endcsname
-                   \expandafter{\csname mst at original@\@tempa\endcsname}}%
+      {\expandafter\let
+          \csname mst@\@tempa @mv#1\mst at robustifyingspace\expandafter\endcsname
+          \csname mst at original@\@tempa\endcsname}%
+      }}%
     \fi
-  \else
+%    \end{macrocode}
+% This is needed because the pdflatex engine branch will use
+% \cs{DeclareMathAccent} and it creates robust macros with \LaTeX{}
+% |2019-10-01| or later. As we want elsewhere in the package code not to have
+% to check if under Unicode engine or not, we need to handle here also some
+% definition of robust macros.
+%    \begin{macrocode}
+    \ifmst at robust@obsessed at LaTeX@era
+      \@tfor\@tempa:={grave}{acute}{check}{breve}{bar}%
+                     {dot}{ddot}{mathring}{hat}{tilde}%
+      \do
+      {\expandafter\xdef\csname mst@\@tempa @mv#1\endcsname
+         {\noexpand\protect
+          \expandafter\noexpand\csname mst@\@tempa @mv#1 \endcsname}%
+      }%
+    \fi
+  \else % false branch of ifUniEnc
+%    \end{macrocode}
+% \cs{DeclareMathAccent} works \cs{global}ly. And with \LaTeX{} |2019-10-01|
+% or later it creates robust macros.
+%    \begin{macrocode}
     % \` -> \grave
     \expandafter\DeclareMathAccent\expandafter
                {\csname mst at grave@mv#1\endcsname}{\mathalpha}{mtoperatorfont}%
@@ -8034,9 +8283,14 @@
 % dotless i and j in subdued mode, even in case of usage with fontspec.
 %
 % |1.3u| similarly lets math accents be correctly subdued.
+%
+% |1.3v| adapts to \cs{hbar} and math accents now being robust with \LaTeX{}
+% |2019-10-01| or later.
 %    \begin{macrocode}
   \MTcustomizenewmcodes
-  \let\mst at original@hbar\hbar
+  \expandafter\let\expandafter
+              \mst at original@hbar
+              \csname hbar\mst at robustifyingspace\endcsname
   \let\mst at original@imath\imath
   \let\mst at original@jmath\jmath
   \@tfor\@tempa:={grave}{acute}{check}{breve}{bar}%
@@ -8043,7 +8297,8 @@
                  {dot}{ddot}{mathring}{hat}{tilde}%
   \do
   {\expandafter\let\csname mst at original@\@tempa\expandafter\endcsname
-                   \csname \@tempa\endcsname}%
+                   \csname \@tempa\mst at robustifyingspace\endcsname
+  }%
   \ifmst at XeOrLua
      \edef\mst at subduedminus
          {\mst at Umathcodenum`\noexpand\-=\the\mst at Umathcodenum`\-\relax}%
@@ -8062,7 +8317,11 @@
     \mst at subduedminus
   \else
      \mst at nonsubduedhbar
-     \mst at nonsubduedmathaccents
+%    \end{macrocode}
+% |1.3v| needs this \cs{mst at nonsubduedmathaccents} to get executed later (see
+% code comments for \cs{mst at dothe@mathaccentsstuff}).
+%    \begin{macrocode}
+     % \mst at nonsubduedmathaccents % will get executed later
      \mst at nonsubduedminus
 %    \end{macrocode}
 % |1.3j|: an earlier version of this code was earlier part of \cs{Mathastext@}.
@@ -8087,6 +8346,7 @@
      \fi
   \fi
 }% \AtBeginDocument
+\AtEndOfPackage{\AtBeginDocument{\ifmst at subdued\else\mst at nonsubduedmathaccents\fi}}%
 %    \end{macrocode}
 % \end{macro}
 % \begin{macro}{subdued}
@@ -8100,8 +8360,9 @@
 %   math families of `a' and `1', respectively$^1$. Due to the
 %   reassignements done for characters by |mathastext| I also had
 %   decided in 2011 that the OT1 encoding, if detected, should be
-%   replaced by T1 ($(1)$: but the \emph{euler} package for example
-%   assigns the digits to the \emph{letters} symbol font...)
+%   replaced by T1\newline
+%   $^1$but the \emph{euler} package for example
+%   assigns the digits to the \emph{letters} symbol font...
 %
 %   |1.15d|: Oct 13, 2012. The \cs{mathcode} thing has to be used with care
 %   under Unicode engines. Unfortunately the \cs{luatexUmathcode} macro is
@@ -8269,7 +8530,7 @@
   Grave accent  \`     Left brace    \{     Vertical bar  \|
   Right brace   \}     Tilde         \~}
 
-\CheckSum{6010}
+\CheckSum{6101}
 \makeatletter\check at checksum\makeatother
 \Finale
 %%

Modified: trunk/Master/texmf-dist/tex/latex/mathastext/mathastext.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/mathastext/mathastext.sty	2019-09-20 21:33:28 UTC (rev 52135)
+++ trunk/Master/texmf-dist/tex/latex/mathastext/mathastext.sty	2019-09-20 21:33:41 UTC (rev 52136)
@@ -23,7 +23,7 @@
 %%----------------------------------------------------------------
 %% Package: mathastext
 %% Info:    Use the text font in math mode (JFB)
-%% Version: 1.3u 2019/08/20
+%% Version: 1.3v 2019/09/19
 %% License: LPPL 1.3c (http://www.latex-project.org/lppl/lppl-1-3c.txt)
 %% Copyright (C) 2011-2019 Jean-Francois Burnol <jfbu at free dot fr>
 %% Examples of use of mathastext:
@@ -32,7 +32,10 @@
 %%----------------------------------------------------------------
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage {mathastext}
-  [2019/08/20 v1.3u Use the text font in math mode (JFB)]
+  [2019/09/19 v1.3v Use the text font in math mode (JFB)]
+\newif\ifmst at robust@obsessed at LaTeX@era
+\@ifl at t@r\fmtversion{2019/10/01}{\mst at robust@obsessed at LaTeX@eratrue}{}
+\edef\mst at robustifyingspace{\ifmst at robust@obsessed at LaTeX@era\space\fi}
   \let\mst at Umathcharnumdef\Umathcharnumdef
   \let\mst at Umathcodenum   \Umathcodenum
   \let\mst at Umathcode      \Umathcode
@@ -213,15 +216,15 @@
     \def\mst at forall@skip{0mu}
     \def\mst at prime@skip {0mu}
 \fi\fi
-\def\mst at exists{\mst at stdexists\mskip\mst at exists@muskip}
-\def\mst at forall{\mst at stdforall\mskip\mst at forall@muskip}
+\protected\def\mst at exists{\mst at exists@original\mskip\mst at exists@muskip}
+\protected\def\mst at forall{\mst at forall@original\mskip\mst at forall@muskip}
 \AtBeginDocument{%
-   \let\mst at stdexists\exists
-   \let\mst at stdforall\forall
-   \def\MTnormalexists {\let\exists\mst at stdexists }%
-   \def\MTexistsdoesskip  {\let\exists\mst at exists }%
-   \def\MTnormalforall {\let\forall\mst at stdforall }%
-   \def\MTforalldoesskip  {\let\forall\mst at forall }%
+   \let\mst at exists@original\exists
+   \let\mst at forall@original\forall
+   \def\MTnormalexists   {\let\exists\mst at exists@original }%
+   \def\MTexistsdoesskip {\let\exists\mst at exists }%
+   \def\MTnormalforall   {\let\forall\mst at forall@original }%
+   \def\MTforalldoesskip {\let\forall\mst at forall }%
    \ifmst at subdued
    \else
      \MTexistsdoesskip
@@ -430,10 +433,9 @@
 \def\mst at addtodo@AZ#1#2{%
   \mst at do@AZ\expandafter{\the\mst at do@AZ\mst at mathactivate#1#2\mst at ITcorr}%
 }
-\ifmst at basic\else
-\ifx\numexpr\undefined
+\ifmst at basic
 \else
-  \ifmst at XeOrLua
+ \ifmst at XeOrLua
   \AtBeginDocument {%
   \ifx\newmcodes@\@undefined\else
   \edef\mst at newmcodes@{%
@@ -458,8 +460,8 @@
   }%
   \let\mst at originalnewmcodes@\newmcodes@
   \fi
-  }
-  \else
+  }% end of AtBeginDocument
+ \else
   \AtBeginDocument {%
   \ifx\newmcodes@\@undefined\else
   \edef\mst at newmcodes@{%
@@ -478,9 +480,9 @@
     }%
   \let\mst at originalnewmcodes@\newmcodes@
   \fi
-  }
-  \fi
-\fi\fi
+  }% end of second AtBeginDocument
+ \fi % mst at XeOrLua
+\fi % mst at basic
 \newcommand*\MTresetnewmcodes{\ifx\mst at originalnewmcodes@\undefined\else
                                \let\newmcodes@\mst at originalnewmcodes@\fi}
 \newcommand*\MTcustomizenewmcodes{\ifx\mst at originalnewmcodes@\undefined\else
@@ -561,12 +563,12 @@
     \let\mathsf\mst at original@sf
     \let\mathtt\mst at original@tt}
 \def\mst at setalphabets{%
-    \ifmst at defaultnormal\else\renewcommand{\mathnormal}{\Mathnormal}\fi
-    \ifmst at defaultrm\else\renewcommand{\mathrm}{\Mathrm}\fi
-    \ifmst at defaultbf\else\renewcommand{\mathbf}{\Mathbf}\fi
-    \ifmst at defaultit\else\renewcommand{\mathit}{\Mathit}\fi
-    \ifmst at defaultsf\else\renewcommand{\mathsf}{\Mathsf}\fi
-    \ifmst at defaulttt\else\renewcommand{\mathtt}{\Mathtt}\fi}
+    \ifmst at defaultnormal\else\protected\def\mathnormal{\Mathnormal}\fi
+    \ifmst at defaultrm\else\protected\def\mathrm{\Mathrm}\fi
+    \ifmst at defaultbf\else\protected\def\mathbf{\Mathbf}\fi
+    \ifmst at defaultit\else\protected\def\mathit{\Mathit}\fi
+    \ifmst at defaultsf\else\protected\def\mathsf{\Mathsf}\fi
+    \ifmst at defaulttt\else\protected\def\mathtt{\Mathtt}\fi}
 \ifmst at subdued\else\mst at setalphabets\fi
 \def\mst at update@greeksh{
   \def\mst at greek@lsh{\mst at ltsh} %% default behavior
@@ -764,7 +766,7 @@
   % shamelessly overwrite...)
     \DeclareMathSymbol{\colon}{\mathpunct}{\mst at font@tbu}{"3A}
     \mst at do@nonletters\expandafter{\the\mst at do@nonletters
-        \def\colon{\mathpunct{\mst at varfam@colon}}}}
+        \protected\def\colon{\mathpunct{\mst at varfam@colon}}}}
 \DeclareMathSymbol{;}{\mathpunct}{\mst at font@tbu}{"3B}
 \DeclareMathSymbol{\mst at varfam@pointvirgule}{\mathalpha}{\mst at font@tbu}{"3B}
 \expandafter\mst at addtodo@nonletters\string;\mathpunct\mst at varfam@pointvirgule
@@ -773,18 +775,20 @@
 \else
   \ifmst at XeOrLua
     \mst at Umathcharnumdef\mst at minus@sign=\mst at Umathcodenum`\-\relax
-%% I used this prior to the new \luatexUmathcodenum, as available since TL2013:
-%% \mathchardef\mst at minus@sign=8704\relax % "2200
   \else
     \mathchardef\mst at minus@sign=\mathcode`\-\relax
   \fi
-\@ifpackageloaded{amsmath}
-{\def\relbar{\mathrel{\mathpalette\mathsm at sh\mst at minus@sign}}}
-{\DeclareRobustCommand\relbar{\mathrel{\smash\mst at minus@sign}}}
-\def\rightarrowfill{$\m at th\mathord{\relbar}\mkern-7mu%
+  \@ifpackageloaded{amsmath}
+    {\def\relbar{\mathrel{\mathpalette\mathsm at sh\mst at minus@sign}}}
+    {\DeclareRobustCommand\relbar{\mathrel{\smash\mst at minus@sign}}}
+  \ifmst at robust@obsessed at LaTeX@era\expandafter\DeclareRobustCommand
+   \else\expandafter\def\fi
+  \rightarrowfill{$\m at th\mathord{\relbar}\mkern-7mu%
   \cleaders\hbox{$\mkern-2mu\relbar\mkern-2mu$}\hfill
   \mkern-7mu\mathord\rightarrow$}
-\def\leftarrowfill{$\m at th\mathord\leftarrow\mkern-7mu%
+  \ifmst at robust@obsessed at LaTeX@era\expandafter\DeclareRobustCommand
+   \else\expandafter\def\fi
+  \leftarrowfill{$\m at th\mathord\leftarrow\mkern-7mu%
   \cleaders\hbox{$\mkern-2mu\relbar\mkern-2mu$}\hfill
   \mkern-7mu\mathord{\relbar}$}
 \fi
@@ -841,9 +845,12 @@
 \let\mst at subduedhbar\@empty
 \let\mst at nonsubduedhbar\@empty
 \ifmst at nohbar\else
-  \def\mst at subduedhbar{\let\hbar\mst at original@hbar}%
+  \def\mst at subduedhbar{%
+      \expandafter\let\csname hbar\mst at robustifyingspace\endcsname
+                  \mst at original@hbar
+  }%
   \def\mst at nonsubduedhbar{%
-      \expandafter\let\expandafter\hbar
+      \expandafter\let\csname hbar\mst at robustifyingspace\expandafter\endcsname
                   \csname mst at hbar@mv\math at version\endcsname
   }%
 \fi
@@ -937,7 +944,7 @@
 \DeclareMathSymbol{\setminus}{\mathbin}{mtoperatorfont}{"5C}
 \DeclareMathSymbol{\mst at varfam@setminus}{\mathalpha}{mtoperatorfont}{"5C}
 \mst at do@nonletters\expandafter{\the\mst at do@nonletters
-            \def\setminus{\mathbin{\mst at varfam@setminus}}}
+            \protected\def\setminus{\mathbin{\mst at varfam@setminus}}}
 \ifmst at XeOrLua
   \mst at Umathcharnumdef\mst at vert@bar=\mst at Umathcodenum`\|\relax
 \else
@@ -949,13 +956,13 @@
 \else
     \DeclareMathDelimiter{|}{\mathord}{\mst at font@tbu}{124}{largesymbols}{"0C}
 \fi
-\def\vert{|}
+\protected\def\vert{|}
 \DeclareMathSymbol{\mst at varfam@vbar}{\mathalpha}{\mst at font@tbu}{124}
 \mst at addtodo@easynonletters\|\mst at varfam@vbar
 \let\mid\undefined % 1.3: to avoid problems with some packages
 \DeclareMathSymbol{\mid}{\mathrel}{\mst at font@tbu}{124}
 \mst at do@nonletters\expandafter{\the\mst at do@nonletters
-    \def\mid{\mathrel\mst at varfam@vbar}}
+    \protected\def\mid{\mathrel\mst at varfam@vbar}}
   \ifmst at nosmalldelims
   \else
      \let\lbrace\undefined \let\rbrace\undefined
@@ -971,7 +978,10 @@
 \DeclareRobustCommand*{\mst at rbrace}
         {\ifmmode\mathclose\mst at varfam@rbrace\else\textbraceright\fi}
 \mst at do@nonletters\expandafter{\the\mst at do@nonletters
-    \mst at dobraces{\let\{\mst at lbrace\let\}\mst at rbrace}}
+    \mst at dobraces{\expandafter\let\csname\string{ \expandafter\endcsname
+                                  \csname mst at lbrace \endcsname
+                  \expandafter\let\csname\string} \expandafter\endcsname
+                                  \csname mst at rbrace \endcsname}}
 \fi % end of \ifmst at alldelims
 \newcommand*{\MTexplicitbracesobeymathxx}{\let\mst at dobraces\@firstofone}
 \newcommand*{\MTexplicitbracesdonotobeymathxx}{\let\mst at dobraces\@gobble}
@@ -1024,11 +1034,11 @@
 \let\mst at prod\prod
 \let\MToriginalprod\prod
 \DeclareMathSymbol{\prodpsy}{\mathop}{mtpsymbol}{213}
-\renewcommand*{\prod}{\ifinner\prodpsy\else\mst at prod\fi}
+\protected\def\prod{\ifinner\prodpsy\else\mst at prod\fi}
 \let\mst at sum\sum
 \let\MToriginalsum\sum
 \DeclareMathSymbol{\sumpsy}{\mathop}{mtpsymbol}{229}
-\renewcommand*{\sum}{\ifinner\sumpsy\else\mst at sum\fi}
+\protected\def\sum{\ifinner\sumpsy\else\mst at sum\fi}
 \DeclareMathSymbol{\mst at implies}{\mathrel}{mtpsymbol}{222}
 \DeclareRobustCommand*{\implies}{\;\mst at implies\;}
 \DeclareMathSymbol{\mst at impliedby}{\mathrel}{mtpsymbol}{220}
@@ -1507,8 +1517,8 @@
   \fi}% \mst at dothe@inodotstuff
 \ifmst at defaultimath\else\typeout{** \string\imath\space and \string\jmath\space}
     \AtEndOfPackage{\AtBeginDocument{%
-        \renewcommand*{\imath}{\inodot}%
-        \renewcommand*{\jmath}{\jnodot}%
+        \protected\def\imath{\inodot}%
+        \protected\def\jmath{\jnodot}%
     }}%
 \fi
 \let\mst at subduedmathaccents\@empty
@@ -1518,7 +1528,7 @@
   \@tfor\@tempa:={grave}{acute}{check}{breve}{bar}%
                  {dot}{ddot}{mathring}{hat}{tilde}%
   \do
-  {\expandafter\let\csname\@tempa\expandafter\endcsname
+  {\expandafter\let\csname\@tempa\mst at robustifyingspace\expandafter\endcsname
                    \csname mst at original@\@tempa\endcsname}%
 }%
 \def\mst at nonsubduedmathaccents{%
@@ -1525,8 +1535,8 @@
   \@tfor\@tempa:={grave}{acute}{check}{breve}{bar}%
                  {dot}{ddot}{mathring}{hat}{tilde}%
   \do
-  {\expandafter\let\csname\@tempa\expandafter\endcsname
-                   \csname mst@\@tempa @mv\math at version\endcsname}%
+  {\expandafter\let\csname\@tempa\mst at robustifyingspace\expandafter\endcsname
+                   \csname mst@\@tempa @mv\math at version\mst at robustifyingspace\endcsname}%
 }%
 \def\mst at dothe@mathaccentsstuff#1#2{%
   \begingroup
@@ -1537,73 +1547,85 @@
   \if1\mst at OneifUniEnc
     \ifmst at unimathaccents
       % \` -> \grave
-      \expandafter\xdef\csname mst at grave@mv#1\endcsname
+      \expandafter\xdef\csname mst at grave@mv#1\mst at robustifyingspace\endcsname
        {\mst at Umathaccent
         7
         \number\symmtoperatorfont\space
         \csname#2\string\`\endcsname{}\relax}%
       % \' -> \acute
-      \expandafter\xdef\csname mst at acute@mv#1\endcsname
+      \expandafter\xdef\csname mst at acute@mv#1\mst at robustifyingspace\endcsname
        {\mst at Umathaccent
         7
         \number\symmtoperatorfont\space
         \csname#2\string\'\endcsname{}\relax}%
       % \v -> \check
-      \expandafter\xdef\csname mst at check@mv#1\endcsname
+      \expandafter\xdef\csname mst at check@mv#1\mst at robustifyingspace\endcsname
        {\mst at Umathaccent
         7
         \number\symmtoperatorfont\space
         \csname#2\string\v\endcsname{}\relax}%
       % \u -> \breve
-      \expandafter\xdef\csname mst at breve@mv#1\endcsname
+      \expandafter\xdef\csname mst at breve@mv#1\mst at robustifyingspace\endcsname
        {\mst at Umathaccent
         7
         \number\symmtoperatorfont\space
         \csname#2\string\u\endcsname{}\relax}%
       % \= -> \bar
-      \expandafter\xdef\csname mst at bar@mv#1\endcsname
+      \expandafter\xdef\csname mst at bar@mv#1\mst at robustifyingspace\endcsname
        {\mst at Umathaccent
         7
         \number\symmtoperatorfont\space
         \csname#2\string\=\endcsname{}\relax}%
       % \. -> \dot
-      \expandafter\xdef\csname mst at dot@mv#1\endcsname
+      \expandafter\xdef\csname mst at dot@mv#1\mst at robustifyingspace\endcsname
        {\mst at Umathaccent
         7
         \number\symmtoperatorfont\space
         \csname#2\string\.\endcsname{}\relax}%
       % \" -> \ddot
-      \expandafter\xdef\csname mst at ddot@mv#1\endcsname
+      \expandafter\xdef\csname mst at ddot@mv#1\mst at robustifyingspace\endcsname
        {\mst at Umathaccent
         7
         \number\symmtoperatorfont\space
         \csname#2\string\"\endcsname{}\relax}%
       % \r -> \mathring
-      \expandafter\xdef\csname mst at mathring@mv#1\endcsname
+      \expandafter\xdef\csname mst at mathring@mv#1\mst at robustifyingspace\endcsname
        {\mst at Umathaccent
         7
         \number\symmtoperatorfont\space
         \csname#2\string\r\endcsname{}\relax}%
       % \^ -> \hat
-      \expandafter\xdef\csname mst at hat@mv#1\endcsname
+      \expandafter\xdef\csname mst at hat@mv#1\mst at robustifyingspace\endcsname
        {\mst at Umathaccent
         7
         \number\symmtoperatorfont\space
         \csname#2\string\^\endcsname{}\relax}%
       % \~ -> \tilde
-      \expandafter\xdef\csname mst at tilde@mv#1\endcsname
+      \expandafter\xdef\csname mst at tilde@mv#1\mst at robustifyingspace\endcsname
        {\mst at Umathaccent
         7
         \number\symmtoperatorfont\space
         \csname#2\string\~\endcsname{}\relax}%
-    \else
+    \else % false branch of ifmst at unimathaccents
+      \AtEndOfPackage{\AtBeginDocument{%
       \@tfor\@tempa:={grave}{acute}{check}{breve}{bar}%
                      {dot}{ddot}{mathring}{hat}{tilde}%
       \do
-      {\expandafter\gdef\csname mst@\@tempa @mv#1\expandafter\endcsname
-                   \expandafter{\csname mst at original@\@tempa\endcsname}}%
+      {\expandafter\let
+          \csname mst@\@tempa @mv#1\mst at robustifyingspace\expandafter\endcsname
+          \csname mst at original@\@tempa\endcsname}%
+      }}%
     \fi
-  \else
+    \ifmst at robust@obsessed at LaTeX@era
+      \@tfor\@tempa:={grave}{acute}{check}{breve}{bar}%
+                     {dot}{ddot}{mathring}{hat}{tilde}%
+      \do
+      {\expandafter\xdef\csname mst@\@tempa @mv#1\endcsname
+         {\noexpand\protect
+          \expandafter\noexpand\csname mst@\@tempa @mv#1 \endcsname}%
+      }%
+    \fi
+  \else % false branch of ifUniEnc
     % \` -> \grave
     \expandafter\DeclareMathAccent\expandafter
                {\csname mst at grave@mv#1\endcsname}{\mathalpha}{mtoperatorfont}%
@@ -2166,7 +2188,9 @@
     \mst at thef\mst at do@az \let\mst at thef\@gobble
     \mst at theF\mst at do@AZ \let\mst at theF\@gobble}%
   \MTcustomizenewmcodes
-  \let\mst at original@hbar\hbar
+  \expandafter\let\expandafter
+              \mst at original@hbar
+              \csname hbar\mst at robustifyingspace\endcsname
   \let\mst at original@imath\imath
   \let\mst at original@jmath\jmath
   \@tfor\@tempa:={grave}{acute}{check}{breve}{bar}%
@@ -2173,7 +2197,8 @@
                  {dot}{ddot}{mathring}{hat}{tilde}%
   \do
   {\expandafter\let\csname mst at original@\@tempa\expandafter\endcsname
-                   \csname \@tempa\endcsname}%
+                   \csname \@tempa\mst at robustifyingspace\endcsname
+  }%
   \ifmst at XeOrLua
      \edef\mst at subduedminus
          {\mst at Umathcodenum`\noexpand\-=\the\mst at Umathcodenum`\-\relax}%
@@ -2192,7 +2217,7 @@
     \mst at subduedminus
   \else
      \mst at nonsubduedhbar
-     \mst at nonsubduedmathaccents
+     % \mst at nonsubduedmathaccents % will get executed later
      \mst at nonsubduedminus
      \ifx\mst at itcorr\@undefined
          \def\mst at itcorr{\ifnum\fam=\m at ne\/\fi}%
@@ -2209,6 +2234,7 @@
      \fi
   \fi
 }% \AtBeginDocument
+\AtEndOfPackage{\AtBeginDocument{\ifmst at subdued\else\mst at nonsubduedmathaccents\fi}}%
 \ifmst at subdued
 \AtBeginDocument{%
   \def\mst at reserved#1\getanddefine at fonts\symletters#2#3\@nil{%



More information about the tex-live-commits mailing list