I have a command \cont used mainly in the form \cont{X, Y} and defined using \SplitArgument, as shown in the source below. How can I define a starred version \cont* of this command that does two things, as indicated:
- uses fences
\bigl[and\bigr]instead of(and); and - uses 4 arguments rather than 2, which get grouped in the outout as shown in the output equation (3)?
If it helps, I'm willing to change the separator in the original \cont to a semicolon instead of a comma, so that I would use, for example, \cont{X; Y} and then use the starred form as, for example, \cont*{X, x; Y, y}.
\documentclass[fleqn]{memoir}
\usepackage{xparse}
\usepackage{suffix}
\NewDocumentCommand{\cont}{ >{\SplitArgument{1}{,}} m }{\printcont#1}
\NewDocumentCommand{\printcont}{mm}{{\mathcal{C}}({#1}\IfValueT{#2}{, {#2}})}
\newcommand{\contmaps}[2]{\mathcal{C}(#1, #2)}
\WithSuffix\newcommand\contmaps*[2]{\mathcal{C}\bigl[(#1),(#2)\bigr]}
% How define this?
%\WithSuffix\newcommand\cont* ..........
\begin{document}
\begin{equation}\label{one}
\cont{X, Y}
\end{equation}
\begin{equation}\label{two}
\contmaps{X}{Y}
\end{equation}
\begin{equation}\label{three}
\contmaps{X, x}{Y, y}
\end{equation}
How define \verb!\cont! so next line gives same result as in equation (\ref{three})?
\[6pt]
\mbox{}\qquad\verb!\cont*{X, x, Y, y}!
\end{document}

\WithSuffixalone. – egreg Oct 12 '21 at 20:19