I'm trying to implement a custom command that is called like this:
\mycommand[hello][world]{mandatory1}{mandatory2}
OR:
\mycommand[hello,world]{mandatory1}{mandatory2}
However, I can't figure out how one can check the value of the two options - I want to check if they are really "hello" and "world" and nothing else, not "x" and "y", etc.
The pseudocode would look something like this:
\NewDocumentCommand{o o m m}{
if(#1 == "hello"){...} else {...}
if(#2 == "world"){...} else {...}
}
How can I do this? I already found \IfValueTF{...}
in xparse
, but I can't check the value of an option with that - only if it was given or not.
\def\@tempa{#1}\def\@tempb{2}\ifx\@tempa\@tempb...
.[..][..]
to be mandatory or optional? I'm not sure I understand. What do you need the optional arguments to be by default? You can compare strings with\str_if_eq:nnTF
from expl3.