I'm trying to adapt the solution provided in Different command definitions with and without optional argument to change the behavior of my new command. I'd like to use basic command to avoid some non basic packages.
I'm defining a command \mysign
to produce my signature at the end of the document. But sometimes I need the date above and sometimes not. So I'd like to have an optional argument to insert it (for example\mysign[date]
).
Also, sometimes I need to insert some personal ID and I'd like to have a second optional argument, but independent with the first one.
So, the result would be something like this:
\mysign
only the signature\mysign[date]
the signature with date\mysign[id]
the signature with ID\mysign[date, id]
full signature
The problem is that \@ifnextchar[
is working only for one option. I can not adjust to work only with second option.
Any idea?
key=value
approach be valid for you?\mysign
produces signature;\mysign[date=<value>]
produces signature+date;\mysign[id=<value>]
gives signature+id;\mysign[date=<value>,id=<value>]
gives signature+date+id.