[latex3-commits] [git/LaTeX3-latex3-mathtools] master: issue #24, now the patch in lualatex-math should not be needed (2f4de3c)

daleif daleif at math.au.dk
Sat Mar 27 16:56:06 CET 2021


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

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

commit 2f4de3ce1f6552f1f8dd982b9988d36f56cfec93
Author: daleif <daleif at math.au.dk>
Date:   Sat Mar 27 16:56:06 2021 +0100

    issue #24, now the patch in lualatex-math should not be needed


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

2f4de3ce1f6552f1f8dd982b9988d36f56cfec93
 ANNOUNCEMENT  |   4 +-
 mathtools.dtx | 214 ++++++++++++++++++++++++++++++++--------------------------
 2 files changed, 122 insertions(+), 96 deletions(-)

diff --git a/ANNOUNCEMENT b/ANNOUNCEMENT
index ea5eb7f..175284a 100644
--- a/ANNOUNCEMENT
+++ b/ANNOUNCEMENT
@@ -2,7 +2,9 @@ Announcement release 2021/03/xx
 
 For mathtools.dtx v1.26:
 
-* fixed issue #24
+* LuaLaTeX has cramped primitives build in. We ought to use those when LuaLaTeX is used.
+  LuaLaTeX brances added,  fixing issue #24.
+  Special thanks to Marcel Krüger, Ulrike Fischer and Philipp Stephani.
 
 Announcement release 2021/03/18
 
diff --git a/mathtools.dtx b/mathtools.dtx
index 9d13e74..6f46213 100644
--- a/mathtools.dtx
+++ b/mathtools.dtx
@@ -321,7 +321,7 @@ colorlinks,
 %
 %  \GetFileInfo{mathtools.drv}
 %
-%  \CheckSum{3519}
+%  \CheckSum{3529}
 %
 %  \title{The \pkg{mathtools} package\thanks{This file has version number
 %  \fileversion, last revised \filedate.}}
@@ -4140,111 +4140,115 @@ colorlinks,
 %    \begin{macrocode}
 \ifx\directlua\@undefined
   % THIS IS NORMAL
-\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
-  }
-  \renewenvironment{crampedsubarray}[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
+  \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
+    }
+    \renewenvironment{crampedsubarray}[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
 %    \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}
       \span\MT_cramped_internal:Nn \scriptstyle {####}%
-    \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\,%
+      \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\,%
+    }
   }
-}
 \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\,%
+  \newcommand\MultlinedHook{
+    % from amsmath
+    \newenvironment{subarray}[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
+      \m at th\scriptstyle####
+      \Ustopmath
+      \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
 
 
@@ -6019,6 +6023,25 @@ colorlinks,
     \ifvmode\leavevmode\fi
     {}\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}
 %
@@ -6104,8 +6127,9 @@ colorlinks,
 % \changes{v1.25}{2021/03/18}{Added \cs{MT_cramped_internal:Nn}, see
 % issue \#17}
 %    \begin{macrocode}
-  %%$\m at th\scriptstyle\kern-\nulldelimiterspace\radical\z@{##}$% <-- changed line
-  \span\MT_cramped_internal:Nn \scriptstyle {##}%
+     %%$\m at th\scriptstyle\kern-\nulldelimiterspace\radical\z@{##}$% <-- changed line
+    \span\MT_cramped_internal:Nn \scriptstyle {##}%
+  \hfil\crcr
 }{%
   \crcr\egroup\egroup
 }





More information about the latex3-commits mailing list.