I have seen several related questions, but none seems to address specifically this.
I would like to define a command that accepts a variable number of arguments. Something like
\newcommand{\func}(1){\if{#1}{f(#1)}{f}}
So that if there is a parameter the output will be f(#1)
and if there is no parameter the output will be f
, and never f()
.
Is this possible?
xparse
package.pgfkeys
package. It lets you define commands with a key=value API.l3keys
package of theexpl3
bundle is also quite nice. :)\func{1}
instead of\func(1)
.