In this post, a solution is given to the problem of defining a command which tests equality of two strings, sufficiently robust (in comparison to \ifthenelse
) to admit complicated arguments (e.g. containing commands or environments).
But now, i would like to adapt it to perform a test on 1 argument in the form "IF arg= a OR arg=b THEN ... ELSE ...", where "a" and "b" or fixed. My attempt is :
\makeatletter
\newcommand{\testOR}[1]{%
\ifnum\pdfstrcmp{\unexpanded{#1}}{a}=\z@
\expandafter\@secondoftwo
\else
\ifnum\pdfstrcmp{\unexpanded{#1}}{b}=\z@
\expandafter\@secondoftwo%
\else%
\expandafter\@firstoftwo%
\fi%
\fi
}
\makeatother
\begin{document}
\testIfNotTrivial{a}{true}{false} -
\testIfNotTrivial{b}{true}{false} -
\testIfNotTrivial{coucou}{true}{false}
\end{document}
But it does not have the expected (from me) behaviour : false - False - true