The \newcommand macro allows to use an optional argument for the first parameter #1 with:
\newcommand{\mycommand}[3][defaultfor1]{blah blah blah}
Is it possible to have more than one option with \newcommand?
|
The
Is it possible to have more than one option with |
||||
|
|
|
Try the LaTeX 3 package
You may read the documents for more information. |
|||||||||||||
|
|
You've got answers for other approaches, so here is the basics using the kernel only. You'll need to define your macros by hand, something like
This can of course be extended to more complex cases. (Here, I'm leaving it up to you whether to make your function |
|||||||
|
There are also However the xparse package (part of the LaTeX3 package tree, but works also with LaTeX2e) provides Historical note In TeX Live there is a
and at the prompt
where
The commented lines should be replaced by the actual code. With the specification
one defines a macro with a mandatory argument followed by an optional one:
|
||||