Testing for variant/version

David Carlisle d.p.carlisle at gmail.com
Tue Apr 9 11:58:47 CEST 2024

You can use
\str_compare:nNnTF {aaay} < {aaax} {yes} {no}

The latex format has already tested which engine you are using and resolved
differences between the primitive name and/or supplied Lua implementation
where needed, so you don't need to load any packages or re-test or load
another lua emulation.


On Tue, 9 Apr 2024 at 10:50, Peter Flynn <peter at silmaril.ie> wrote:

> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/tex-live/attachments/20240409/a8542f92/attachment.htm>

More information about the tex-live mailing list.