summaryrefslogtreecommitdiff
path: root/macros/luatex/latex/lualatex-math/lualatex-math.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/latex/lualatex-math/lualatex-math.dtx')
-rw-r--r--macros/luatex/latex/lualatex-math/lualatex-math.dtx89
1 files changed, 55 insertions, 34 deletions
diff --git a/macros/luatex/latex/lualatex-math/lualatex-math.dtx b/macros/luatex/latex/lualatex-math/lualatex-math.dtx
index 3e8bbf0ea2..cde46540af 100644
--- a/macros/luatex/latex/lualatex-math/lualatex-math.dtx
+++ b/macros/luatex/latex/lualatex-math/lualatex-math.dtx
@@ -1,6 +1,7 @@
% \iffalse meta-comment
%
% Copyright 2011–2020 by Philipp Stephani, Joseph Wright, and Will Robertson
+% Copyright 2021 Google LLC
%
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
@@ -31,7 +32,7 @@
%</driver>
% \fi
%
-% \CheckSum{300}
+% \CheckSum{314}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -150,7 +151,7 @@
%<@@=lltxmath>
\NeedsTeXFormat{LaTeX2e}[2020/02/02]
\RequirePackage{expl3}[2018/06/18]
-\ProvidesExplPackage{lualatex-math}{2020/09/25}{1.9}%
+\ProvidesExplPackage{lualatex-math}{2021/07/05}{1.11}%
{Patches for mathematics typesetting with LuaLaTeX}
\RequirePackage { etoolbox } [ 2007/10/08 ]
\cs_if_exist:NF \newluabytecode
@@ -634,6 +635,11 @@
% internal version use a hack involving a null radical. \Hologo{LuaTeX} has
% primitives for setting material in cramped mode, so we make use of them.
%
+% In newer versions of \pkg{mathtools}, this issue is fixed, in which case we
+% skip the patch.
+% \changes{v1.10}{2021/03/28}{Skip patch if \pkg{mathtools} is recent enough}
+% \changes{v1.11}{2021/07/05}{Adapt to March 2021 changes to \pkg{mathtools}}
+%
% \begin{macro}{\MT_cramped_internal:Nn}
% The macro \cmd{\MT_cramped_internal:Nn}\meta{style}\marg{expression}
% typesets the \meta{expression} in the cramped style corresponding to the
@@ -644,36 +650,39 @@
% single command.
% \begin{macrocode}
\@@_after_package_or_now:nn { mathtools } {
- \@@_patch:NNnnn \MT_cramped_internal:Nn
- \cs_set_nopar:Npn { #1 #2 } {
- \sbox \z@ {
- $
- \m@th
- #1
- \nulldelimiterspace = \z@
- \radical \z@ { #2 }
- $
- }
- \ifx #1 \displaystyle
- \dimen@ = \fontdimen 8 \textfont 3
- \advance \dimen@ .25 \fontdimen 5 \textfont 2
- \else
- \dimen@ = 1.25 \fontdimen 8
- \ifx #1 \textstyle
- \textfont
+ \@ifpackagelater { mathtools } { 2021/03/28 } { } {
+ \@@_patch:NNnnn \MT_cramped_internal:Nn
+ \cs_set_nopar:Npn { #1 #2 } {
+ \setbox \z@ \hbox {
+ $
+ \m@th
+ #1
+ \kern -\nulldelimiterspace
+ \radical \z@ { #2 }
+ $
+ }
+ \ifx #1 \displaystyle
+ \dimen@ = \fontdimen 8 \textfont 3
+ \advance \dimen@ .25 \fontdimen 5 \textfont 2
\else
- \ifx #1 \scriptstyle
- \scriptfont
+ \dimen@ = 1.25 \fontdimen 8
+ \ifx #1 \textstyle
+ \textfont
\else
- \scriptscriptfont
+ \ifx #1 \scriptstyle
+ \scriptfont
+ \else
+ \scriptscriptfont
+ \fi
\fi
+ 3
\fi
- 3
- \fi
- \advance \dimen@ -\ht\z@
- \ht\z@ = -\dimen@
- \box\z@
- } {
+ \advance \dimen@ -\ht\z@
+ \ht\z@ = -\dimen@
+ \ifvmode \leavevmode \fi
+ { }
+ \box\z@
+ } {
% \end{macrocode}
% \changes{v1.4}{2014/08/18}{Added \cs{ensuremath} to work around
% \href{https://github.com/phst/lualatex-math/issues/11}{issue~11}}
@@ -683,9 +692,10 @@
% math mode, we use |\ensuremath| here.
% \changes{v1.9}{2020/09/25}{Stop using \cs{…:D} control sequences}
% \begin{macrocode}
- {
- \ensuremath {
- \use:c { cramped \cs_to_str:N #1 } #2
+ {
+ \ensuremath {
+ \use:c { cramped \cs_to_str:N #1 } #2
+ }
}
}
}
@@ -701,6 +711,8 @@
% the comma character. This breaks for Unicode fonts. The incompatibility was
% noticed by
% \Breitfeld.\footnote{\url{https://groups.google.com/forum/\#!topic/de.comp.text.tex/Cputk-AJS5I/discussion}}
+% \changes{v1.10}{2021/03/28}{Use new \Hologo{LaTeX2e} hook management if
+% available}
%
% \begin{macro}{\mathcomma}
% \pkg{icomma} defines the mathemathical character shorthand \cmd{\icomma} at
@@ -708,10 +720,19 @@
% \cmd{\@begindocumenthook}.
% \begin{macrocode}
\@@_after_package_or_now:nn { icomma } {
- \tl_replace_once:Nnn \@begindocumenthook {
- \mathchardef \mathcomma \mathcode `\,
+ \@ifl@t@r \fmtversion { 2020/10/01 } {
+ \hook_gput_code:nnn { begindocument } { lualatex-math } {
+ \@@_set_mathchar:NN \mathcomma \,
+ \mathcode `\, = "8000 ~
+ }
+ \hook_gset_rule:nnnn
+ { begindocument } { lualatex-math } { voids } { icomma }
} {
- \@@_set_mathchar:NN \mathcomma \,
+ \tl_replace_once:Nnn \@begindocumenthook {
+ \mathchardef \mathcomma \mathcode `\,
+ } {
+ \@@_set_mathchar:NN \mathcomma \,
+ }
}
}
%</package>