New answers tagged

3

You can use expl3; the \strcompare macro is just a user level version of the expandable internal function \str_if_eq:nnTF. \documentclass{article} \usepackage{expl3} \ExplSyntaxOn \cs_new_eq:NN \strcompare \str_if_eq:nnTF \ExplSyntaxOff \begin{document} start\par \strcompare{abc}{def}{OOPS}{OK}\par \strcompare{abc}{abcd}{OOPS}{OK}\par ...


1

I've read that with \usepackage{pdftexcmds}, you can use \pdf@strcmp but haven't checked if it works in this case. Alternatively, the code below defines \expandable@if@equal{str1}{str2}{if-case}{else-case}, which can be used as follows: \makeatletter start% \expandable@if@equal{abc}{def}{OOPS}{OK}% \expandable@if@equal{abc}{abcd}{OOPS}{OK}% ...



Top 50 recent answers are included