From a84deea3010c2ea0d5c007990dc4f35e22b28260 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 18 Mar 2021 21:13:05 +0000 Subject: mathtools (18mar21) (branch) git-svn-id: svn://tug.org/texlive/branches/branch2020.0@58521 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/mathtools/empheq.pdf | Bin 311417 -> 311677 bytes .../texmf-dist/doc/latex/mathtools/mathtools.pdf | Bin 455418 -> 456864 bytes Master/texmf-dist/doc/latex/mathtools/mhsetup.pdf | Bin 236395 -> 236759 bytes .../texmf-dist/source/latex/mathtools/empheq.ins | 2 +- .../source/latex/mathtools/mathtools.dtx | 222 +++++++++++++-------- .../source/latex/mathtools/mathtools.ins | 5 +- .../texmf-dist/source/latex/mathtools/mhsetup.dtx | 29 +-- .../texmf-dist/source/latex/mathtools/mhsetup.ins | 93 +++++++++ .../texmf-dist/tex/latex/mathtools/mathtools.sty | 64 +++--- Master/texmf-dist/tex/latex/mathtools/mhsetup.sty | 13 +- 10 files changed, 292 insertions(+), 136 deletions(-) create mode 100644 Master/texmf-dist/source/latex/mathtools/mhsetup.ins diff --git a/Master/texmf-dist/doc/latex/mathtools/empheq.pdf b/Master/texmf-dist/doc/latex/mathtools/empheq.pdf index c8e8077f118..5d28a71b098 100644 Binary files a/Master/texmf-dist/doc/latex/mathtools/empheq.pdf and b/Master/texmf-dist/doc/latex/mathtools/empheq.pdf differ diff --git a/Master/texmf-dist/doc/latex/mathtools/mathtools.pdf b/Master/texmf-dist/doc/latex/mathtools/mathtools.pdf index f779170580d..0ca42bfa06d 100644 Binary files a/Master/texmf-dist/doc/latex/mathtools/mathtools.pdf and b/Master/texmf-dist/doc/latex/mathtools/mathtools.pdf differ diff --git a/Master/texmf-dist/doc/latex/mathtools/mhsetup.pdf b/Master/texmf-dist/doc/latex/mathtools/mhsetup.pdf index 2af0d0843c6..cdade1846ee 100644 Binary files a/Master/texmf-dist/doc/latex/mathtools/mhsetup.pdf and b/Master/texmf-dist/doc/latex/mathtools/mhsetup.pdf differ diff --git a/Master/texmf-dist/source/latex/mathtools/empheq.ins b/Master/texmf-dist/source/latex/mathtools/empheq.ins index 632545df724..265efeb2bbc 100644 --- a/Master/texmf-dist/source/latex/mathtools/empheq.ins +++ b/Master/texmf-dist/source/latex/mathtools/empheq.ins @@ -33,7 +33,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: empheq 2017/03/31 v2.15 empheq} +\Msg{* Package: empheq 2020/03/24 v2.16 empheq} \Msg{************************************************************************} \keepsilent diff --git a/Master/texmf-dist/source/latex/mathtools/mathtools.dtx b/Master/texmf-dist/source/latex/mathtools/mathtools.dtx index 472c713942f..68672cfe350 100644 --- a/Master/texmf-dist/source/latex/mathtools/mathtools.dtx +++ b/Master/texmf-dist/source/latex/mathtools/mathtools.dtx @@ -6,11 +6,11 @@ % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either -% version 1.3 of this license or (at your option) any later +% version 1.3c of this license or (at your option) any later % version. The latest version of this license is in % http://www.latex-project.org/lppl.txt -% and version 1.3 or later is part of all distributions of -% LaTeX version 2005/12/01 or later. +% and version 1.3c or later is part of all distributions of +% LaTeX version 2008/05/05 or later. % % This work has the LPPL maintenance status "maintained". % @@ -69,7 +69,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: mathtools 2020/03/24 v1.24} +\Msg{* Package: mathtools 2021/03/18 v1.25} \Msg{************************************************************************} \keepsilent @@ -81,16 +81,16 @@ This is a generated file. Copyright (C) 2002-2011 by Morten Hoegholm Copyright (C) 2012-2019 by Lars Madsen -Copyright (C) 2020 by Lars Madsen, the LaTeX3 project +Copyright (C) 2020- by Lars Madsen, the LaTeX3 project This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either -version 1.3 of this license or (at your option) any later +version 1.3c of this license or (at your option) any later version. The latest version of this license is in http://www.latex-project.org/lppl.txt -and version 1.3 or later is part of all distributions of -LaTeX version 2005/12/01 or later. +and version 1.3c or later is part of all distributions of +LaTeX version 2008/05/04 or later. This work has the LPPL maintenance status "maintained". @@ -133,7 +133,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{mathtools.drv}% - [2020/03/24 v1.24 mathematical typesetting tools] + [2021/03/18 v1.25 mathematical typesetting tools] \documentclass{ltxdoc} \IfFileExists{fourier.sty}{\usepackage{fourier}}{} \addtolength\marginparwidth{-25pt} @@ -321,7 +321,7 @@ colorlinks, % % \GetFileInfo{mathtools.drv} % -% \CheckSum{3333} +% \CheckSum{3364} % % \title{The \pkg{mathtools} package\thanks{This file has version number % \fileversion, last revised \filedate.}} @@ -696,15 +696,15 @@ colorlinks, % \SpecialUsageIndex{\smashoperator} % \cs{smashoperator}\oarg{pos}\marg{operator with limits} % \end{codesyntax} -% \FeatureRequest{Lars Madsen}{2004/05/04} -% Above we shoved how to get \LaTeX{} to ignore the width of the -% subscript of an operator. However this approach takes a lot of -% extra typing, especially if you have a wide superscript, meaning -% you have to put in \cs{crampedclap} in both sub- and superscript. -% To make things easier, \pkg{mathtools} provides a -% \cs{smashoperator} command, which simply ignores the width of the -% sub- and superscript. It also takes an optional argument, -% \texttt{l}, \texttt{r}, or \texttt{lr} (default), denoting which +% \FeatureRequest{Lars Madsen}{2004/05/04} Above we showed how to get +% \LaTeX{} to ignore the width of the subscript of an +% operator. However this approach takes a lot of extra typing, +% especially if you have a wide superscript, meaning you have to put +% in \cs{crampedclap} in both sub- and superscript. To make things +% easier, \pkg{mathtools} provides a \cs{smashoperator} command, +% which simply ignores the width of the sub- and superscript. It also +% takes an optional argument, \texttt{l}, \texttt{r}, or \texttt{lr} +% (default, \texttt{rl} is an alias for \texttt{lr}), denoting which % side of the operator should be ignored (smashed). % \begin{verbatim} % \[ @@ -1967,11 +1967,11 @@ colorlinks, % % Thus % \begin{quote} -% \cs{DeclarePairedDelimiter}\marg{cmd}\marg{left_delim}\marg{right_delim} +% \cs{DeclarePairedDelimiter}\marg{cmd}\marg{left_delim}\marg{right_delim} % \end{quote} % is the same thing as % \begin{quote} -% \cs{DeclarePairedDelimiterX}\marg{cmd}\verb|[1]|\marg{left_delim}\marg{right_delim}\verb|{#1}| +% \cs{DeclarePairedDelimiterX}\marg{cmd}\texttt{[1]}\marg{left_delim}\marg{right_delim}\rlap{\texttt{\{\#1\}}} % \end{quote} % % % Let us do some examples. First we want to prepare a macro for inner @@ -2157,7 +2157,9 @@ colorlinks, % '$\sin$' and '('. In some special cases it may be useful to be % able to tinker with the behavior. % \begin{codesyntax} -% \SpecialUsageIndex{\reDeclarePairedDelimiterInnerWrapper}\cs{reDeclarePairedDelimiterInnerWrapper}\marg{macro name}\marg{\textnormal{\texttt{star}} or \textnormal{\texttt{nostarnonscaled}} or \textnormal{\texttt{nostarscaled}}}\marg{code} +% \SpecialUsageIndex{\reDeclarePairedDelimiterInnerWrapper} +% \cs{reDeclarePairedDelimiterInnerWrapper}\marg{macro name}\%\\ +% \qquad \marg{\textnormal{\texttt{star}} or \textnormal{\texttt{nostarnonscaled}} or \textnormal{\texttt{nostarscaled}}}\marg{code} % \end{codesyntax} % Internally several macros are created, including three call backs % that take care of the formatting. There is one internal macro for @@ -2298,6 +2300,7 @@ colorlinks, % \cs{vcentcolon} is a shorthand for such a vertically centered % colon, and can be used as in |$a \vcentcolon= b$| and results in % the desired output: $a \vcentcolon= b$. % for now +% See also the \pkg{colonequals} package. % % Typing \cs{vcentcolon} every time is quite tedious, so one can use % the key \key{centercolon} to make the colon active instead. @@ -2537,8 +2540,8 @@ colorlinks, % been fixed in \LaTeX, this fix will be removed from % \pkg{mathtools}. % -% The \CommentAdded{2015/11/12} fix was added to the \LaTeX{} kernel i 2015. We will continue to -% provide it on older kernels. +% The \CommentAdded{2015/11/12} fix was added to the \LaTeX{} kernel +% in 2015. We will continue to provide it on older kernels. % % \subsection{Spreading equations}\label{sec:spread} % @@ -2755,7 +2758,7 @@ colorlinks, % \verb|\xmathstrut{0.1}| % \end{center} % will give you a new strut where 10\% of the \emph{total height of -% the normal math stut} (\verb|\mathstrut=\mathstrut{0}|) will be +% the normal math stut} (\verb|\mathstrut=\xmathstrut{0}|) will be % added to both \emph{the height} and \emph{the depth} of the % original strut (thus 20\% gets added in total). On the other hand % \begin{center} @@ -2785,14 +2788,14 @@ colorlinks, % \] % \begin{verbatim} % \[ \begin{cases*} -% \frac{\frac{ x-1 }{ x-\sin x} }{ \sqrt{ 1 -x }} & $x >0$ \\ +% \frac{ \frac{ x-1 }{ x-\sin x } }{ \sqrt{ 1-x } } & $x>0$ \\ % 0 & otherwise % \end{cases*} % \qquad\text{vs.}\qquad % \begin{cases*} % \frac{ \frac{ \xmathstrut{0.1} x-1 } -% { \xmathstrut{0.25} x-\sin x} } -% {\xmathstrut{0.4} \sqrt{ 1 -x } } & $x >0$ \\ +% { \xmathstrut{0.25} x-\sin x } } +% {\xmathstrut{0.4} \sqrt{ 1-x } } & $x>0$ \\ % 0 & otherwise % \end{cases*} \] % \end{verbatim} @@ -2808,15 +2811,17 @@ colorlinks, % \begin{verbatim} % \newcommand\vfb[1]{\begingroup\fboxsep=0pt\boxed{\,#1\,}\endgroup} % \[ -% a \vfb{\mathstrut} \ % normal strut -% \vfb{\xmathstrut{0}} \ % just 0 => normal strut -% \vfb{\xmathstrut{0.5} } \ % twice as large 50% + 50% -% \vfb{\xmathstrut{-0.1} } \ % negative gives something smaller -% \vfb{\xmathstrut[0.5]{0}} a % change only the depth +% a +% \vfb{ \mathstrut } \ % normal strut +% \vfb{ \xmathstrut{0} } \ % just 0 => normal strut +% \vfb{ \xmathstrut{0.5} } \ % twice as large 50% + 50% +% \vfb{ \xmathstrut{-0.1} } \ % negative gives something smaller +% \vfb{ \xmathstrut[0.5]{0} } % change only the depth +% a % \] % \end{verbatim} % -- the last box showcases a strut where we have only changed the -% depth of the strut. One can see \verb|\xmathstrut[B]{0}| kind of the +% depth of the strut. One can see \verb|\xmathstrut[0.5]{0}| kind of the % opposite of \verb|\smash[b]{...}|, the former makes the depth larger % and the latter ignores the depth. % @@ -2925,20 +2930,19 @@ colorlinks, % % % \begin{thebibliography}{9} -% \bibitem{Perlis01} -% Alexander R. Perlis, -% \emph{A complement to \cs{smash}, \cs{llap}, and \cs{rlap}}, -% TUGboat 22(4) (2001). -% \bibitem{Ams99} -% American Mathematical Society and Michael Downes, -% \emph{Technical notes on the \pkg{amsmath} package} Version 2.0, -% 1999/10/29. -% (Available from CTAN as file \texttt{technote.tex}.) -% \bibitem{Ams00} -% Frank Mittelbach, Rainer Sch\"opf, Michael Downes, and David M.~Jones, -% \emph{The \pkg{amsmath} package} Version 2.13, -% 2000/07/18. -% (Available from CTAN as file \texttt{amsmath.dtx}.) +% \bibitem{Perlis01} Alexander R. Perlis, \emph{A complement to +% \cs{smash}, \cs{llap}, and \cs{rlap}}, TUGboat 22(4) +% (2001). Available at +% \url{https://www.tug.org/TUGboat/tb22-4/tb72perlS.pdf}. +% \bibitem{Ams99} American Mathematical Society and Michael Downes, +% \emph{Technical notes on the \pkg{amsmath} package}. Version 2.0, +% 1999/10/29. Available via +% \url{http://mirrors.ctan.org/macros/latex/required/amsmath/technote.pdf}. +% \bibitem{Ams00} Frank Mittelbach, Rainer Sch\"opf, Michael Downes, +% David M.~Jones and David Carlisle, \emph{The \pkg{amsmath} +% package}. Version 2.17e, 2020/01/20. Maintained by the \LaTeX3 +% project. Available as file +% \url{http://mirrors.ctan.org/macros/latex/required/amsmath/amsmath.dtx}. % \bibitem{A-W:MG04} % Frank Mittelbach and Michel Goossens. % \emph{The {\LaTeX} Companion}. @@ -2946,28 +2950,25 @@ colorlinks, % Boston, Massachusetts, 2 edition, 2004. % With Johannes Braams, David Carlisle, and Chris Rowley. % -% \bibitem{Carl99} -% David Carlisle, -% \emph{The \pkg{keyval} Package}, -% Version 1.13, 1999/03/16. -% (Available from CTAN as file \texttt{keyval.dtx}.) -% -% \bibitem{Voss:2004} -% Herbert Vo\ss, -% \emph{Math mode}, Version 1.71, -% 2004/07/06. -% (Available from CTAN as file \texttt{Voss-Mathmode.pdf}.) +% \bibitem{Carl99} David Carlisle, \emph{The \pkg{keyval} Package}. +% Version 1.15, 2014/10/28. Available via +% \url{https://ctan.org/pkg/keyval}. +% +% \bibitem{Voss:2004} Herbert Vo\ss, \emph{Math mode}. Version 2.47, +% 2014/01/30. Available as +% \url{http://mirrors.ctan.org/obsolete/info/math/voss/mathmode/Mathmode.pdf}. Please +% note that the author has marked the document as \emph{obsolete}. % % \bibitem{Swanson} % Ellen Swanson, % \emph{Mathematics into type}. % American Mathematical Society, updated edition, 1999. % Updated by Arlene O'Sean and Antoinette Schleyer. Available from -% the AMS at \url{http://www.ams.org/arc/styleguide/mit-2.pdf} +% the AMS at \url{https://www.ams.org/arc/styleguide/mit-2.pdf}. % -% \bibitem{TBT} -% Victor Eijkhout, \emph{\TeX\ by Topic, A Texnician's Reference}, 2007. -% Freely available at \url{https://ctan.org/pkg/texbytopic}. +% \bibitem{TBT} Victor Eijkhout, \emph{\TeX\ by Topic, A Texnician's +% Reference}, 2007. The book is available at +% \url{https://ctan.org/pkg/texbytopic}. % \end{thebibliography} % % @@ -2981,13 +2982,13 @@ colorlinks, % \begin{macrocode} %<*package> \ProvidesPackage{mathtools}% - [2020/03/24 v1.24 mathematical typesetting tools] + [2021/03/18 v1.25 mathematical typesetting tools] % \end{macrocode} % \changes{v1.10}{2011/02/12}{Might as well make sure that we need the % latest version of \texttt{mhsetup}} % \begin{macrocode} \RequirePackage{keyval,calc} -\RequirePackage{mhsetup}[2017/03/31] +\RequirePackage{mhsetup}[2021/03/18] \MHInternalSyntaxOn % \end{macrocode} % \changes{v1.13}{2013/02/11}{Robustifying \cs{(}\cs{)}\cs{[}\cs{]}} @@ -4158,7 +4159,13 @@ colorlinks, \lineskip\thr@@\fontdimen8 \scriptfont\thr@@ \lineskiplimit\lineskip \ialign\bgroup\ifx c##1\hfil\fi - $\m@th\scriptstyle\kern-\nulldelimiterspace\radical\z@{####}$ +% \end{macrocode} +% \changes{v1.25}{2021/03/18}{use \cs{MT_cramped_internal:Nn} instead, +% see issue \#17} +% Here we should use the proper cramped internal macro +% \begin{macrocode} + %% $\m@th\scriptstyle\kern-\nulldelimiterspace\radical\z@{####}$ + \span\MT_cramped_internal:Nn \scriptstyle {####}% \hfil\crcr }{% \crcr\egroup\egroup @@ -4728,21 +4735,24 @@ colorlinks, % both columns, while \env{dcases*} has text in the second column. % \changes{v1.08}{2010/06/10}{changed to match the change in % \cs{newcases} plus added rcases and drcases} +% \changes{v1.25}{2021/01/14}{Replaced \texttt{\{\#\#\}} by +% \texttt{\#\#}, otherwise one cannot counteract the \cs{hfil} in the +% definition with a \cs{hfil(l)} in a cell. Related to issue \#20 and https://tex.stackexchange.com/a/252412/3929} % \begin{macrocode} \newcases{dcases}{\quad}{% - $\m@th\displaystyle{##}$\hfil}{$\m@th\displaystyle{##}$\hfil}{\lbrace}{.} + $\m@th\displaystyle##$\hfil}{$\m@th\displaystyle##$\hfil}{\lbrace}{.} \newcases{dcases*}{\quad}{% - $\m@th\displaystyle{##}$\hfil}{{##}\hfil}{\lbrace}{.} + $\m@th\displaystyle##$\hfil}{##\hfil}{\lbrace}{.} \newcases{rcases}{\quad}{% - $\m@th{##}$\hfil}{$\m@th{##}$\hfil}{.}{\rbrace} + $\m@th##$\hfil}{$\m@th##$\hfil}{.}{\rbrace} \newcases{rcases*}{\quad}{% - $\m@th{##}$\hfil}{{##}\hfil}{.}{\rbrace} + $\m@th##$\hfil}{##\hfil}{.}{\rbrace} \newcases{drcases}{\quad}{% - $\m@th\displaystyle{##}$\hfil}{$\m@th\displaystyle{##}$\hfil}{.}{\rbrace} + $\m@th\displaystyle##$\hfil}{$\m@th\displaystyle##$\hfil}{.}{\rbrace} \newcases{drcases*}{\quad}{% - $\m@th\displaystyle{##}$\hfil}{{##}\hfil}{.}{\rbrace} + $\m@th\displaystyle##$\hfil}{##\hfil}{.}{\rbrace} \newcases{cases*}{\quad}{% - $\m@th{##}$\hfil}{{##}\hfil}{\lbrace}{.} + $\m@th##$\hfil}{##\hfil}{\lbrace}{.} % \end{macrocode} % \end{environment} % \end{environment} @@ -4913,12 +4923,19 @@ colorlinks, % specialized commands \cs{MT_smop_smash_l:NNNNN}, % \cs{MT_smop_smash_r:NNNNN}, or the default % \cs{MT_smop_smash_lr:NNNNN}. +% \changes{v1.25}{2021/03/04}{Verify that opt arg corresponds to +% something predefined} % \begin{macrocode} \newcommand*\smashoperator[2][lr]{ - \def\MT_smop_use:NNNNN {\@nameuse{MT_smop_smash_#1:NNNNN}} - \toks@{#2} - \expandafter\MT_smop_get_args:wwwNnNn + \@ifundefined{MT_smop_smash_#1:NNNNN}{ + \PackageError{mathtools}{Opt~ arg~ '#1'~ for~ \@backslashchar smashoperator~ + is~ not~ supported.\MessageBreak Use~ l,~r~or~lr~ (default)}{} + }{ + \def\MT_smop_use:NNNNN {\@nameuse{MT_smop_smash_#1:NNNNN}} + \toks@{#2} + \expandafter\MT_smop_get_args:wwwNnNn \the\toks@\@nil\@nil\@nil\@nil\@nil\@nil\@@nil + } } % \end{macrocode} % \end{macro} @@ -5119,12 +5136,17 @@ colorlinks, } % \end{macrocode} % The `lr' variant +% \changes{v1.25}{2021/03/04}{add `rl' as an alias for `lr'} % \begin{macrocode} \def\MT_smop_smash_lr:NNNNN #1#2#3#4#5{ \MT_smop_needed_args:NNNNN #1#2#3#4#5 } % \end{macrocode} -% +% Add `rl' as an alias for `lr' +% \begin{macrocode} +\MH_let:NwN \MT_smop_smash_rl:NNNNN \MT_smop_smash_lr:NNNNN +% \end{macrocode} +% % % \subsection{Adjusting limits} % @@ -5777,24 +5799,26 @@ colorlinks, % \begin{macro}{\MT_mathclap:Nn} % First we'll \cs{provide} those macros (they are so simple that I % think other packages might define them as well). +% \changes{v1.15}{2021/03/04}{Add \cs{relax} before the \cs{ifx}'s to +% prevent corner case premature expansions} % \begin{macrocode} \providecommand*\clap[1]{\hb@xt@\z@{\hss#1\hss}} \providecommand*\mathllap[1][\@empty]{ - \ifx\@empty#1\@empty + \relax\ifx\@empty#1\@empty \expandafter \mathpalette \expandafter \MT_mathllap:Nn \else \expandafter \MT_mathllap:Nn \expandafter #1 \fi } \providecommand*\mathrlap[1][\@empty]{ - \ifx\@empty#1\@empty + \relax\ifx\@empty#1\@empty \expandafter \mathpalette \expandafter \MT_mathrlap:Nn \else \expandafter \MT_mathrlap:Nn \expandafter #1 \fi } \providecommand*\mathclap[1][\@empty]{ - \ifx\@empty#1\@empty + \relax\ifx\@empty#1\@empty \expandafter \mathpalette \expandafter \MT_mathclap:Nn \else \expandafter \MT_mathclap:Nn \expandafter #1 @@ -5881,9 +5905,11 @@ colorlinks, % % \begin{macro}{\cramped} % Make sure the expansion is timed correctly. +% \changes{v1.15}{2021/03/04}{Add \cs{relax} before the \cs{ifx}'s to +% prevent corner case premature expansions} % \begin{macrocode} \providecommand*\cramped[1][\@empty]{ - \ifx\@empty#1\@empty + \relax\ifx\@empty#1\@empty \expandafter \mathpalette \expandafter \MT_cramped_internal:Nn \else \expandafter \MT_cramped_internal:Nn \expandafter #1 @@ -5898,8 +5924,14 @@ colorlinks, % \end{macrocode} % Create a box containing the math and force a cramped style by % issuing a non-existing radical. +% \changes{v1.25}{2020/12/16}{Don't set \cs{nulldelimiterspace} to +% zero, back kern intead, solves issue \#18} +% \changes{v1.25}{2021/03/18}{placed \cs{sbox}\cs{z@} by +% \cs{setbox}\cs{z@}\cs{hbox} to better handle expansion in +% \env{crampedsubarray}, see issue \#17} % \begin{macrocode} - \sbox\z@{$\m@th#1\nulldelimiterspace=\z@\radical\z@{#2}$} + %% \sbox\z@{$\m@th#1\kern-\nulldelimiterspace\radical\z@{#2}$} + \setbox\z@\hbox{$\m@th#1\kern-\nulldelimiterspace\radical\z@{#2}$} % \end{macrocode} % Then make sure the height is correct. % \begin{macrocode} @@ -5919,7 +5951,14 @@ colorlinks, 3 \fi \advance\dimen@-\ht\z@ \ht\z@=-\dimen@ - \box\z@ +% \end{macrocode} +% Leave vertical mode before typesetting the box and add a +% \texttt{\{\}} in front to gard against unnecessary reboxing +% \changes{v1.25}{2021/03/04}{Added vmode protection and reboxing +% gard, see issue \#19} +% \begin{macrocode} + \ifvmode\leavevmode\fi + {}\box\z@ } % \end{macrocode} % \end{macro} @@ -5934,9 +5973,11 @@ colorlinks, % \begin{macro}{\crampedrlap} % \begin{macro}{\MT_cramped_rlap_internal:Nn} % Cramped versions of \cs{mathXlap} (for speed). Made by the author. +% \changes{v1.15}{2021/03/04}{Add \cs{relax} before the \cs{ifx}'s to +% prevent corner case premature expansions} % \begin{macrocode} \providecommand*\crampedllap[1][\@empty]{ - \ifx\@empty#1\@empty + \relax\ifx\@empty#1\@empty \expandafter \mathpalette \expandafter \MT_cramped_llap_internal:Nn \else \expandafter \MT_cramped_llap_internal:Nn \expandafter #1 @@ -5946,7 +5987,7 @@ colorlinks, {}\llap{\MT_cramped_internal:Nn #1{#2}} } \providecommand*\crampedclap[1][\@empty]{ - \ifx\@empty#1\@empty + \relax\ifx\@empty#1\@empty \expandafter \mathpalette \expandafter \MT_cramped_clap_internal:Nn \else \expandafter \MT_cramped_clap_internal:Nn \expandafter #1 @@ -5956,7 +5997,7 @@ colorlinks, {}\clap{\MT_cramped_internal:Nn #1{#2}} } \providecommand*\crampedrlap[1][\@empty]{ - \ifx\@empty#1\@empty + \relax\ifx\@empty#1\@empty \expandafter \mathpalette \expandafter \MT_cramped_rlap_internal:Nn \else \expandafter \MT_cramped_rlap_internal:Nn \expandafter #1 @@ -5992,7 +6033,14 @@ colorlinks, \lineskip\thr@@\fontdimen8 \scriptfont\thr@@ \lineskiplimit\lineskip \ialign\bgroup\ifx c#1\hfil\fi - $\m@th\scriptstyle\kern-\nulldelimiterspace\radical\z@{##}$% <-- changed line +% \end{macrocode} +% Though here we ought to use the proper cramped internal macro, as +% otherwise there will be a slight difference in vertical spacing +% \changes{v1.25}{2021/03/18}{Added \cs{MT_cramped_internal:Nn}, see +% issue \#17} +% \begin{macrocode} + %%$\m@th\scriptstyle\kern-\nulldelimiterspace\radical\z@{##}$% <-- changed line + \span\MT_cramped_internal:Nn \scriptstyle {##}% \hfil\crcr% }{% \crcr\egroup\egroup diff --git a/Master/texmf-dist/source/latex/mathtools/mathtools.ins b/Master/texmf-dist/source/latex/mathtools/mathtools.ins index 7cb4e3727cf..82b7c16ff06 100644 --- a/Master/texmf-dist/source/latex/mathtools/mathtools.ins +++ b/Master/texmf-dist/source/latex/mathtools/mathtools.ins @@ -12,7 +12,6 @@ %% Copyright (C) 2012-2019 by Lars Madsen %% Copyright (C) 2012-2020 by Lars Madsen, the LaTeX3 project %% -%% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either %% version 1.3 of this license or (at your option) any later @@ -33,7 +32,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: mathtools 2020/01/17 v1.23} +\Msg{* Package: mathtools 2020/03/24 v1.24} \Msg{************************************************************************} \keepsilent @@ -45,7 +44,7 @@ This is a generated file. Copyright (C) 2002-2011 by Morten Hoegholm Copyright (C) 2012-2019 by Lars Madsen -Copyright (C) 2012-2020 by Lars Madsen, the LaTeX3 project +Copyright (C) 2020 by Lars Madsen, the LaTeX3 project This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either diff --git a/Master/texmf-dist/source/latex/mathtools/mhsetup.dtx b/Master/texmf-dist/source/latex/mathtools/mhsetup.dtx index b44eea12cbe..bf89bc9c887 100644 --- a/Master/texmf-dist/source/latex/mathtools/mhsetup.dtx +++ b/Master/texmf-dist/source/latex/mathtools/mhsetup.dtx @@ -6,11 +6,11 @@ % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either -% version 1.3 of this license or (at your option) any later +% version 1.3c of this license or (at your option) any later % version. The latest version of this license is in % http://www.latex-project.org/lppl.txt -% and version 1.3 or later is part of all distributions of -% LaTeX version 2005/12/01 or later. +% and version 1.3c or later is part of all distributions of +% LaTeX version 2008/05/04 or later. % % This work has the LPPL maintenance status "maintained". % @@ -70,7 +70,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: mhsetup 2017/03/31 v1.3 mhsetup} +\Msg{* Package: mhsetup 2021/03/18 v1.4 mhsetup} \Msg{************************************************************************} \keepsilent @@ -86,11 +86,11 @@ Copyright (C) 2020- by Lars Madsen, The LaTeX3 team This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either -version 1.3 of this license or (at your option) any later +version 1.3c of this license or (at your option) any later version. The latest version of this license is in http://www.latex-project.org/lppl.txt -and version 1.3 or later is part of all distributions of -LaTeX version 2005/12/01 or later. +and version 1.3c or later is part of all distributions of +LaTeX version 2008/05/04 or later. This work has the LPPL maintenance status "maintained". @@ -133,7 +133,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{mhsetup.drv}% - [2017/03/31 v1.3 programming setup (MH)] + [2021/03/18 v1.4 programming setup (MH)] \documentclass{ltxdoc} \usepackage{mhsetup} @@ -162,7 +162,7 @@ and the derived files % % \fi % -% \CheckSum{298} +% \CheckSum{301} % % \GetFileInfo{mhsetup.drv} % @@ -302,7 +302,7 @@ and the derived files % \begin{macrocode} %<*package> \ProvidesPackage{mhsetup}% - [2017/03/31 v1.3 programming setup (MH)] + [2021/03/18 v1.4 programming setup (MH)] % \end{macrocode} % \subsection{The new internal syntax} % \begin{macro}{\MHInternalSyntaxOn} @@ -576,11 +576,16 @@ and the derived files % \begin{macro}{\MH_nospace_protected_testopt:n} % Scanning for the next character but disallow spaces. % \changes{v1.3}{2017/03/31}{Added MH\_ prefix to several \cs{if...} macros} +% \changes{v1.4}{2021/01/14}{Added +% \cs{MH\_group\_align\_safe\_begin/end:} as suggested by +% Phelype Oleinik in issue \#15. This enables +% \cs{MH\_nospace\_ifnextchar:Nnn} to work correctly inside nested alignments} % \begin{macrocode} \long\def\MH_nospace_ifnextchar:Nnn #1#2#3{ + \MH_group_align_safe_begin: % added 2021/01/14 \MH_let:NwN\reserved@d=~#1 - \def\reserved@a{#2} - \def\reserved@b{#3} + \def\reserved@a{\MH_group_align_safe_end: #2} % changed 2021/01/14 + \def\reserved@b{\MH_group_align_safe_end: #3} % changed 2021/01/14 \futurelet\@let@token\MH_nospace_nextchar: } \def\MH_nospace_nextchar:{ diff --git a/Master/texmf-dist/source/latex/mathtools/mhsetup.ins b/Master/texmf-dist/source/latex/mathtools/mhsetup.ins new file mode 100644 index 00000000000..edf6baa8244 --- /dev/null +++ b/Master/texmf-dist/source/latex/mathtools/mhsetup.ins @@ -0,0 +1,93 @@ +%% +%% This is file `mhsetup.ins', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% mhsetup.dtx (with options: `install') +%% +%% This is a generated file. +%% +%% Copyright (C) 2002-2007,2010 by Morten Hoegholm +%% Copyright (C) 2017-2019 by Lars Madsen +%% Copyright (C) 2020- by Lars Madsen, The LaTeX3 team +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any later +%% version. The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status "maintained". +%% +%% This Current Maintainer of this work is Lars Madsen +%% , The LaTeX3 team https://github.com/latex3/mathtools +%% +%% This work consists of the main source file mhsetup.dtx +%% and the derived files +%% mhsetup.sty, mhsetup.pdf, mhsetup.ins, mhsetup.drv. +%% +\input docstrip.tex +\Msg{************************************************************************} +\Msg{* Installation} +\Msg{* Package: mhsetup 2017/03/31 v1.3 mhsetup} +\Msg{************************************************************************} + +\keepsilent +\askforoverwritefalse + +\preamble + +This is a generated file. + +Copyright (C) 2002-2007,2010 by Morten Hoegholm +Copyright (C) 2017-2019 by Lars Madsen +Copyright (C) 2020- by Lars Madsen, The LaTeX3 team + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either +version 1.3 of this license or (at your option) any later +version. The latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3 or later is part of all distributions of +LaTeX version 2005/12/01 or later. + +This work has the LPPL maintenance status "maintained". + +This Current Maintainer of this work is Lars Madsen +, The LaTeX3 team https://github.com/latex3/mathtools + +This work consists of the main source file mhsetup.dtx +and the derived files + mhsetup.sty, mhsetup.pdf, mhsetup.ins, mhsetup.drv. + +\endpreamble + +\generate{% + \file{mhsetup.ins}{\from{mhsetup.dtx}{install}}% + \file{mhsetup.drv}{\from{mhsetup.dtx}{driver}}% + \usedir{tex/latex/mh}% + \file{mhsetup.sty}{\from{mhsetup.dtx}{package}}% +} + +\obeyspaces +\Msg{************************************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* file into a directory searched by TeX:} +\Msg{*} +\Msg{* mhsetup.sty} +\Msg{*} +\Msg{* To produce the documentation run the file `mhsetup.drv'} +\Msg{* through LaTeX.} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*} +\Msg{************************************************************************} + +\endbatchfile +\endinput +%% +%% End of file `mhsetup.ins'. diff --git a/Master/texmf-dist/tex/latex/mathtools/mathtools.sty b/Master/texmf-dist/tex/latex/mathtools/mathtools.sty index 484ed17a818..c3b38d51c6c 100644 --- a/Master/texmf-dist/tex/latex/mathtools/mathtools.sty +++ b/Master/texmf-dist/tex/latex/mathtools/mathtools.sty @@ -10,16 +10,16 @@ %% %% Copyright (C) 2002-2011 by Morten Hoegholm %% Copyright (C) 2012-2019 by Lars Madsen -%% Copyright (C) 2020 by Lars Madsen, the LaTeX3 project +%% Copyright (C) 2020- by Lars Madsen, the LaTeX3 project %% %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either -%% version 1.3 of this license or (at your option) any later +%% version 1.3c of this license or (at your option) any later %% version. The latest version of this license is in %% http://www.latex-project.org/lppl.txt -%% and version 1.3 or later is part of all distributions of -%% LaTeX version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of +%% LaTeX version 2008/05/04 or later. %% %% This work has the LPPL maintenance status "maintained". %% @@ -31,9 +31,9 @@ %% mathtools.sty, mathtools.pdf, mathtools.ins, mathtools.drv. %% \ProvidesPackage{mathtools}% - [2020/03/24 v1.24 mathematical typesetting tools] + [2021/03/18 v1.25 mathematical typesetting tools] \RequirePackage{keyval,calc} -\RequirePackage{mhsetup}[2017/03/31] +\RequirePackage{mhsetup}[2021/03/18] \MHInternalSyntaxOn % borrowed from fixltx2e \def\EQ_MakeRobust#1{% @@ -634,7 +634,8 @@ \lineskip\thr@@\fontdimen8 \scriptfont\thr@@ \lineskiplimit\lineskip \ialign\bgroup\ifx c##1\hfil\fi - $\m@th\scriptstyle\kern-\nulldelimiterspace\radical\z@{####}$ + %% $\m@th\scriptstyle\kern-\nulldelimiterspace\radical\z@{####}$ + \span\MT_cramped_internal:Nn \scriptstyle {####}% \hfil\crcr }{% \crcr\egroup\egroup @@ -889,19 +890,19 @@ {\MH_end_cases:\right#6} } \newcases{dcases}{\quad}{% - $\m@th\displaystyle{##}$\hfil}{$\m@th\displaystyle{##}$\hfil}{\lbrace}{.} + $\m@th\displaystyle##$\hfil}{$\m@th\displaystyle##$\hfil}{\lbrace}{.} \newcases{dcases*}{\quad}{% - $\m@th\displaystyle{##}$\hfil}{{##}\hfil}{\lbrace}{.} + $\m@th\displaystyle##$\hfil}{##\hfil}{\lbrace}{.} \newcases{rcases}{\quad}{% - $\m@th{##}$\hfil}{$\m@th{##}$\hfil}{.}{\rbrace} + $\m@th##$\hfil}{$\m@th##$\hfil}{.}{\rbrace} \newcases{rcases*}{\quad}{% - $\m@th{##}$\hfil}{{##}\hfil}{.}{\rbrace} + $\m@th##$\hfil}{##\hfil}{.}{\rbrace} \newcases{drcases}{\quad}{% - $\m@th\displaystyle{##}$\hfil}{$\m@th\displaystyle{##}$\hfil}{.}{\rbrace} + $\m@th\displaystyle##$\hfil}{$\m@th\displaystyle##$\hfil}{.}{\rbrace} \newcases{drcases*}{\quad}{% - $\m@th\displaystyle{##}$\hfil}{{##}\hfil}{.}{\rbrace} + $\m@th\displaystyle##$\hfil}{##\hfil}{.}{\rbrace} \newcases{cases*}{\quad}{% - $\m@th{##}$\hfil}{{##}\hfil}{\lbrace}{.} + $\m@th##$\hfil}{##\hfil}{\lbrace}{.} \def\MT_matrix_begin:N #1{% \hskip -\arraycolsep \MH_let:NwN \@ifnextchar \MH_nospace_ifnextchar:Nnn @@ -975,10 +976,15 @@ \MHPrecedingSpacesOn \newcommand*\smashoperator[2][lr]{ - \def\MT_smop_use:NNNNN {\@nameuse{MT_smop_smash_#1:NNNNN}} - \toks@{#2} - \expandafter\MT_smop_get_args:wwwNnNn + \@ifundefined{MT_smop_smash_#1:NNNNN}{ + \PackageError{mathtools}{Opt~ arg~ '#1'~ for~ \@backslashchar smashoperator~ + is~ not~ supported.\MessageBreak Use~ l,~r~or~lr~ (default)}{} + }{ + \def\MT_smop_use:NNNNN {\@nameuse{MT_smop_smash_#1:NNNNN}} + \toks@{#2} + \expandafter\MT_smop_get_args:wwwNnNn \the\toks@\@nil\@nil\@nil\@nil\@nil\@nil\@@nil + } } \def\MT_smop_remove_nil_vi:N #1\@nil\@nil\@nil\@nil\@nil\@nil{#1} \def\MT_smop_mathop:n {\mathop} @@ -1090,6 +1096,7 @@ \def\MT_smop_smash_lr:NNNNN #1#2#3#4#5{ \MT_smop_needed_args:NNNNN #1#2#3#4#5 } +\MH_let:NwN \MT_smop_smash_rl:NNNNN \MT_smop_smash_lr:NNNNN \def\MT_vphantom:Nn {\v@true\h@false\MT_internal_phantom:N} \def\MT_hphantom:Nn {\v@false\h@true\MT_internal_phantom:N} \def\MT_phantom:Nn {\v@true\h@true\MT_internal_phantom:N} @@ -1382,21 +1389,21 @@ } \providecommand*\clap[1]{\hb@xt@\z@{\hss#1\hss}} \providecommand*\mathllap[1][\@empty]{ - \ifx\@empty#1\@empty + \relax\ifx\@empty#1\@empty \expandafter \mathpalette \expandafter \MT_mathllap:Nn \else \expandafter \MT_mathllap:Nn \expandafter #1 \fi } \providecommand*\mathrlap[1][\@empty]{ - \ifx\@empty#1\@empty + \relax\ifx\@empty#1\@empty \expandafter \mathpalette \expandafter \MT_mathrlap:Nn \else \expandafter \MT_mathrlap:Nn \expandafter #1 \fi } \providecommand*\mathclap[1][\@empty]{ - \ifx\@empty#1\@empty + \relax\ifx\@empty#1\@empty \expandafter \mathpalette \expandafter \MT_mathclap:Nn \else \expandafter \MT_mathclap:Nn \expandafter #1 @@ -1423,14 +1430,15 @@ \def\mathsm@sh#1#2{% \setbox\z@\hbox{$\m@th#1{#2}$}{}\finsm@sh} \providecommand*\cramped[1][\@empty]{ - \ifx\@empty#1\@empty + \relax\ifx\@empty#1\@empty \expandafter \mathpalette \expandafter \MT_cramped_internal:Nn \else \expandafter \MT_cramped_internal:Nn \expandafter #1 \fi } \def\MT_cramped_internal:Nn #1#2{ - \sbox\z@{$\m@th#1\nulldelimiterspace=\z@\radical\z@{#2}$} + %% \sbox\z@{$\m@th#1\kern-\nulldelimiterspace\radical\z@{#2}$} + \setbox\z@\hbox{$\m@th#1\kern-\nulldelimiterspace\radical\z@{#2}$} \ifx#1\displaystyle \dimen@=\fontdimen8\textfont3 \advance\dimen@ .25\fontdimen5\textfont2 @@ -1447,10 +1455,11 @@ 3 \fi \advance\dimen@-\ht\z@ \ht\z@=-\dimen@ - \box\z@ + \ifvmode\leavevmode\fi + {}\box\z@ } \providecommand*\crampedllap[1][\@empty]{ - \ifx\@empty#1\@empty + \relax\ifx\@empty#1\@empty \expandafter \mathpalette \expandafter \MT_cramped_llap_internal:Nn \else \expandafter \MT_cramped_llap_internal:Nn \expandafter #1 @@ -1460,7 +1469,7 @@ {}\llap{\MT_cramped_internal:Nn #1{#2}} } \providecommand*\crampedclap[1][\@empty]{ - \ifx\@empty#1\@empty + \relax\ifx\@empty#1\@empty \expandafter \mathpalette \expandafter \MT_cramped_clap_internal:Nn \else \expandafter \MT_cramped_clap_internal:Nn \expandafter #1 @@ -1470,7 +1479,7 @@ {}\clap{\MT_cramped_internal:Nn #1{#2}} } \providecommand*\crampedrlap[1][\@empty]{ - \ifx\@empty#1\@empty + \relax\ifx\@empty#1\@empty \expandafter \mathpalette \expandafter \MT_cramped_rlap_internal:Nn \else \expandafter \MT_cramped_rlap_internal:Nn \expandafter #1 @@ -1487,7 +1496,8 @@ \lineskip\thr@@\fontdimen8 \scriptfont\thr@@ \lineskiplimit\lineskip \ialign\bgroup\ifx c#1\hfil\fi - $\m@th\scriptstyle\kern-\nulldelimiterspace\radical\z@{##}$% <-- changed line + %%$\m@th\scriptstyle\kern-\nulldelimiterspace\radical\z@{##}$% <-- changed line + \span\MT_cramped_internal:Nn \scriptstyle {##}% \hfil\crcr% }{% \crcr\egroup\egroup diff --git a/Master/texmf-dist/tex/latex/mathtools/mhsetup.sty b/Master/texmf-dist/tex/latex/mathtools/mhsetup.sty index cba3e5836b0..56b2dc4a39a 100644 --- a/Master/texmf-dist/tex/latex/mathtools/mhsetup.sty +++ b/Master/texmf-dist/tex/latex/mathtools/mhsetup.sty @@ -14,11 +14,11 @@ %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either -%% version 1.3 of this license or (at your option) any later +%% version 1.3c of this license or (at your option) any later %% version. The latest version of this license is in %% http://www.latex-project.org/lppl.txt -%% and version 1.3 or later is part of all distributions of -%% LaTeX version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of +%% LaTeX version 2008/05/04 or later. %% %% This work has the LPPL maintenance status "maintained". %% @@ -30,7 +30,7 @@ %% mhsetup.sty, mhsetup.pdf, mhsetup.ins, mhsetup.drv. %% \ProvidesPackage{mhsetup}% - [2017/03/31 v1.3 programming setup (MH)] + [2021/03/18 v1.4 programming setup (MH)] \def\MHInternalSyntaxOn{ \edef\MHInternalSyntaxOff{% \catcode`\noexpand\~=\the\catcode`\~\relax @@ -123,9 +123,10 @@ \def\MH_use_choice_iii:nnnn #1#2#3#4{#3} \def\MH_use_choice_iv:nnnn #1#2#3#4{#4} \long\def\MH_nospace_ifnextchar:Nnn #1#2#3{ + \MH_group_align_safe_begin: % added 2021/01/14 \MH_let:NwN\reserved@d=~#1 - \def\reserved@a{#2} - \def\reserved@b{#3} + \def\reserved@a{\MH_group_align_safe_end: #2} % changed 2021/01/14 + \def\reserved@b{\MH_group_align_safe_end: #3} % changed 2021/01/14 \futurelet\@let@token\MH_nospace_nextchar: } \def\MH_nospace_nextchar:{ -- cgit v1.2.3