[latex3-commits] [git/LaTeX3-latex3-latex2e] develop: Move lualatex math (#394) (392e2feb)

GitHub noreply at github.com
Sun Sep 27 13:27:11 CEST 2020


Repository : https://github.com/latex3/latex2e
On branch  : develop
Link       : https://github.com/latex3/latex2e/commit/392e2febd21629136c6254c33e3ee2c540a82ab2

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

commit 392e2febd21629136c6254c33e3ee2c540a82ab2
Author: Ulrike Fischer <news3 at nililand.de>
Date:   Sun Sep 27 13:27:11 2020 +0200

    Move lualatex math (#394)
    
    * moved lualatex-math patch of frac to amsmath
    
    * moved subarray patch from lualatex-math
    
    * moved genfrac patch from lualatex-math
    
    * correct changes entries
    
    * adapted changes.txt
    
    * checkout ltnews from develop
    
    * updated ltnews32
    
    * testfile
    
    * improved testfile
    
    Co-authored-by: Ulrike Fischer <fischer at troubleshooting-tex.de>
    Co-authored-by: David Carlisle <d.p.carlisle at gmail.com>


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

392e2febd21629136c6254c33e3ee2c540a82ab2
 base/doc/ltnews32.tex                              |   5 +
 required/amsmath/amsmath.dtx                       |  31 +++++-
 required/amsmath/changes.txt                       |   7 ++
 .../testfiles-TU/tlb-lualatex-math-move.luatex.tlg |  64 +++++++++++++
 .../testfiles-TU/tlb-lualatex-math-move.lvt        | 104 +++++++++++++++++++++
 .../testfiles-TU/tlb-lualatex-math-move.xetex.tlg  |   2 +-
 6 files changed, 209 insertions(+), 4 deletions(-)

diff --git a/base/doc/ltnews32.tex b/base/doc/ltnews32.tex
index 5cbde38c..973dac19 100644
--- a/base/doc/ltnews32.tex
+++ b/base/doc/ltnews32.tex
@@ -802,6 +802,11 @@ processed as part of the formula.
 commands to define \cs{std at minus} and \cs{std at equal}. This avoids a package like
 \pkg{unicode-math} having to patch the code in the begin document hook to change the commands.
 
+\subsection{Use lua\TeX{} primitives}
+
+For quite some years \pkg{lualatex-math} patched \cs{frac}, \cs{genfrac} and the \texttt{subarray} 
+environment to make use of new lua\TeX{} primitives. This code has now been 
+integrated into \pkg{amsmath}. 
 
 \section{Changes to the \pkg{babel} package}
 
diff --git a/required/amsmath/amsmath.dtx b/required/amsmath/amsmath.dtx
index 05b51683..7f324700 100644
--- a/required/amsmath/amsmath.dtx
+++ b/required/amsmath/amsmath.dtx
@@ -86,7 +86,7 @@ Bug reports can be opened (category \texttt{#1}) at\\%
 %    \end{macrocode}
 %
 %    \begin{macrocode}
-\ProvidesPackage{amsmath}[2020/08/24 v2.17h AMS math features]
+\ProvidesPackage{amsmath}[2020/09/23 v2.17i AMS math features]
 %    \end{macrocode}
 %
 % \section{Catcode defenses}
@@ -615,8 +615,14 @@ Foreign command \@backslashchar#1;\MessageBreak
 %    abbreviations for some commonly needed mathstyle overrides. To
 %    conserve csnames we avoid making \cn{dfrac} and \cn{tfrac} robust
 %    (\cn{genfrac} is itself robust).
+%    \changes{v2.17i}{2020/09/23}{added \cs{Ustack} for luatex (moved patch from lualatex-math)}
 %    \begin{macrocode}
+%
+\ifx\directlua\@undefined
 \DeclareRobustCommand{\frac}[2]{{\begingroup#1\endgroup\@@over#2}}
+\else
+\DeclareRobustCommand{\frac}[2]{{\Ustack{\begingroup#1\endgroup\@@over#2}}}
+\fi
 \newcommand{\dfrac}{\genfrac{}{}{}0}
 \newcommand{\tfrac}{\genfrac{}{}{}1}
 %    \end{macrocode}
@@ -749,12 +755,12 @@ Foreign command \@backslashchar#1;\MessageBreak
 \fi
 }
 %    \end{macrocode}
-%
+% \changes{v2.17i}{2020/09/23}{added \cs{Ustack} (moved patch from lualatex-math)}
 %    \begin{macrocode}
 \DeclareRobustCommand{\genfrac}[6]{{%
 \@mathstyle{#4}%
 \genfrac at choice o{#1}%
-{\begingroup#5\endgroup\ifx @#3@\@@over\else\@@above\fi#3\relax#6}%
+{\Ustack {\begingroup#5\endgroup\ifx @#3@\@@over\else\@@above\fi#3\relax#6}}%
 \genfrac at choice c{#2}%
 }}
 %    \end{macrocode}
@@ -2336,7 +2342,9 @@ Foreign command \@backslashchar#1;\MessageBreak
 %    for use in a subscript or superscript. At the moment the supported
 %    arguments are not the full possibilities of \env{array} but only
 %    |c| or |l| for centered or left-aligned. And only one column.
+%    \changes{v2.17i}{2020/09/23}{moved to version from lualatex-math for luatex}
 %    \begin{macrocode}
+\ifx\directlua\@undefined
 \newenvironment{subarray}[1]{%
 %    \end{macrocode}
 %    Note: The predecessors of \env{subarray} (\env{Sb} and \env{Sp},
@@ -2375,6 +2383,23 @@ Foreign command \@backslashchar#1;\MessageBreak
 }{%
   \crcr\egroup\egroup
 }
+\else
+\newenvironment{subarray}[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
+    \m at th\scriptstyle##
+  \Ustopmath
+  \hfil\crcr
+}{%
+  \crcr\egroup\egroup
+}
+\fi
 %    \end{macrocode}
 % \end{environment}
 %
diff --git a/required/amsmath/changes.txt b/required/amsmath/changes.txt
index 708510e1..be86f3c1 100644
--- a/required/amsmath/changes.txt
+++ b/required/amsmath/changes.txt
@@ -1,3 +1,10 @@
+2020/09/23 Ulrike Fischer <Ulrike.Fischer at latex-project.org>
+	* amsmath.dtx (subsection{Fractions}):
+	added \cs{Ustack} to \cs{frac} and \cs{genfrac} for luatex
+	(moved patch from lualatex-math)
+	* amsmath.dtx (section{Array-related environments})
+	changed subarray for luatex: moved to version from lualatex-math
+
 2020-08-24 Ulrike Fischer <Ulrike.Fischer at latex-project.org>
 
 	* amsmath.dtx (section{Extensible arrows}):
diff --git a/required/amsmath/testfiles-TU/tlb-lualatex-math-move.luatex.tlg b/required/amsmath/testfiles-TU/tlb-lualatex-math-move.luatex.tlg
new file mode 100644
index 00000000..2887e4b0
--- /dev/null
+++ b/required/amsmath/testfiles-TU/tlb-lualatex-math-move.luatex.tlg
@@ -0,0 +1,64 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
diff --git a/required/amsmath/testfiles-TU/tlb-lualatex-math-move.lvt b/required/amsmath/testfiles-TU/tlb-lualatex-math-move.lvt
new file mode 100644
index 00000000..71bdea22
--- /dev/null
+++ b/required/amsmath/testfiles-TU/tlb-lualatex-math-move.lvt
@@ -0,0 +1,104 @@
+% testfile for move of lualatex-math patches to amsmath.
+% Based on a test file from lualatex-math by Philipp Stephani
+\input{regression-test}
+\START
+%ignore xetex:
+\makeatletter
+\@ifundefined{directlua}{\typeout{test only for lualatex} \END}{}
+\OMIT
+\documentclass{minimal}
+\ExplSyntaxOn
+\cs_new_protected:Npn \AssertDimEqual #1#2
+  { \dim_compare:nNnTF {#1} = {#2} \TRUE \ERROR }
+\cs_new_protected:Npn \AssertIntEqual #1#2
+  { \int_compare:nNnTF {#1} = {#2} \TRUE \ERROR }
+\cs_new_protected:Npn \AssertMathStyle
+  { \AssertIntEqual \tex_mathstyle:D }
+\ExplSyntaxOff
+
+% First a scratch box register.
+\newsavebox{\testbox}
+% We set the mathematical code for the minus sign to some arbitrary Unicode
+% value to test whether amsmath sets it correctly.
+\Umathcode`\-="2 "33 "44444 \relax 
+\usepackage{amsmath}
+
+\TIMO
+
+\AssertIntEqual{\Umathcode`\-}{"33444444} %=arbitrary value above!
+\makeatletter
+\AssertIntEqual{\std at minus}{"33444444}
+\makeatother
+
+% an here an arbitrary value to test the behaviour at begin document
+\Umathcode`\="5 "66 "77777 \relax
+\OMIT
+
+\begin{document}
+
+\TIMO
+% test if amsmath uses the arbitrary value set after loading the package
+\AssertIntEqual{\Umathcode`\=}{"66A77777}
+\makeatletter
+\AssertIntEqual{\std at equal}{"66A77777}
+\makeatother
+
+% Here we test whether the strut box has the correct height and depth.
+\sbox{\testbox}{$($} % )
+\makeatletter
+\AssertDimEqual{\ht\Mathstrutbox@}{\ht\testbox}
+\AssertDimEqual{\dp\Mathstrutbox@}{\dp\testbox}
+\makeatother
+% Here we test for
+% sub-arrays and various kind of fraction-like objects.  The \cmd{\substack}
+% command and \env{subarray} environment aren’t really tested since it is hard
+% to check whether the outcome looks right in an automated way.  All tests are
+% done in both inline and display mode.
+\begin{equation*}
+  \AssertMathStyle{0} \sqrt{\AssertMathStyle{1}}
+  \sum_{
+    \substack{\frac12 \\ \frac34 \\ \frac56}
+  }
+  \sum_{
+    \begin{subarray}{l} \frac12 \\ \frac34 \\ \frac56 \end{subarray}
+  }
+  \frac{\AssertMathStyle{2}}{\AssertMathStyle{3}}
+  a^{\frac{\AssertMathStyle{6}}{\AssertMathStyle{7}}}
+  \dfrac{\AssertMathStyle{2}}{\AssertMathStyle{3}}
+  \tfrac{\AssertMathStyle{4}}{\AssertMathStyle{5}}
+  \binom{\AssertMathStyle{2}}{\AssertMathStyle{3}}
+  a^{\binom{\AssertMathStyle{6}}{\AssertMathStyle{7}}}
+  \dbinom{\AssertMathStyle{2}}{\AssertMathStyle{3}}
+  \tbinom{\AssertMathStyle{4}}{\AssertMathStyle{5}}
+  \genfrac{}{}{}{}{\AssertMathStyle{2}}{\AssertMathStyle{3}}
+  \genfrac{<}{/}{0pt}{0}{\AssertMathStyle{2}}{\AssertMathStyle{3}}
+  \genfrac{}{}{}{1}{\AssertMathStyle{4}}{\AssertMathStyle{5}}
+  \genfrac{|}{]}{4pt}{2}{\AssertMathStyle{6}}{\AssertMathStyle{7}}
+  \genfrac{}{}{}{3}{\AssertMathStyle{6}}{\AssertMathStyle{7}}
+\end{equation*}
+\begin{math}
+  \AssertMathStyle{2} \sqrt{\AssertMathStyle{3}}
+  \sum_{
+    \substack{\frac12 \\ \frac34 \\ \frac56}
+  }
+  \sum_{
+    \begin{subarray}{l} \frac12 \\ \frac34 \\ \frac56 \end{subarray}
+  }
+  \frac{\AssertMathStyle{4}}{\AssertMathStyle{5}}
+  a^{\frac{\AssertMathStyle{6}}{\AssertMathStyle{7}}}
+  \dfrac{\AssertMathStyle{2}}{\AssertMathStyle{3}}
+  \tfrac{\AssertMathStyle{4}}{\AssertMathStyle{5}}
+  \binom{\AssertMathStyle{4}}{\AssertMathStyle{5}}
+  a^{\binom{\AssertMathStyle{6}}{\AssertMathStyle{7}}}
+  \dbinom{\AssertMathStyle{2}}{\AssertMathStyle{3}}
+  \tbinom{\AssertMathStyle{4}}{\AssertMathStyle{5}}
+  \genfrac{}{}{}{}{\AssertMathStyle{4}}{\AssertMathStyle{5}}
+  \genfrac{<}{/}{0pt}{0}{\AssertMathStyle{2}}{\AssertMathStyle{3}}
+  \genfrac{}{}{}{1}{\AssertMathStyle{4}}{\AssertMathStyle{5}}
+  \genfrac{|}{]}{4pt}{2}{\AssertMathStyle{6}}{\AssertMathStyle{7}}
+  \genfrac{}{}{}{3}{\AssertMathStyle{6}}{\AssertMathStyle{7}}
+\end{math}
+
+\OMIT
+
+\end{document} 
\ No newline at end of file
diff --git a/base/testfiles-lthooks/shipout-006.tlg b/required/amsmath/testfiles-TU/tlb-lualatex-math-move.xetex.tlg
similarity index 58%
copy from base/testfiles-lthooks/shipout-006.tlg
copy to required/amsmath/testfiles-TU/tlb-lualatex-math-move.xetex.tlg
index 944f14ef..8741b5c9 100644
--- a/base/testfiles-lthooks/shipout-006.tlg
+++ b/required/amsmath/testfiles-TU/tlb-lualatex-math-move.xetex.tlg
@@ -1,3 +1,3 @@
 This is a generated file for the l3build validation system.
 Don't change this file in any respect.
--- There should be no error and no log output other than this line --
+test only for lualatex





More information about the latex3-commits mailing list.