From cdf62b4de8cf4d20f7d91a6fe20ecb1697552fc7 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Wed, 31 Jul 2019 21:01:43 +0000
Subject: mathtools (31jul19)

git-svn-id: svn://tug.org/texlive/trunk@51788 c570f23f-e606-0410-a88d-b1316a301751
---
 .../source/latex/mathtools/mathtools.dtx           | 181 +++++++++++++++++++--
 1 file changed, 168 insertions(+), 13 deletions(-)

(limited to 'Master/texmf-dist/source/latex/mathtools/mathtools.dtx')

diff --git a/Master/texmf-dist/source/latex/mathtools/mathtools.dtx b/Master/texmf-dist/source/latex/mathtools/mathtools.dtx
index d5facd8df28..c9effb2b782 100644
--- a/Master/texmf-dist/source/latex/mathtools/mathtools.dtx
+++ b/Master/texmf-dist/source/latex/mathtools/mathtools.dtx
@@ -68,7 +68,7 @@
 \input docstrip.tex
 \Msg{************************************************************************}
 \Msg{* Installation}
-\Msg{* Package: mathtools 2018/01/08 v1.21}
+\Msg{* Package: mathtools 2019/07/31 v1.22}
 \Msg{************************************************************************}
 
 \keepsilent
@@ -131,7 +131,7 @@ and the derived files
 %<*driver>
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesFile{mathtools.drv}%
-  [2018/01/08 v1.21 mathematical typesetting tools]
+  [2019/07/31 v1.22 mathematical typesetting tools]
 \documentclass{ltxdoc}
 \IfFileExists{fourier.sty}{\usepackage{fourier}}{}
 \addtolength\marginparwidth{-25pt}
@@ -186,6 +186,17 @@ and the derived files
   }%
 }
 
+\newcommand*\SuggestedBy[2]{%
+  \hskip1sp
+  \marginpar{%
+    \parbox[b]{\marginparwidth}{\small\sffamily\raggedright
+      \strut Suggested by\\#1\\#2%
+    }
+  }%
+}
+
+
+
 \newcommand*\cttPosting[2]{%
   \hskip1sp
   \marginpar{%
@@ -203,6 +214,18 @@ and the derived files
     }%
   }%
 }
+
+\newcommand*\tsxchatPosting[3][Requested on]{%
+  \hskip1sp
+  \marginpar{%
+    \parbox[b]{\marginparwidth}{\small\sffamily\raggedright
+     \strut #1 \texttt{\scriptsize tex.stackexchange.com chat} \\#2\\#3%
+    }%
+  }%
+}
+
+
+
 \newcommand*\CommentAdded[1]{%
   \hskip1sp
   \marginpar{%
@@ -267,8 +290,19 @@ and the derived files
 \let\MTtheindex\theindex
 \def\theindex{\MTtheindex\MakePrivateLetters}
 
+
+%\usepackage[draft]{fixme}
+%\fxsetup{
+% multiuser,
+%layout=marginnote,
+%}
+%\providecommand\fxnote[2][]{}
+
+\usepackage{xurl}
+
 \usepackage[final,
 hyperindex=false,
+colorlinks,
 ]{hyperref}
 \renewcommand*\usage[1]{\textit{\hyperpage{#1}}}
 
@@ -335,7 +369,7 @@ hyperindex=false,
 %  
 %
 % \medskip\noindent
-% Update 2013: We now makes \cs{(}\cs{)} and \cs[\cs]
+% Update 2013: We now make \cs{(}\cs{)} and \cs[\cs]
 % robust (can be disabled via \texttt{nonrobust} package option).
 % 
 %  \section{Package loading}
@@ -608,6 +642,47 @@ hyperindex=false,
 %  one, thus letting \TeX{} make the choice only once rather than
 %  twice.
 %
+%  \begin{codesyntax}
+%    \SpecialEnvIndex{crampedsubarray}\cs{begin}\arg{crampedsubarray}\marg{col}
+%        \meta{contents} \cs{end}\arg{crampedsubarray}\\
+%    \SpecialUsageIndex{\crampedsubstack}
+%    \cs{crampedsubstack}\marg{lines separated by \cs{}\cs{}}
+% \end{codesyntax}
+% \SuggestedBy{Henri Menke}{2019/07/08} If we go back to
+% \eqref{eq:mathclap} and apply \cs{substack}, you'll notice that the
+% cramped style, the sum would normally apply, is now gone:
+% \begin{verbatim}
+%  \[
+%    \sum_{\substack{a^2<b^2<c}}\qquad
+%    \sum_{a^2<b^2<c}
+%  \]
+% \end{verbatim}
+%  \begingroup \fontsize{24}{\baselineskip}\selectfont
+%  \[
+%    \sum_{\substack{a^2<b^2<c}}\qquad
+%    \sum_{a^2<b^2<c}
+%  \]
+%  \endgroup 
+%  We therefore provide a cramped version of
+%  \cs{substack}.\footnote{\cs{substack} is internally implemented via
+%  the \env{subarray}-env, so our cramped version of \cs{substack} is implemented via a
+%  cramped version of this env.}
+% \begin{verbatim}
+%  \[
+%    \sum_{\crampedsubstack{a^2<b^2<c}}\qquad
+%    \sum_{a^2<b^2<c}
+%  \]
+% \end{verbatim}
+%  \begingroup \fontsize{24}{\baselineskip}\selectfont
+%  \[
+%    \sum_{\crampedsubstack{a^2<b^2<c}}\qquad
+%    \sum_{a^2<b^2<c}
+%  \]
+%  \endgroup 
+%  Note: We may need to add a similar hook into multlined. 
+%
+%
+%
 %
 %
 %  \subsubsection{Smashing an operator}
@@ -1238,10 +1313,12 @@ hyperindex=false,
 %
 % As an extra trick the fences will behave as open and closing fences
 % in constract to their auto-scaling nature.\footnote{\cs{left} and
-%   \cs{right} do \emph{not} produce open and closing fences, thus
-%   the space before or after may be too large. Inside this
-%   construction they behave.}
+% \cs{right} creates an \emph{inner} construction, and not as one
+% might expect something where a preceeding \cs{sin} sees an opening
+% fence, thus the space before or after may be too large. Inside this
+% construction they behave.}
 % 
+%
 %  \subsubsection{The \env{multlined} environment}
 %
 %  \begin{codesyntax}
@@ -1347,15 +1424,18 @@ hyperindex=false,
 %  \medskip\noindent
 %  \textbf{Bug 2:}
 %  \CommentAdded{2015/11/12}  
-%  Due to the way \env{multilined} is implemented, certain
+%  Due to the way \env{multlined} is implemented, certain
 %  constructions does not work inside \env{multlined}. We have added a
 %  hook (\cs{MultlinedHook}) that can be added to. The default value
-%  is a fix for \env{subarray} and thus \cs{substack}.
+%  is a fix for \env{subarray} and \env{crampedsubarray} and thus for
+%  \cs{substack} and \cs{crampedsubstack} (and a few others, thus add
+%  to the hook, don't replace it).
 %
 %  This can actually be used to fix Bug~1:
 % \begin{verbatim}
 % \usepackage{mathtools,etoolbox}
-% \newlength\Normalbaselineskip{\baselineskip} 
+% \newlength\Normalbaselineskip
+% \setlength\Normalbaselineskip{\baselineskip} 
 % \appto\MultlinedHook{
 %   \setlength\baselineskip{\Normalbaselineskip}
 % }
@@ -1973,7 +2053,11 @@ hyperindex=false,
 % \end{verbatim}
 % \[ \Set*{ x \in X \given \frac{\sqrt{x}}{x^2+1} > 1 } \]
 % Thus we end up with a syntax much closer to how we read this
-% aloud. Also we hide the `given' symbol for easy replacement.
+% aloud. Also we hide the `given' symbol for easy
+% replacement.\footnote{The \cs{nonscript} construction removes the
+% \cs{:} in sub- and superscript, this might not always be
+% peferable. You can use
+% \cs{mathchoice\{}\cs{:\}\{}\cs{:\}\{}\cs{,\}\{}\cs{,\}} instead of \cs{nonscript}\cs{:}.}
 %
 % Combining with \pkg{etoolbox} it becomes easy to make a function
 % that automatically provide a marker for a blank argument:
@@ -2016,7 +2100,7 @@ hyperindex=false,
 % A probability macro with build in support for conditionals
 % (\cs{given} initialized as above)
 % \begin{verbatim}
-% \DeclarePairedDelimiterXPP\Prop[1]{\mathbb{P}}(){}{
+% \DeclarePairedDelimiterXPP\Prob[1]{\mathbb{P}}(){}{
 %   \renewcommand\given{\nonscript\:\delimsize\vert\nonscript\:\mathopen{}}
 %   #1}
 % \end{verbatim}
@@ -2410,6 +2494,7 @@ hyperindex=false,
 % (Though a package like \pkg{mhchem} might be more suitable for this
 % type of material.)
 %
+%
 %  \subsection{Declaring math sizes}
 %
 %  \begin{codesyntax}
@@ -2698,7 +2783,7 @@ hyperindex=false,
 %     American Mathematical Society, updated edition, 1999.
 %     Updated by Arlene O'Sean and Antoinette Schleyer.
 %   \bibitem{TBT}
-%   Victor Eijkhout, \emph{\TeX\ by Topic, A Texnician’s Reference}, 2007. 
+%   Victor Eijkhout, \emph{\TeX\ by Topic, A Texnician's Reference}, 2007. 
 %   Freely available at \url{http://ctan.org/tex-archive/info/texbytopic}.
 %  \end{thebibliography}
 %
@@ -2713,7 +2798,7 @@ hyperindex=false,
 %    \begin{macrocode}
 %<*package>
 \ProvidesPackage{mathtools}%
-  [2018/01/08 v1.21 mathematical typesetting tools]
+  [2019/07/31 v1.22 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}}
@@ -3858,6 +3943,9 @@ hyperindex=false,
 % \env{multlined}. The default value include a fix to \env{subarray}
 % and thus \cs{substack}. The fix to this environment was suggested by
 % Ulrike Fisher, \url{http://chat.stackexchange.com/transcript/message/25105970#25105970}
+% \changes{v1.22}{2019/07/22}{Also added crampedsubarray}
+% \changes{v1.22}{2019/07/22}{Also added fixes for smallmatrix and the
+% MT versions of these}
 %    \begin{macrocode}
 \newcommand\MultlinedHook{
   \renewenvironment{subarray}[1]{%
@@ -3873,6 +3961,37 @@ hyperindex=false,
   }{%
     \crcr\egroup\egroup
   }
+  \renewenvironment{crampedsubarray}[1]{%
+    \vcenter\bgroup
+    \Let@ \restore@math@cr \default@tag
+    \let\math@cr@@\AMS@math@cr@@  % <--- the fix
+    \baselineskip\fontdimen10 \scriptfont\tw@
+    \advance\baselineskip\fontdimen12 \scriptfont\tw@
+    \lineskip\thr@@\fontdimen8 \scriptfont\thr@@
+    \lineskiplimit\lineskip
+    \ialign\bgroup\ifx c##1\hfil\fi
+    $\m@th\scriptstyle\kern-\nulldelimiterspace\radical\z@{####}$
+    \hfil\crcr
+  }{%
+    \crcr\egroup\egroup
+  }
+   % from mathtolls
+  \def\MT_smallmatrix_begin:N ##1{%
+    \Let@\restore@math@cr\default@tag
+    \let\math@cr@@\AMS@math@cr@@  % <--- the fix
+    \baselineskip6\ex@ \lineskip1.5\ex@ \lineskiplimit\lineskip
+    \csname MT_smallmatrix_##1_begin:\endcsname
+  }
+  % from amsmath
+  \renewenvironment{smallmatrix}{\null\,\vcenter\bgroup
+    \Let@\restore@math@cr\default@tag
+    \let\math@cr@@\AMS@math@cr@@  % <--- the fix
+    \baselineskip6\ex@ \lineskip1.5\ex@ \lineskiplimit\lineskip
+    \ialign\bgroup\hfil$\m@th\scriptstyle####$\hfil&&\thickspace\hfil
+    $\m@th\scriptstyle####$\hfil\crcr
+  }{%
+    \crcr\egroup\egroup\,%
+  }
 }
 
 %    \end{macrocode}
@@ -4597,6 +4716,8 @@ hyperindex=false,
 \MHPrecedingSpacesOn
 %    \end{macrocode}
 %
+%
+%
 %  \subsection{Smashing an operator with limits}
 %
 %  \begin{macro}{\smashoperator}
@@ -5665,6 +5786,40 @@ hyperindex=false,
 %  \end{macro}
 %
 %
+%
+% \subsubsection{Cramped versions of subarray and \cs{substack}}
+%
+% 
+% \changes{v1.22}{2019/07/22}{Added cramped versions of subarray and \cs{substack}}
+% This was suggested by Henri Menke in
+% \url{https://github.com/latex3/latex2e/issues/149} and
+% \url{https://chat.stackexchange.com/transcript/message/50943985#50943985}. As we are slowly moving away from the expl3 like syntax, we'll implement this with an adjusted copy of \env{subarray} from \pkg{amsmath}.
+% \begin{environment}{crampedsubarray}
+%    \begin{macrocode}
+\newenvironment{crampedsubarray}[1]{%
+  \vcenter\bgroup
+  \Let@ \restore@math@cr \default@tag
+  \baselineskip\fontdimen10 \scriptfont\tw@
+  \advance\baselineskip\fontdimen12 \scriptfont\tw@
+  \lineskip\thr@@\fontdimen8 \scriptfont\thr@@
+  \lineskiplimit\lineskip
+  \ialign\bgroup\ifx c#1\hfil\fi
+  $\m@th\scriptstyle\kern-\nulldelimiterspace\radical\z@{##}$% <-- changed line
+  \hfil\crcr%
+}{%
+\crcr\egroup\egroup
+} 
+%    \end{macrocode}
+% \end{environment}
+% \begin{macro}{\crampedsubstack}
+% And the identical implementation for \cs{crampedsubstack}:
+%    \begin{macrocode}
+\newcommand{\crampedsubstack}[1]{\crampedsubarray{c}#1\endcrampedsubarray}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
 %  \section{Macros by Michael J.~Downes}
 %
 %  The macros in this section are all by Michael J.~Downes. Either
-- 
cgit v1.2.3

