I used answers given to this question (in particular, this answer by egreg) to come up with the following code:
\documentclass{article}
\makeatletter
\def\ifemptyarg#1{%
\if\relax\detokenize{#1}\relax % H. Oberdiek
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi}
\makeatother
\newcommand{\InfinityCircle}[1][]{%
\ifemptyarg{#1}
{S^1_\infty}%
{S^1_\infty\left(#1\right)}%
}
\begin{document}
\begin{enumerate}
\item Correct: $\InfinityCircle$
\item Incorrect: $\InfinityCircle{\lambda}$
\item What (2) should be: $\InfinityCircle(\lambda)$
\end{enumerate}
\end{document}
As mentioned in the output, however, the command isn't quite correct as it seems to be ignoring the parentheses in its definition:
Regrettably, I don't understand the back-end enough to know why this is happening or how to fix it. Can someone help me get the desired output and/or to show an alternative method better-suited for what I'm trying to accomplish? Note: I really want to have a method which avoids loading any packages, if at all possible.


\newcommandmacros are given with[...]brackets, not with{...}-- I assume, this is a typo – Mar 28 '16 at 21:25