Skip to content

Commit e098fbd

Browse files
committed
kernel upgrades for CI in texlive 2025 (brucemiller#2759)
* see through \special_relax in readUntil * also recognize \special_relax meaning in Match params * redo \right as non-expandable / constructor * try a \right constructor that also preserves current reversions * minor additions to natbib.sty for latest texlive 2025 * patch roman_aux to correctly compute '\romannumeral 1000' as 'm' * add \romannumeral tests * add torture test for noexpand in expandafter cascade * torture test for \numexpr with expandafter cascade on primitive separators * floor \currentgrouplevel to 0 * Revert "floor \currentgrouplevel to 0" -- defer to next PR This reverts commit 74e737e.
1 parent 986ddd0 commit e098fbd

File tree

14 files changed

+157
-9
lines changed

14 files changed

+157
-9
lines changed

MANIFEST

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,6 +1312,9 @@ t/expansion/partial.xml
13121312
t/expansion/pdftex_expanded.pdf
13131313
t/expansion/pdftex_expanded.tex
13141314
t/expansion/pdftex_expanded.xml
1315+
t/expansion/romannumeral.pdf
1316+
t/expansion/romannumeral.tex
1317+
t/expansion/romannumeral.xml
13151318
t/expansion/subdir/whichpkga.sty
13161319
t/expansion/testchar.pdf
13171320
t/expansion/testchar.tex

lib/LaTeXML/Core/Gullet.pm

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,10 @@ sub readToken {
311311
&& (($atoken, $atype, $ahidden) = isColumnEnd($self, $token))) {
312312
handleTemplate($self, $LaTeXML::READING_ALIGNMENT, $token, $atype, $ahidden); }
313313
elsif ((defined $token) && ($$token[1] == CC_CS) && ($$token[0] eq '\dont_expand')) {
314-
my $unexpanded = readToken($self); # Replace next token with a special \relax
315-
return T_CS('\special_relax'); }
314+
my $unexpanded = readToken($self); # Replace next token with a special \relax
315+
my $special_relax = T_CS('\special_relax');
316+
$$special_relax[2] = $unexpanded; # Smuggle the unexpanded token in the "meaning" slot of \special_relax
317+
return $special_relax; }
316318
else {
317319
last; } }
318320
if ($token) {
@@ -603,7 +605,8 @@ sub readMatch {
603605
my @matched = ();
604606
my $token;
605607
while (@tomatch && defined($token = readToken($self))
606-
&& push(@matched, $token) && ($token->equals($tomatch[0]))) {
608+
&& push(@matched, $token) && ($token->equals($tomatch[0]) ||
609+
($$token[2] && ($$token[0] eq '\special_relax') && $$token[2]->equals($tomatch[0])))) {
607610
shift(@tomatch);
608611
if ($$token[1] == CC_SPACE) { # If this was space, SKIP any following!!!
609612
while (defined($token = readToken($self)) && ($$token[1] == CC_SPACE)) {
@@ -653,6 +656,8 @@ sub readUntil {
653656
push(@tokens, $token);
654657
$nbraces++;
655658
push(@tokens, readBalanced($self)->unlist, T_END); }
659+
elsif ($$token[2] && ($$token[0] eq '\special_relax') && $$token[2]->equals($want)) { # if it was a special relax,
660+
last; }
656661
else {
657662
push(@tokens, $token); } } }
658663
else {

lib/LaTeXML/Engine/TeX_Math.pool.ltxml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,15 @@ DefConstructor('\left TeXDelimiter', "#1",
776776
return; },
777777
afterConstruct => sub { augmentDelimiterProperties($_[0], $_[1], 'OPEN', 1); });
778778

779-
DefMacro('\right', '\lx@hidden@egroup@right\lx@right');
779+
# \right
780+
# combines '\lx@hidden@egroup@right' and '\lx@right' into a single constructor
781+
# this is IMPORTANT, because \right is used in the LaTeX 3 kernel with the assumption that it is
782+
# idempotent to expansion.
783+
DefConstructor('\right', '',
784+
beforeDigest => sub {
785+
$_[0]->getGullet->unread(T_CS('\lx@hidden@egroup@right'), T_CS('\lx@right'));
786+
return;
787+
}, reversion => '');
780788

781789
# \lx@hidden@egroup@right tries to manage unbalanced {} errors, if an \left was forgotten.
782790
DefConstructor('\lx@hidden@egroup@right', '',

lib/LaTeXML/Package.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ sub roman_aux {
465465
# TeX proper returns empty on negative integers
466466
return '' unless $n && ($n > 0);
467467
my $div = 1000;
468-
my $s = ($n > $div ? ('m' x int($n / $div)) : '');
468+
my $s = ($n >= $div ? ('m' x int($n / $div)) : '');
469469
my $p = 4;
470470
while ($n %= $div) {
471471
$div /= 10;

lib/LaTeXML/Package/french.ldf.ltxml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ use LaTeXML::Package;
2020
RequirePackage('textcomp');
2121
InputDefinitions('french', type => 'ldf', noltxml => 1);
2222

23+
Let('\xspace', '\relax');
24+
DefConstructor('\up{}', "<ltx:sup>#1</ltx:sup>");
2325
DefConstructor('\fup{}', "<ltx:sup>#1</ltx:sup>");
2426
DefConstructor('\FB@up@fake{}', "<ltx:sup>#1</ltx:sup>");
2527

@@ -34,4 +36,3 @@ AtBeginDocument(sub {
3436
});
3537

3638
1;
37-

t/expansion/noexpand.pdf

4 KB
Binary file not shown.

t/expansion/noexpand.tex

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@ \section{Random}
9797
Expect: NOW a MUCHLATER b.\\
9898
Got: \expanded.
9999

100-
101-
100+
\section{Expandafter cascade with conditional}
101+
\def\stop{\stop}
102+
\def\tail{\tail}
103+
\def\guard#1\stop{}
104+
\def\badloop#1{Stop?~%
105+
\def\aux{\fi here.\ifx\tail#1\expandafter\guard\fi\badloop}%
106+
%
107+
\ifcat\expandafter\expandafter\expandafter\aux\expandafter\noexpand}
108+
\badloop\tail\stop
109+
fin.
102110
\end{document}

t/expansion/noexpand.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,15 @@ edef unexpanded foo: foo?</p>
144144
<p>Expect: NOW a MUCHLATER b.<break/>Got: NOW a MUCHLATER b.</p>
145145
</para>
146146
</section>
147+
<section inlist="toc" xml:id="S6">
148+
<tags>
149+
<tag>6</tag>
150+
<tag role="refnum">6</tag>
151+
<tag role="typerefnum">§6</tag>
152+
</tags>
153+
<title><tag close=" ">6</tag>Expandafter cascade with conditional</title>
154+
<para xml:id="S6.p1">
155+
<p>Stop? here.fin.</p>
156+
</para>
157+
</section>
147158
</document>

t/expansion/numexpr.pdf

11.5 KB
Binary file not shown.

t/expansion/numexpr.tex

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@
8888
\mymuskip=\muexpr \aspace ( \aspace 2mu \aspace - \aspace 5mu \aspace ) \aspace * \aspace \numexpr \aspace 3 \aspace - \aspace 3 \aspace * \aspace 13 \aspace / \aspace 5 \aspace \relax \aspace + \aspace 34mu \aspace / \aspace 2 \aspace \relax
8989
MuGlue=\the\mymuskip.
9090

91+
\section{Expandafter on primitive separators}
92+
\let\sep\right
93+
\def\feed#1#2{%
94+
\number \numexpr
95+
\expandafter \NwNw
96+
\number \numexpr #1 \expandafter \sep
97+
\number \numexpr #2 \sep\relax}
98+
\long\gdef\NwNw#1#2\sep #3#4\sep {1:#1; 2:#2; 3:#3; 4:#4}
99+
\feed{140}{100}
100+
91101
\end{document}
92102

93103
% Errors...
@@ -105,4 +115,3 @@
105115
Num=\the\mynum
106116

107117
{\mynum=\numexpr 13*}
108-

0 commit comments

Comments
 (0)