[latex3-commits] [git/LaTeX3-latex3-iftex] master: guard against undefined commands being \relax (61bc442)

David Carlisle d.p.carlisle at gmail.com
Thu Nov 7 17:34:23 CET 2019


Repository : https://github.com/latex3/iftex
On branch  : master
Link       : https://github.com/latex3/iftex/commit/61bc4420f11c20d83ce44a1cce5a0917e877f29c

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

commit 61bc4420f11c20d83ce44a1cce5a0917e877f29c
Author: David Carlisle <d.p.carlisle at gmail.com>
Date:   Thu Nov 7 16:34:23 2019 +0000

    guard against undefined commands being \relax


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

61bc4420f11c20d83ce44a1cce5a0917e877f29c
 iftex.sty | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/iftex.sty b/iftex.sty
index 4c1923c..19df1d3 100644
--- a/iftex.sty
+++ b/iftex.sty
@@ -30,7 +30,7 @@
 % ProvidesPackage declaration in LaTeX
 \begingroup\expandafter\expandafter\expandafter\endgroup
 \expandafter\ifx\csname ProvidesPackage\endcsname\relax\else
-  \ProvidesPackage{iftex}[2019/11/04 v1.0b TeX engine tests]
+  \ProvidesPackage{iftex}[2019/11/07 v1.0c TeX engine tests]
 \fi
 
 % Save @ catcode, to restore at end, not needed in LaTeX.
@@ -54,7 +54,7 @@
 
 
 % eTeX \protected if available.
-\ifx\protected\@undefined
+\ifnum\ifx\protected\@undefined 1 \else\ifx\protected\relax 1 \else 0\fi\fi=1 %
   \let\IFTEX at protected\relax
 \else
   \let\IFTEX at protected\protected
@@ -68,7 +68,7 @@
   \catcode41 12 % )
   \catcode44 12 % ,
   \catcode46 12 % .
-  \ifx\directlua\@undefined\else
+  \ifnum\ifx\directlua\@undefined 1\else\ifx\directlua\relax 1\else 0\fi\fi=1 \else
     \directlua{tex.enableprimitives("IFTEX@", {"detokenize","protected"})}
   \fi
   }
@@ -99,7 +99,7 @@
   \csname if#2\endcsname}
 
 % etex (should always be true in latex based formats)
-\ifx\numexpr\@undefined
+\ifnum\ifx\numexpr\@undefined 1\else\ifx\numexpr\relax 1\else 0\fi\fi=1 %
   \IFTEX at let{etex}{false}
 \else
   \IFTEX at let{etex}{true}
@@ -108,7 +108,7 @@
 
 % pdftex (including in dvi mode)
 \IFTEX at let{IFTEX at savedpdftex}{pdftex}
-\ifx\pdftexversion\@undefined
+\ifnum\ifx\pdftexversion\@undefined 1\else\ifx\pdftexversion\relax 1\else 0\fi\fi=1 %
   \IFTEX at let{pdftex}{false}
 \else
   \IFTEX at let{pdftex}{true}
@@ -116,7 +116,7 @@
 \IFTEX at let{PDFTeX}{pdftex}
 
 % xetex
-\ifx\XeTeXrevision\@undefined
+\ifnum\ifx\XeTeXrevision\@undefined 1\else\ifx\XeTeXrevision\relax 1\else 0\fi\fi=1 %
   \IFTEX at let{xetex}{false}
 \else
   \IFTEX at let{xetex}{true}
@@ -125,18 +125,19 @@
 
 
 % luatex (including luahbtex)
-\ifx\directlua\@undefined
+\ifnum\ifx\directlua\@undefined 1\else\ifx\directlua\relax 1\else 0\fi\fi=1 %
   \IFTEX at let{luatex}{false}
 \else
   \IFTEX at let{luatex}{true}
 \fi
 \IFTEX at let{LuaTeX}{luatex}
 
+
 % luahbtex (or luatex + luaharfbuzz)
 % Use luaharfbuzz test rather than status.luatex_engine=="luahbtex"
 % for issue #2.
 \IFTEX at let{luahbtex}{false}
-\ifx\directlua\@undefined
+\ifnum\ifx\directlua\@undefined 1\else\ifx\directlua\relax 1\else 0\fi\fi=1 %
 \else
   \directlua{\IFTEX at detokenize{
    if(pcall(require, 'luaharfbuzz')) then
@@ -149,7 +150,7 @@
 
 
 % ptex (including all variants)
-\ifx\kanjiskip\@undefined
+\ifnum\ifx\kanjiskip\@undefined 1\else\ifx\kanjiskip\relax 1\else 0\fi\fi=1 %
   \IFTEX at let{ptex}{false}
 \else
   \IFTEX at let{ptex}{true}
@@ -165,7 +166,7 @@
 \IFTEX at let{upTeX}{uptex}
 
 % ptex-ng
-\ifx\ngbanner\@undefined
+\ifnum\ifx\ngbanner\@undefined 1\else\ifx\ngbanner\relax 1\else 0\fi\fi=1 %
   \IFTEX at let{ptexng}{false}
 \else
   \IFTEX at let{ptexng}{true}
@@ -174,7 +175,7 @@
 
 % vtex
 \IFTEX at let{IFTEX at savedVTeX}{VTeX}
-\ifx\VTeXversion\@undefined
+\ifnum\ifx\VTeXversion\@undefined 1\else\ifx\VTeXversion\relax 1\else 0\fi\fi=1 %
   \IFTEX at let{vtex}{false}
 \else
   \IFTEX at let{vtex}{true}
@@ -184,7 +185,7 @@
 % aleph
 \IFTEX at let{alephtex}{false}
 \ifptex\else
-\ifx\omathchardef\@undefined
+\ifnum\ifx\omathchardef\@undefined 1\else\ifx\omathchardef\relax 1\else 0\fi\fi=1 %
 \else
   \IFTEX at let{alephtex}{true}
 \fi
@@ -193,7 +194,7 @@
 
 
 % tutex (LuaTeX or XeTeX)
-\ifx\Umathchardef\@undefined
+\ifnum\ifx\Umathchardef\@undefined 1\else\ifx\Umathchardef\relax 1\else 0\fi\fi=1 %
   \IFTEX at let{tutex}{false}
 \else
   \IFTEX at let{tutex}{true}
@@ -201,13 +202,18 @@
 \IFTEX at let{TUTeX}{tutex}
 
 
-
 % Output mode 
 % declare with as if with \newif
 \def\pdftrue{\let\ifpdf\iftrue}
 \def\pdffalse{\let\ifpdf\iffalse}
 \pdffalse
-\ifx\directlua\undefined
+\ifluatex
+\directlua{\IFTEX at detokenize{
+if (tex.outputmode or tex.pdfoutput or 0) > 0 then
+  tex.print('\\pdftrue')
+end
+}}
+\else
 \begingroup\expandafter\expandafter\expandafter\endgroup
 \expandafter\ifx\csname pdfoutput\endcsname\relax
 \ifvtex
@@ -220,12 +226,6 @@
     \pdftrue
   \fi
 \fi
-\else
-\directlua{\IFTEX at detokenize{
-if (tex.outputmode or tex.pdfoutput or 0) > 0 then
-  tex.print('\\pdftrue')
-end
-}}
 \fi
 
 





More information about the latex3-commits mailing list