From 07723a50707217d2d397c098ec67af793cdfa916 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 5 Oct 2020 03:00:57 +0000 Subject: CTAN sync 202010050300 --- .../luatex/latex/lualatex-math/lualatex-math.dtx | 247 +++++++++++++-------- .../luatex/latex/lualatex-math/lualatex-math.ins | 6 +- .../luatex/latex/lualatex-math/lualatex-math.pdf | Bin 190559 -> 204676 bytes 3 files changed, 157 insertions(+), 96 deletions(-) (limited to 'macros/luatex/latex/lualatex-math') diff --git a/macros/luatex/latex/lualatex-math/lualatex-math.dtx b/macros/luatex/latex/lualatex-math/lualatex-math.dtx index 2ac5af66a5..3e8bbf0ea2 100644 --- a/macros/luatex/latex/lualatex-math/lualatex-math.dtx +++ b/macros/luatex/latex/lualatex-math/lualatex-math.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 2011–2019 by Philipp Stephani, Joseph Wright, and Will Robertson +% Copyright 2011–2020 by Philipp Stephani, Joseph Wright, and Will Robertson % % This file may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either @@ -31,7 +31,7 @@ % % \fi % -% \CheckSum{280} +% \CheckSum{300} % % \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 @@ -140,20 +140,21 @@ % math primitives} % \changes{v1.4a}{2015/08/24}{Avoid \cs{RequireLuaModule}} % \changes{v1.4a}{2015/09/16}{Load \pkg{luatexbase} only if required} +% \changes{v1.9}{2020/09/25}{Require 2020 version of \hologo{LaTeX2e}} +% \changes{v1.9}{2020/09/25}{Use builtin \hologo{LaTeX2e} hooks if available} % % \subsection{Requirements} % % \begin{macrocode} %<*package> %<@@=lltxmath> -\NeedsTeXFormat{LaTeX2e}[2009/09/24] +\NeedsTeXFormat{LaTeX2e}[2020/02/02] \RequirePackage{expl3}[2018/06/18] -\ProvidesExplPackage{lualatex-math}{2019/01/21}{1.8}% +\ProvidesExplPackage{lualatex-math}{2020/09/25}{1.9}% {Patches for mathematics typesetting with LuaLaTeX} \RequirePackage { etoolbox } [ 2007/10/08 ] \cs_if_exist:NF \newluabytecode { \RequirePackage { luatexbase } [ 2010/05/27 ] } -\RequirePackage { filehook } [ 2011/03/09 ] \directlua{require("lualatex-math")} % \end{macrocode} % @@ -313,6 +314,46 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\@@_before_package:nn} +% \begin{macro}{\@@_after_package:nn} +% The macro \cmd{\@@_before_package:nn}\marg{package}\marg{code} executes the +% \meta{code} before the \meta{package} is loaded. Accordingly, +% \cmd{\@@_after_package:nn}\marg{package}\marg{code} executes the +% \meta{code} after the \meta{package} is loaded. If the \meta{package} is +% already loaded, nothing happens. We prefer using native \hologo{LaTeX2e} +% hooks if possible. +% \begin{macrocode} +\@ifl@t@r \fmtversion { 2020/10/01 } { + \cs_new_protected_nopar:Npn \@@_before_package:nn #1 #2 { + \AddToHook { package/before/#1 } { #2 } + } + \cs_new_protected_nopar:Npn \@@_after_package:nn #1 #2 { + \AddToHook { package/after/#1 } { #2 } + } +} { + \RequirePackage { filehook } [ 2011/03/09 ] + \cs_new_protected_nopar:Npn \@@_before_package:nn #1 #2 { + \AtBeginOfPackageFile { #1 } { #2 } + } + \cs_new_protected_nopar:Npn \@@_after_package:nn #1 #2 { + \AtEndOfPackageFile { #1 } { #2 } + } +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_after_package_or_now:nn} +% The macro \cmd{\@@_after_package_or_now:nn}\marg{package}\marg{code} +% executes the \meta{code} after the \meta{package} is loaded. If the +% \meta{package} is already loaded, the \meta{code} is executed immediately. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_after_package_or_now:nn #1 #2 { + \@ifpackageloaded { #1 } { #2 } { \@@_after_package:nn { #1 } { #2 } } +} +% \end{macrocode} +% \end{macro} +% % % \subsection{\Hologo{LaTeX2e} kernel} % @@ -332,11 +373,14 @@ % This is obviously not the case, but we ignore other packages (\eg, % \pkg{nath}) for the moment. We only patch the \hologo{LaTeX2e} kernel % definition if the \pkg{amsmath} package is not loaded; the corresponding -% patch for \pkg{amsmath} follows below. +% patch for \pkg{amsmath} follows below. Since \cmd{\frac} is declared by +% \cmd{\DeclareRobustCommand}, we must patch the macro +% \cmd{\frac\textvisiblespace}. +% \changes{v1.9}{2020/09/25}{Adapt to changes in \hologo{LaTeX2e} kernel} % \begin{macrocode} \AtEndPreamble { \@ifpackageloaded { amsmath } { } { - \@@_patch:NNnnn \frac \cs_set_nopar:Npn { #1 #2 } { + \@@_patch:cNnnn { frac~ } \cs_set:Npn { #1 #2 } { { \begingroup #1 \endgroup \over #2 } @@ -367,6 +411,8 @@ % \item The fraction commands \cmd{\frac} and \cmd{\genfrac} don’t use the % \cmd{\Ustack} primitive. % \end{itemize} +% These problems have been fixed in version~2.17i of \pkg{amsmath}, so we don’t +% attempt to patch it if that version is loaded. % % \begin{macro}{\c_@@_std_minus_mathcode_int} % \begin{macro}{\c_@@_std_equal_mathcode_int} @@ -393,20 +439,22 @@ % can do, therefore we use the non-starred version of % \cmd{\AtBeginOfPackageFile}. % \changes{v1.2}{2013/01/13}{Replace removed macro \cs{chk_if_free_cs:N}} +% \changes{v1.9}{2020/09/25}{Don’t patch newer versions of \pkg{amsmath}} % \begin{macrocode} \tl_new:N \l_@@_minus_mathchar \tl_new:N \l_@@_equal_mathchar -\AtBeginOfPackageFile { amsmath } { - \@@_set_mathchar:NN \l_@@_minus_mathchar \- - \@@_set_mathchar:NN \l_@@_equal_mathchar \= +\@@_before_package:nn { amsmath } { + \@ifpackagelater { amsmath } { 2020/08/24 } { } { + \@@_set_mathchar:NN \l_@@_minus_mathchar \- + \@@_set_mathchar:NN \l_@@_equal_mathchar \= % \end{macrocode} % \end{macro} % \end{macro} % Now we temporarily reset the mathematical codes. % \begin{macrocode} - \char_set_mathcode:nn { `\- } { \c_@@_std_minus_mathcode_int } - \char_set_mathcode:nn { `\= } { \c_@@_std_equal_mathcode_int } - \AtEndOfPackageFile { amsmath } { + \char_set_mathcode:nn { `\- } { \c_@@_std_minus_mathcode_int } + \char_set_mathcode:nn { `\= } { \c_@@_std_equal_mathcode_int } + \@@_after_package:nn { amsmath } { % \end{macrocode} % \begin{macro}{\std@minus} % \begin{macro}{\std@equals} @@ -414,16 +462,17 @@ % and \cmd{\std@equal} as mathematical character shorthands while loading, % but uses our restored mathematical codes, which must be fixed. % \begin{macrocode} - \cs_set_eq:NN \std@minus \l_@@_minus_mathchar - \cs_set_eq:NN \std@equal \l_@@_equal_mathchar + \cs_set_eq:NN \std@minus \l_@@_minus_mathchar + \cs_set_eq:NN \std@equal \l_@@_equal_mathchar % \end{macrocode} % \end{macro} % \end{macro} % Finally, we restore the original mathematical codes of the two signs. % \changes{v1.8}{2019/01/21}{Stop using \cs{…:D} control sequences} % \begin{macrocode} - \Umathcodenum `\- \l_@@_minus_mathchar - \Umathcodenum `\= \l_@@_equal_mathchar + \Umathcodenum `\- \l_@@_minus_mathchar + \Umathcodenum `\= \l_@@_equal_mathchar + } } } % \end{macrocode} @@ -434,14 +483,17 @@ % \cmd{\std@equal} at the beginning of the document, so we also have to patch % the internal kernel macro \cmd{\@begindocumenthook} which contains the hook % code. +% \changes{v1.9}{2020/09/25}{Don’t patch newer versions of \pkg{amsmath}} % \begin{macrocode} -\AtEndOfPackageFile * { amsmath } { - \tl_replace_once:Nnn \@begindocumenthook { - \mathchardef \std@minus \mathcode `\- \relax - \mathchardef \std@equal \mathcode `\= \relax - } { - \@@_set_mathchar:NN \std@minus \- - \@@_set_mathchar:NN \std@equal \= +\@@_after_package_or_now:nn { amsmath } { + \@ifpackagelater { amsmath } { 2020/08/24 } { } { + \tl_replace_once:Nnn \@begindocumenthook { + \mathchardef \std@minus \mathcode `\- \relax + \mathchardef \std@equal \mathcode `\= \relax + } { + \@@_set_mathchar:NN \std@minus \- + \@@_set_mathchar:NN \std@equal \= + } } % \end{macrocode} % \end{macro} @@ -458,48 +510,51 @@ % minimum vertical gap for stack for the minimum baseline distance % (\cmd{\lineskip}). % \changes{v1.8}{2019/01/21}{Stop using \cs{…:D} control sequences} +% \changes{v1.9}{2020/09/25}{Don’t patch newer versions of \pkg{amsmath}} +% \changes{v1.9}{2020/09/25}{Stop using \cs{…:D} control sequences} % \begin{macrocode} - \@@_patch:NNnnn \subarray \cs_set:Npn { #1 } { - \vcenter - \bgroup - \Let@ - \restore@math@cr - \default@tag - \baselineskip \fontdimen 10~ \scriptfont \tw@ - \advance \baselineskip \fontdimen 12~ \scriptfont \tw@ + \@ifpackagelater { amsmath } { 2020/09/23 } { } { + \@@_patch:NNnnn \subarray \cs_set:Npn { #1 } { + \vcenter + \bgroup + \Let@ + \restore@math@cr + \default@tag + \baselineskip \fontdimen 10~ \scriptfont \tw@ + \advance \baselineskip \fontdimen 12~ \scriptfont \tw@ %<@@=> - \lineskip \thr@@ \fontdimen 8~ \scriptfont \thr@@ + \lineskip \thr@@ \fontdimen 8~ \scriptfont \thr@@ %<@@=lltxmath> - \lineskiplimit \lineskip - \ialign - \bgroup - \ifx c #1 \hfil \fi - $ \m@th \scriptstyle ## $ - \hfil - \crcr - } { - \vcenter - \c_group_begin_token - \Let@ - \restore@math@cr - \default@tag - \skip_set:Nn \baselineskip { - \Umathstacknumup \scriptstyle - + \Umathstackdenomdown \scriptstyle + \lineskiplimit \lineskip + \ialign + \bgroup + \ifx c #1 \hfil \fi + $ \m@th \scriptstyle ## $ + \hfil + \crcr + } { + \vcenter + \c_group_begin_token + \Let@ + \restore@math@cr + \default@tag + \skip_set:Nn \baselineskip { + \Umathstacknumup \scriptstyle + + \Umathstackdenomdown \scriptstyle + } + \lineskip \Umathstackvgap \scriptstyle + \lineskiplimit \lineskip + \ialign + \c_group_begin_token + \token_if_eq_meaning:NNT c #1 { \hfil } + \Ustartmath + \m@th + \scriptstyle + \alignmark \alignmark + \Ustopmath + \hfil + \crcr } - \lineskip \Umathstackvgap \scriptstyle - \lineskiplimit \lineskip - \ialign - \c_group_begin_token - \token_if_eq_meaning:NNT c #1 { \hfil } - \Ustartmath - \m@th - \scriptstyle - \tex_alignmark:D \tex_alignmark:D - \Ustopmath - \hfil - \crcr - } % \end{macrocode} % \end{environment} % @@ -508,17 +563,17 @@ % the macro \cmd{\frac\textvisiblespace}. % \changes{v1.8}{2019/01/21}{Stop using \cs{…:D} control sequences} % \begin{macrocode} - \@@_patch:cNnnn { frac~ } \cs_set:Npn { #1 #2 } { - { + \@@_patch:cNnnn { frac~ } \cs_set:Npn { #1 #2 } { + { %<@@=> - \begingroup #1 \endgroup \@@over #2 - } - } { - { - \Ustack { \group_begin: #1 \group_end: \@@over #2 } + \begingroup #1 \endgroup \@@over #2 + } + } { + { + \Ustack { \group_begin: #1 \group_end: \@@over #2 } %<@@=lltxmath> + } } - } % \end{macrocode} % \end{macro} % @@ -529,33 +584,38 @@ % \changes{v1.7}{2017/06/15}{Adapt patch to changes in \pkg{amsmath}} % \changes{v1.8}{2019/01/21}{Stop using \cs{…:D} control sequences} % \begin{macrocode} - \@@_patch:cNnnn { genfrac~ } \cs_set:Npn { - #1 #2 #3 #4 #5 #6 - } { - { - \@mathstyle { #4 } - \genfrac@choice o { #1 } + \@@_patch:cNnnn { genfrac~ } \cs_set:Npn { + #1 #2 #3 #4 #5 #6 + } { { - \begingroup #5 \endgroup + \@mathstyle { #4 } + \genfrac@choice o { #1 } + { + \begingroup #5 \endgroup %<@@=> - \ifx @ #3 @ \@@over \else \@@above \fi #3 \relax - #6 + \ifx @ #3 @ \@@over \else \@@above \fi #3 \relax + #6 + } + \genfrac@choice c { #2 } } - \genfrac@choice c { #2 } - } - } { - { - \@mathstyle { #4 } - \genfrac@choice o { #1 } + } { { - \Ustack { - \group_begin: #5 \group_end: - \tl_if_empty:nTF { #3 } { \@@over } { \@@above #3 \scan_stop: } + \@mathstyle { #4 } + \genfrac@choice o { #1 } + { + \Ustack { + \group_begin: #5 \group_end: + \tl_if_empty:nTF { #3 } { + \@@over + } { + \@@above #3 \scan_stop: + } %<@@=lltxmath> - #6 + #6 + } } + \genfrac@choice c { #2 } } - \genfrac@choice c { #2 } } } } @@ -583,7 +643,7 @@ % possible as well, but we avoid this way since we want to patch only a % single command. % \begin{macrocode} -\AtEndOfPackageFile * { mathtools } { +\@@_after_package_or_now:nn { mathtools } { \@@_patch:NNnnn \MT_cramped_internal:Nn \cs_set_nopar:Npn { #1 #2 } { \sbox \z@ { @@ -621,10 +681,11 @@ % changed mathematical style would be applied to the material after the % \cmd{\mathchoice} construct. As the original command works in both text and % math mode, we use |\ensuremath| here. +% \changes{v1.9}{2020/09/25}{Stop using \cs{…:D} control sequences} % \begin{macrocode} { \ensuremath { - \use:c { luatex_cramped \cs_to_str:N #1 :D } #2 + \use:c { cramped \cs_to_str:N #1 } #2 } } } @@ -646,7 +707,7 @@ % the beginning of the document, therefore we again patch % \cmd{\@begindocumenthook}. % \begin{macrocode} -\AtEndOfPackageFile * { icomma } { +\@@_after_package_or_now:nn { icomma } { \tl_replace_once:Nnn \@begindocumenthook { \mathchardef \mathcomma \mathcode `\, } { diff --git a/macros/luatex/latex/lualatex-math/lualatex-math.ins b/macros/luatex/latex/lualatex-math/lualatex-math.ins index 175173b1a6..6b1fcbbc97 100644 --- a/macros/luatex/latex/lualatex-math/lualatex-math.ins +++ b/macros/luatex/latex/lualatex-math/lualatex-math.ins @@ -1,5 +1,5 @@ % lualatex-math.ins -% Copyright 2011, 2012, 2013, 2017 Philipp Stephani +% Copyright 2011, 2012, 2013, 2017, 2020 Philipp Stephani % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either @@ -26,7 +26,7 @@ This is a generated file. -Copyright 2011-2017 Philipp Stephani +Copyright 2011-2020 Philipp Stephani This file may be distributed and/or modified under the conditions of the LaTeX Project Public License, either @@ -50,7 +50,7 @@ LaTeX version 2009/09/24 or later. This is a generated file. -Copyright 2011-2017 Philipp Stephani +Copyright 2011-2020 Philipp Stephani This file may be distributed and/or modified under the conditions of the LaTeX Project Public License, either diff --git a/macros/luatex/latex/lualatex-math/lualatex-math.pdf b/macros/luatex/latex/lualatex-math/lualatex-math.pdf index c1728ca518..98334afa6f 100644 Binary files a/macros/luatex/latex/lualatex-math/lualatex-math.pdf and b/macros/luatex/latex/lualatex-math/lualatex-math.pdf differ -- cgit v1.2.3