[latex3-commits] [git/LaTeX3-latex3-mathtools] master: fixes part of issue #24, need to take over the patching of \MT_cramped_internal:Nn for lualatex as well (b8955c1)

daleif daleif at math.au.dk
Sat Mar 27 16:21:41 CET 2021


Repository : https://github.com/latex3/mathtools
On branch  : master
Link       : https://github.com/latex3/mathtools/commit/b8955c11a20eb4d321640547e4852045dd7a1259

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

commit b8955c11a20eb4d321640547e4852045dd7a1259
Author: daleif <daleif at math.au.dk>
Date:   Sat Mar 27 16:21:41 2021 +0100

    fixes part of issue #24, need to take over the patching of \MT_cramped_internal:Nn for lualatex as well


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

b8955c11a20eb4d321640547e4852045dd7a1259
 ANNOUNCEMENT  |   6 ++++
 mathtools.dtx | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 99 insertions(+), 9 deletions(-)

diff --git a/ANNOUNCEMENT b/ANNOUNCEMENT
index 0007abe..ea5eb7f 100644
--- a/ANNOUNCEMENT
+++ b/ANNOUNCEMENT
@@ -1,3 +1,9 @@
+Announcement release 2021/03/xx
+
+For mathtools.dtx v1.26:
+
+* fixed issue #24
+
 Announcement release 2021/03/18
 
 For mathtools.dtx v1.25:
diff --git a/mathtools.dtx b/mathtools.dtx
index 68672cf..9d13e74 100644
--- a/mathtools.dtx
+++ b/mathtools.dtx
@@ -321,7 +321,7 @@ colorlinks,
 %
 %  \GetFileInfo{mathtools.drv}
 %
-%  \CheckSum{3364}
+%  \CheckSum{3519}
 %
 %  \title{The \pkg{mathtools} package\thanks{This file has version number
 %  \fileversion, last revised \filedate.}}
@@ -4135,7 +4135,11 @@ 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}
+% \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
@@ -4164,13 +4168,12 @@ colorlinks,
 % see issue \#17}
 % Here we should use the proper cramped internal macro
 %    \begin{macrocode}
-    %% $\m at th\scriptstyle\kern-\nulldelimiterspace\radical\z@{####}$
-    \span\MT_cramped_internal:Nn \scriptstyle {####}%
+      \span\MT_cramped_internal:Nn \scriptstyle {####}%
     \hfil\crcr
   }{%
     \crcr\egroup\egroup
   }
-   % from mathtolls
+   % from mathtools
   \def\MT_smallmatrix_begin:N ##1{%
     \Let@\restore at math@cr\default at tag
     \let\math at cr@@\AMS at math@cr@@  % <--- the fix
@@ -4188,6 +4191,62 @@ colorlinks,
     \crcr\egroup\egroup\,%
   }
 }
+\else
+%    \end{macrocode}
+% The LuaLaTeX version, only difference is the definition of crampedsubarray
+%    \begin{macrocode}
+  % THIS IS LUALATEX
+\newcommand\MultlinedHook{
+  \renewenvironment{subarray}[1]{%
+    \vcenter\bgroup
+    \Let@ \restore at math@cr \default at tag
+    \let\math at cr@@\AMS at 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 at th\scriptstyle####$\hfil\crcr
+  }{%
+    \crcr\egroup\egroup
+  }
+  % from mathtools
+  \newenvironment{crampedsubarray}[1]{%
+    \vcenter\bgroup
+    \Let@ \restore at math@cr \default at tag
+    \let\math at cr@@\AMS at 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 at math@cr\default at tag
+    \let\math at cr@@\AMS at 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 at math@cr\default at tag
+    \let\math at cr@@\AMS at math@cr@@  % <--- the fix
+    \baselineskip6\ex@ \lineskip1.5\ex@ \lineskiplimit\lineskip
+    \ialign\bgroup\hfil$\m at th\scriptstyle####$\hfil&&\thickspace\hfil
+    $\m at th\scriptstyle####$\hfil\crcr
+  }{%
+    \crcr\egroup\egroup\,%
+  }
+}
+\fi
+
 
 %    \end{macrocode}
 %  \end{macro}
@@ -6019,12 +6078,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 at math@cr \default at tag
@@ -6041,10 +6106,29 @@ colorlinks,
 %    \begin{macrocode}
   %%$\m at 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 at math@cr \default at 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}





More information about the latex3-commits mailing list.