I have the following bit of code:
Code: Select all
\DeclareMathOperator{\fisherInformationOp}{\operatorname{I}}
\newcommand{\I}[2][]{\fisherInformationOp_#1\left(#2\right)}
However, when there is only one argument, the subscript takes the token \left and won't compile as there's no partnering \right. So I want to do something like:
Code: Select all
\DeclareMathOperator{\fisherInformationOp}{\operatorname{I}}
\newcommand{\I}[2][]{
% If there are two arguments then...
\fisherInformationOp_#1\left(#2\right)
% Otherwise...
\fisherInformationOp\left(#2\right)
% \fi
}