diff options
author | Karl Berry <karl@freefriends.org> | 2020-10-04 21:14:57 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-10-04 21:14:57 +0000 |
commit | fc1b45abd004cf6f95b6fce5ecb2ad7083bea99f (patch) | |
tree | 666326a55348ebd6d698d79d41d364d8614e8789 /Master/texmf-dist/source | |
parent | a6964f23cf87c411367c10006ac47faab2ea782d (diff) |
lualatex-math (4oct20)
git-svn-id: svn://tug.org/texlive/trunk@56541 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/lualatex/lualatex-math/lualatex-math.dtx | 247 | ||||
-rw-r--r-- | Master/texmf-dist/source/lualatex/lualatex-math/lualatex-math.ins | 6 |
2 files changed, 157 insertions, 96 deletions
diff --git a/Master/texmf-dist/source/lualatex/lualatex-math/lualatex-math.dtx b/Master/texmf-dist/source/lualatex/lualatex-math/lualatex-math.dtx index 2ac5af66a54..3e8bbf0ea23 100644 --- a/Master/texmf-dist/source/lualatex/lualatex-math/lualatex-math.dtx +++ b/Master/texmf-dist/source/lualatex/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 @@ %</driver> % \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/Master/texmf-dist/source/lualatex/lualatex-math/lualatex-math.ins b/Master/texmf-dist/source/lualatex/lualatex-math/lualatex-math.ins index 175173b1a62..6b1fcbbc973 100644 --- a/Master/texmf-dist/source/lualatex/lualatex-math/lualatex-math.ins +++ b/Master/texmf-dist/source/lualatex/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 |