Is there a way to define a macro that takes one optional argument and behaves transparently? The traditional Latex way (\newcommand{\foo}[1][]{foo}
) has the following shortcome: writing $T_\foo$
results in error (missing {
inserted), but doing the same with zero-argument macro is possible.
I think a macro with an optional argument should behave the same way as a zero-argument macro when the argument is not provided. Is it possible to achieve this?
{\foo}
if defined as you show.\newcommand{\foo}[1][]{}
, I don't think{\foo}
will raise an error. Actually, I even tried it, thought I knew it wouldn't. Please, add an example._
work in math mode.