From 308702e7d20b6aebacac05ba6331d3d80f626c51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Fabian=20Kr=C3=BCger?= Date: Wed, 26 Aug 2026 20:15:17 +0200 Subject: [PATCH] Remove special handling for LuaTeX in \genfrac --- required/amsmath/amsmath.dtx | 65 ++----------- required/amsmath/changes.txt | 3 + .../amsmath/testfiles/amsldoc-2.luatex.tlg | 55 ++++------- .../amsmath/testfiles/amsldoc-5.luatex.tlg | 94 +++++-------------- 4 files changed, 56 insertions(+), 161 deletions(-) diff --git a/required/amsmath/amsmath.dtx b/required/amsmath/amsmath.dtx index 63c7535771..e05c33e5d5 100644 --- a/required/amsmath/amsmath.dtx +++ b/required/amsmath/amsmath.dtx @@ -85,7 +85,7 @@ Bug reports can be opened (category \texttt{#1}) at\\% % \end{macrocode} % % \begin{macrocode} -\ProvidesPackage{amsmath}[2026-06-04 v2.18d AMS math features] +\ProvidesPackage{amsmath}[2026-08-26 v2.18e AMS math features] % \end{macrocode} % % \section{Catcode defenses} @@ -643,6 +643,7 @@ Foreign command \@backslashchar#1;\MessageBreak % \begin{macro}{\genfrac} % \changes{v2.16a}{2016/11/05}{New genfrac implementation for extended % TeXs} +% \changes{v2.18e}{2026-08-26}{Use traditional codepath for Lua\TeX} % This command provides access to \tex/'s generalized fraction % primitives. Args: \arg{1} left delim, \arg{2} right delim, \arg{3} % line thickness, \arg{4} mathstyle override, \arg{5} numerator, @@ -653,17 +654,11 @@ Foreign command \@backslashchar#1;\MessageBreak % line thickness (normally .4pt), and no mathstyle override). % % the |withdelims| primitives do not work in xetex with OpenType -% fonts, and the relevant font dimen parameters are often not set -% in luatex as there are no matching values in the OpenType Math -% table, so here we use variants that use the font parameters if +% fonts, so here we use variants that use the font parameters if % they are set, but scale using |\left\right| rather than the % |withdelims| primitives. % % \begin{macrocode} -\ifx\directlua\@undefined -% \end{macrocode} -% -% \begin{macrocode} \ifx\XeTeXcharclass\@undefined % \end{macrocode} % Classic version @@ -723,55 +718,9 @@ Foreign command \@backslashchar#1;\MessageBreak % % \begin{macrocode} \fi -\else -% \end{macrocode} -% LuaTeX version -% \begin{macrocode} -\def\genfrac@rule#1#2#3{% -\hbox{$\left#1\vcenter{\hrule \@width\z@ - \@height - \ifdim\Umathfractiondelsize#2=\z@ - #3\fontdimen6#3\tw@ - \else - \Umathfractiondelsize#2% - \fi - }\right.$}} % \end{macrocode} % -% \begin{macrocode} -\def\genfrac@choice#1#2{% -\ifx @#2@\else -% \end{macrocode} -% \changes{v2.17a}{2017/09/02}{move \cs{nulldelimiterspace} correction} -% \begin{macrocode} -\ifx c#1\kern-\nulldelimiterspace\fi -{\delimitershortfall\z@\delimiterfactor\@m - \mathsurround\z@\nulldelimiterspace\z@ -\mathchoice -{\genfrac@rule{#2}\displaystyle{2.39}}% -{\genfrac@rule{#2}\textstyle{1}}% -{\genfrac@rule{#2}\scriptstyle{1.45}}% -{\genfrac@rule{#2}\scriptscriptstyle{1.35}}% -}% -\ifx o#1\kern-\nulldelimiterspace\fi -\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@choice o{#1}% -{\Ustack {\begingroup#5\endgroup\ifx @#3@\@@over\else\@@above\fi#3\relax#6}}% -\genfrac@choice c{#2}% -}} -% \end{macrocode} -% -% \begin{macrocode} -\fi -% \end{macrocode} -% -% End of test for Lua\TeX/Xe\TeX. +% End of test for Xe\TeX. % % \cs{@genfrac} takes the preceding arguments and reads the % numerator and denominator. Note that there's no convenient way to @@ -781,8 +730,14 @@ Foreign command \@backslashchar#1;\MessageBreak % Args: \arg{1} mathstyle, \arg{2} fraction primitive, % \arg{3} delimiters and rule thickness, % \arg{4} numerator, \arg{5} denominator. +% +% \changes{v2.18e}{2026-08-26}{added \cs{Ustack}} % \begin{macrocode} +\ifx\directlua\@undefined \def\@genfrac#1#2#3#4#5{{#1{\begingroup#4\endgroup#2#3\relax#5}}} +\else +\def\@genfrac#1#2#3#4#5{{#1\Ustack{\begingroup#4\endgroup#2#3\relax#5}}} +\fi % \end{macrocode} % \end{macro} % diff --git a/required/amsmath/changes.txt b/required/amsmath/changes.txt index 98f438da24..bcfa2cac88 100644 --- a/required/amsmath/changes.txt +++ b/required/amsmath/changes.txt @@ -1,3 +1,6 @@ +2026-08-26 Marcel Krüger + Use engine functionality for delimiters in genfrac in LuaTeX. + 2026-06-01 Joseph Wright Switch generally to US spelling diff --git a/required/amsmath/testfiles/amsldoc-2.luatex.tlg b/required/amsmath/testfiles/amsldoc-2.luatex.tlg index 70e609f0ec..8142d218f0 100644 --- a/required/amsmath/testfiles/amsldoc-2.luatex.tlg +++ b/required/amsmath/testfiles/amsldoc-2.luatex.tlg @@ -362,44 +362,23 @@ Completed box being shipped out [1] ...............\kern1.0 (font) ..............\glue(\thinmuskip) 1.66663 ..............\hbox(14.5001+9.50012)x24.05392, direction TLT -...............\hbox(14.5001+9.50012)x7.36115, direction TLT -................\hbox(14.5001+9.50012)x7.36115, direction TLT -.................\mathon -.................\hbox(14.5001+9.50012)x7.36115, direction TLT -..................\hbox(0.39998+23.60025)x7.36115, shifted -14.10013, direction TLT -...................\OMX/cmex/m/n/10 ^^R -..................\vbox(14.45+9.45)x0.0, direction TLT -...................\rule(23.9+0.0)x0.0 -..................\hbox(0.0+0.0)x0.0, shifted -2.5, direction TLT -.................\mathoff -...............\kern-1.2 -...............\hbox(11.07062+8.3595)x11.73163, direction TLT -................\hbox(11.07062+8.3595)x11.73163, direction TLT -.................\hbox(0.0+0.0)x1.2, shifted -2.5, direction TLT -.................\vbox(11.07062+8.3595)x9.33163, direction TLT -..................\hbox(4.30554+1.49998)x9.33163, direction TLT -...................\OML/cmm/m/it/10 n -...................\hbox(4.63193+0.0)x3.32928, shifted 1.49998, direction TLT -....................\OML/cmm/m/it/7 i -..................\kern5.18016 (font) -..................\hbox(6.94444+1.49998)x9.33163, glue set 1.50928fil, direction TLT -...................\glue 0.0 plus 1.0fil minus 1.0fil -...................\OML/cmm/m/it/10 l -...................\hbox(4.63193+0.0)x3.32928, shifted 1.49998, direction TLT -....................\OML/cmm/m/it/7 i -...................\glue 0.0 plus 1.0fil minus 1.0fil -.................\hbox(0.0+0.0)x1.2, shifted -2.5, direction TLT -...............\kern-1.2 -...............\hbox(14.5001+9.50012)x7.36115, direction TLT -................\hbox(14.5001+9.50012)x7.36115, direction TLT -.................\mathon -.................\hbox(14.5001+9.50012)x7.36115, direction TLT -..................\hbox(0.39998+23.60025)x7.36115, shifted -14.10013, direction TLT -...................\OMX/cmex/m/n/10 ^^S -..................\vbox(14.45+9.45)x0.0, direction TLT -...................\rule(23.9+0.0)x0.0 -..................\hbox(0.0+0.0)x0.0, shifted -2.5, direction TLT -.................\mathoff +...............\hbox(14.5001+9.50012)x24.05392, direction TLT +................\hbox(0.39998+23.60025)x7.36115, shifted -14.10013, direction TLT +.................\OMX/cmex/m/n/10 ^^R +................\vbox(11.07062+8.3595)x9.33163, direction TLT +.................\hbox(4.30554+1.49998)x9.33163, direction TLT +..................\OML/cmm/m/it/10 n +..................\hbox(4.63193+0.0)x3.32928, shifted 1.49998, direction TLT +...................\OML/cmm/m/it/7 i +.................\kern5.18016 (font) +.................\hbox(6.94444+1.49998)x9.33163, glue set 1.50928fil, direction TLT +..................\glue 0.0 plus 1.0fil minus 1.0fil +..................\OML/cmm/m/it/10 l +..................\hbox(4.63193+0.0)x3.32928, shifted 1.49998, direction TLT +...................\OML/cmm/m/it/7 i +..................\glue 0.0 plus 1.0fil minus 1.0fil +................\hbox(0.39998+23.60025)x7.36115, shifted -14.10013, direction TLT +.................\OMX/cmex/m/n/10 ^^S .............\mathoff .............\glue 0.0 plus 1.0fill ............\glue(\tabskip) 0.0 diff --git a/required/amsmath/testfiles/amsldoc-5.luatex.tlg b/required/amsmath/testfiles/amsldoc-5.luatex.tlg index 6e0fb21380..2054e532c9 100644 --- a/required/amsmath/testfiles/amsldoc-5.luatex.tlg +++ b/required/amsmath/testfiles/amsldoc-5.luatex.tlg @@ -558,40 +558,19 @@ Completed box being shipped out [1] .....\OMS/cmsy/m/n/10 ^^@ .....\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217 .....\hbox(14.5001+9.50012)x20.24313, direction TLT -......\hbox(14.5001+9.50012)x7.36115, direction TLT -.......\hbox(14.5001+9.50012)x7.36115, direction TLT -........\mathon -........\hbox(14.5001+9.50012)x7.36115, direction TLT -.........\hbox(0.39998+23.60025)x7.36115, shifted -14.10013, direction TLT -..........\OMX/cmex/m/n/10 ^^R -.........\vbox(14.45+9.45)x0.0, direction TLT -..........\rule(23.9+0.0)x0.0 -.........\hbox(0.0+0.0)x0.0, shifted -2.5, direction TLT -........\mathoff -......\kern-1.2 -......\hbox(13.70952+6.85951)x7.92084, direction TLT -.......\hbox(13.70952+6.85951)x7.92084, direction TLT -........\hbox(0.0+0.0)x1.2, shifted -2.5, direction TLT -........\vbox(13.70952+6.85951)x5.52084, direction TLT -.........\hbox(6.94444+0.0)x5.52084, direction TLT -..........\OML/cmm/m/it/10 k -.........\kern7.18015 (font) -.........\hbox(6.44444+0.0)x5.52084, glue set 0.26042fil, direction TLT -..........\glue 0.0 plus 1.0fil minus 1.0fil -..........\OT1/cmr/m/n/10 1 -..........\glue 0.0 plus 1.0fil minus 1.0fil -........\hbox(0.0+0.0)x1.2, shifted -2.5, direction TLT -......\kern-1.2 -......\hbox(14.5001+9.50012)x7.36115, direction TLT -.......\hbox(14.5001+9.50012)x7.36115, direction TLT -........\mathon -........\hbox(14.5001+9.50012)x7.36115, direction TLT -.........\hbox(0.39998+23.60025)x7.36115, shifted -14.10013, direction TLT -..........\OMX/cmex/m/n/10 ^^S -.........\vbox(14.45+9.45)x0.0, direction TLT -..........\rule(23.9+0.0)x0.0 -.........\hbox(0.0+0.0)x0.0, shifted -2.5, direction TLT -........\mathoff +......\hbox(14.5001+9.50012)x20.24313, direction TLT +.......\hbox(0.39998+23.60025)x7.36115, shifted -14.10013, direction TLT +........\OMX/cmex/m/n/10 ^^R +.......\vbox(13.70952+6.85951)x5.52084, direction TLT +........\hbox(6.94444+0.0)x5.52084, direction TLT +.........\OML/cmm/m/it/10 k +........\kern7.18015 (font) +........\hbox(6.44444+0.0)x5.52084, glue set 0.26042fil, direction TLT +.........\glue 0.0 plus 1.0fil minus 1.0fil +.........\OT1/cmr/m/n/10 1 +.........\glue 0.0 plus 1.0fil minus 1.0fil +.......\hbox(0.39998+23.60025)x7.36115, shifted -14.10013, direction TLT +........\OMX/cmex/m/n/10 ^^S .....\OT1/cmr/m/n/10 2 .....\hbox(4.8611+0.83334)x15.15631, shifted -4.12892, direction TLT ......\OML/cmm/m/it/7 k @@ -602,40 +581,19 @@ Completed box being shipped out [1] .....\OT1/cmr/m/n/10 + .....\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217 .....\hbox(14.5001+9.50012)x20.24313, direction TLT -......\hbox(14.5001+9.50012)x7.36115, direction TLT -.......\hbox(14.5001+9.50012)x7.36115, direction TLT -........\mathon -........\hbox(14.5001+9.50012)x7.36115, direction TLT -.........\hbox(0.39998+23.60025)x7.36115, shifted -14.10013, direction TLT -..........\OMX/cmex/m/n/10 ^^R -.........\vbox(14.45+9.45)x0.0, direction TLT -..........\rule(23.9+0.0)x0.0 -.........\hbox(0.0+0.0)x0.0, shifted -2.5, direction TLT -........\mathoff -......\kern-1.2 -......\hbox(13.70952+6.85951)x7.92084, direction TLT -.......\hbox(13.70952+6.85951)x7.92084, direction TLT -........\hbox(0.0+0.0)x1.2, shifted -2.5, direction TLT -........\vbox(13.70952+6.85951)x5.52084, direction TLT -.........\hbox(6.94444+0.0)x5.52084, direction TLT -..........\OML/cmm/m/it/10 k -.........\kern7.18015 (font) -.........\hbox(6.44444+0.0)x5.52084, glue set 0.26042fil, direction TLT -..........\glue 0.0 plus 1.0fil minus 1.0fil -..........\OT1/cmr/m/n/10 2 -..........\glue 0.0 plus 1.0fil minus 1.0fil -........\hbox(0.0+0.0)x1.2, shifted -2.5, direction TLT -......\kern-1.2 -......\hbox(14.5001+9.50012)x7.36115, direction TLT -.......\hbox(14.5001+9.50012)x7.36115, direction TLT -........\mathon -........\hbox(14.5001+9.50012)x7.36115, direction TLT -.........\hbox(0.39998+23.60025)x7.36115, shifted -14.10013, direction TLT -..........\OMX/cmex/m/n/10 ^^S -.........\vbox(14.45+9.45)x0.0, direction TLT -..........\rule(23.9+0.0)x0.0 -.........\hbox(0.0+0.0)x0.0, shifted -2.5, direction TLT -........\mathoff +......\hbox(14.5001+9.50012)x20.24313, direction TLT +.......\hbox(0.39998+23.60025)x7.36115, shifted -14.10013, direction TLT +........\OMX/cmex/m/n/10 ^^R +.......\vbox(13.70952+6.85951)x5.52084, direction TLT +........\hbox(6.94444+0.0)x5.52084, direction TLT +.........\OML/cmm/m/it/10 k +........\kern7.18015 (font) +........\hbox(6.44444+0.0)x5.52084, glue set 0.26042fil, direction TLT +.........\glue 0.0 plus 1.0fil minus 1.0fil +.........\OT1/cmr/m/n/10 2 +.........\glue 0.0 plus 1.0fil minus 1.0fil +.......\hbox(0.39998+23.60025)x7.36115, shifted -14.10013, direction TLT +........\OMX/cmex/m/n/10 ^^S .....\OT1/cmr/m/n/10 2 .....\hbox(4.8611+0.83334)x15.15631, shifted -4.12892, direction TLT ......\OML/cmm/m/it/7 k