summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3kernel/l3legacy.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/l3kernel/l3legacy.dtx')
-rw-r--r--macros/latex/contrib/l3kernel/l3legacy.dtx16
1 files changed, 10 insertions, 6 deletions
diff --git a/macros/latex/contrib/l3kernel/l3legacy.dtx b/macros/latex/contrib/l3kernel/l3legacy.dtx
index fb04de0adf..534d37be27 100644
--- a/macros/latex/contrib/l3kernel/l3legacy.dtx
+++ b/macros/latex/contrib/l3kernel/l3legacy.dtx
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2022-02-24}
+% \date{Released 2022-04-10}
%
% \maketitle
%
@@ -100,15 +100,19 @@
% \end{macrocode}
%
% \begin{macro}[EXP,pTF]{\legacy_if:n}
-% A friendly wrapper.
+% A friendly wrapper. We need to use the \cs{if:w} approach here, rather than
+% testing against \tn{iftrue}/\tn{iffalse} as the latter approach fails for
+% primitive conditionals such as \tn{ifmmode}. The \cs{reverse_if:N} here
+% means that we get a slightly more useful error if the name is undefined.
% \begin{macrocode}
\prg_new_conditional:Npnn \legacy_if:n #1 { p , T , F , TF }
{
- \exp_args:Nc \if_meaning:w { if#1 } \iftrue
- \prg_return_true:
- \else:
+ \exp_after:wN \reverse_if:N
+ \cs:w if#1 \cs_end:
\prg_return_false:
- \fi:
+ \else:
+ \prg_return_true:
+ \fi:
}
% \end{macrocode}
% \end{macro}