Suppose I want to define a command, say, \tree
with, say, two arguments. I would like \tree
to do different things depending on what my first argument is. For example,
if #1
= a, then return $\sqrt{#2}$
if #1
= b, then return "Hi"
Is it possible to realise the above pseudocode? If so, how can I?
Best Answer
You can also use
\IfEqCase
from thexstring
package which can easily be extended to add more cases:Notes:
\PackageError
if an unknown option is passed in.Code: