summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/mathtools/mathtools.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-03-29 03:01:50 +0000
committerNorbert Preining <norbert@preining.info>2021-03-29 03:01:50 +0000
commit3c5dd0d2f091e5e866af1de0327171b253ec9178 (patch)
tree071536c70fd090a23a7ff157f5143aa91ce94330 /macros/latex/contrib/mathtools/mathtools.dtx
parentddd501183c3e68b7a98bdeb023d0b98ef84dae22 (diff)
CTAN sync 202103290301
Diffstat (limited to 'macros/latex/contrib/mathtools/mathtools.dtx')
-rw-r--r--macros/latex/contrib/mathtools/mathtools.dtx224
1 files changed, 166 insertions, 58 deletions
diff --git a/macros/latex/contrib/mathtools/mathtools.dtx b/macros/latex/contrib/mathtools/mathtools.dtx
index 68672cfe35..4078ac8a4d 100644
--- a/macros/latex/contrib/mathtools/mathtools.dtx
+++ b/macros/latex/contrib/mathtools/mathtools.dtx
@@ -69,7 +69,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: mathtools 2021/03/18 v1.25}
+\Msg{* Package: mathtools 2021/03/28 v1.26}
\Msg{************************************************************************}
\keepsilent
@@ -133,7 +133,7 @@ and the derived files
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{mathtools.drv}%
- [2021/03/18 v1.25 mathematical typesetting tools]
+ [2021/03/28 v1.28 mathematical typesetting tools]
\documentclass{ltxdoc}
\IfFileExists{fourier.sty}{\usepackage{fourier}}{}
\addtolength\marginparwidth{-25pt}
@@ -321,7 +321,7 @@ colorlinks,
%
% \GetFileInfo{mathtools.drv}
%
-% \CheckSum{3364}
+% \CheckSum{3529}
%
% \title{The \pkg{mathtools} package\thanks{This file has version number
% \fileversion, last revised \filedate.}}
@@ -2982,7 +2982,7 @@ colorlinks,
% \begin{macrocode}
%<*package>
\ProvidesPackage{mathtools}%
- [2021/03/18 v1.25 mathematical typesetting tools]
+ [2021/03/28 v1.26 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}}
@@ -4135,59 +4135,122 @@ colorlinks,
% \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]{%
- \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####$\hfil\crcr
- }{%
- \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
+% \changes{v1.26}{2021/03/27}{We need a lualatex branch of this as
+% well. We need to find a better way to manage this. Patching?}
+% \begin{macrocode}
+\ifx\directlua\@undefined
+ % THIS IS NORMAL
+ \newcommand\MultlinedHook{
+ \renewenvironment{subarray}[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####$\hfil\crcr
+ }{%
+ \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
% \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
- }
- % 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
+ \span\MT_cramped_internal:Nn \scriptstyle {####}%
+ \hfil\crcr
+ }{%
+ \crcr\egroup\egroup
+ }
+ % from mathtools
+ \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\,%
+ }
}
- % 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\,%
+\else
+% \end{macrocode}
+% The LuaLaTeX version, only difference is the definition of crampedsubarray
+% \begin{macrocode}
+ % THIS IS LUALATEX
+ \newcommand\MultlinedHook{
+ % from amsmath
+ \newenvironment{subarray}[1]{%
+ \vcenter\bgroup
+ \Let@ \restore@math@cr \default@tag
+ \let\math@cr@@\AMS@math@cr@@ % <--- the fix
+ \baselineskip \Umathstacknumup \scriptstyle
+ \advance\baselineskip \Umathstackdenomdown \scriptstyle
+ \lineskip \Umathstackvgap \scriptstyle
+ \lineskiplimit \lineskip
+ \ialign\bgroup\ifx c##1\hfil\fi
+ \Ustartmath
+ \m@th\scriptstyle####
+ \Ustopmath
+ \hfil\crcr
+ }{%
+ \crcr\egroup\egroup
+ }
+ % from mathtools
+ \newenvironment{crampedsubarray}[1]{%
+ \vcenter\bgroup
+ \Let@ \restore@math@cr \default@tag
+ \let\math@cr@@\AMS@math@cr@@ % <--- the fix
+ \baselineskip \Umathstacknumup \scriptstyle
+ \advance\baselineskip \Umathstackdenomdown \scriptstyle
+ \lineskip \Umathstackvgap \scriptstyle
+ \lineskiplimit \lineskip
+ \ialign\bgroup\ifx c##1\hfil\fi
+ \Ustartmath
+ \crampedscriptstyle{####}
+ \Ustopmath
+ \hfil\crcr
+ }{%
+ \crcr\egroup\egroup
+ }
+ % from mathtools
+ \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\,%
+ }
}
-}
+\fi
+
% \end{macrocode}
% \end{macro}
@@ -5961,6 +6024,25 @@ colorlinks,
{}\box\z@
}
% \end{macrocode}
+% For LuaLaTeX we can use much less code as they have
+% their own direct \cs{cramped...} macros. Directly listed
+% from \verb|lualatex-math.sty| v1.9 2020/09/25 by Philipp Stephani. Quote: ``Here the
+% additional set of braces is absolutely necessary, otherwise the changed
+% mathematical style would be applied to the material after the
+% \cs{mathchoice} construct. As the original (mathtools) command works in both text and
+% math mode, we use \cs{ensuremath} here.''
+% \begin{macrocode}
+\ifx\directlua\@undefined\else
+ \def\MT_cramped_internal:Nn #1#2{
+ {
+ \ensuremath {
+ \use:c { cramped \cs_to_str:N #1 } #2
+ }
+ }
+ }
+\fi
+
+% \end{macrocode}
% \end{macro}
%
% \subsubsection{Cramped versions of \texttt{\textbackslash
@@ -6019,12 +6101,18 @@ colorlinks,
% \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
+% \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}.
+% \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}.
+% \changes{v1.26}{2021/03/27}{Fresh copy of subarray from \pkg{amsmath}
+% including the lualatex branch}
% \begin{environment}{crampedsubarray}
% \begin{macrocode}
+\ifx\directlua\@undefined
\newenvironment{crampedsubarray}[1]{%
\vcenter\bgroup
\Let@ \restore@math@cr \default@tag
@@ -6039,12 +6127,32 @@ colorlinks,
% \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%
+ %%$\m@th\scriptstyle\kern-\nulldelimiterspace\radical\z@{##}$% <-- changed line
+ \span\MT_cramped_internal:Nn \scriptstyle {##}%
+ \hfil\crcr
}{%
-\crcr\egroup\egroup
-}
+ \crcr\egroup\egroup
+}
+\else
+\newenvironment{crampedsubarray}[1]{%
+ \vcenter\bgroup
+ \Let@ \restore@math@cr \default@tag
+ \baselineskip \Umathstacknumup \scriptstyle
+ \advance\baselineskip \Umathstackdenomdown \scriptstyle
+ \lineskip \Umathstackvgap \scriptstyle
+ \lineskiplimit \lineskip
+ \ialign\bgroup\ifx c#1\hfil\fi
+ \Ustartmath
+% \end{macrocode}
+% Here we simply use the build in cramped command from LuaLaTeX
+% \begin{macrocode}
+ \crampedscriptstyle{##}
+ \Ustopmath
+ \hfil\crcr
+}{%
+ \crcr\egroup\egroup
+}
+\fi
% \end{macrocode}
% \end{environment}
% \begin{macro}{\crampedsubstack}