Testing for variant/version

Peter Flynn peter at silmaril.ie
Tue Apr 9 11:48:47 CEST 2024


A user has suggested the following code to make sure that a  macro is 
using the "right" string comparator macro:

\ifdefined\pdftexversion
   \let\switch at strcmp=\pdfstrcmp
\else
   \ifdefined\xetexversion
     \let\switch at strcmp=\strcmp
   \else
     \ifdefined\luatexversion
       \input pdftexcmds.sty
       \let\switch at strcmp=\pdf at strcmp
     \else
       \let\switch at strcmp=\pdfstrcmp% Danger, Will Robinson!
       \PackageWarningNoLine{stringswitch}{\protect\pdfstrcmp\space 
selected (no \protect\TeX\space variant version found, maybe very old?)}%
     \fi
   \fi
\fi

The final \else was added because TeX Live 2019/Debian in its xelatex 
incarnation was failing the first three tests. Is there another test 
than can be performed for earlier versions (some of them are probably 
still widespread)?

Peter



More information about the tex-live mailing list.