I would like to define my own macro that accepts an optional parameter such as \big
, \Big
, etc that apply that if it is specified, otherwise apply the auto resizing \left
, \right
pair.
So, how do I get the following to work for the case where the optional parameter is specified.
I see that if I change the syntax to accept only \bracc[big]{1, 2}
instead of \bracc[\big]{1, 2}
(i.e., remove the \
), then I can use
\csname#1\endcsname\{#2\csname#1\endcsname\}
which works fine but I would rather be able to specify \big
(i.e, with the \
) instead.
Code:
\documentclass{article}
\usepackage{xstring}
\usepackage{xparse}
\NewDocumentCommand{\bracc}{O{} m}{%
\IfEq{#1}{}{%
\left\{#2\right\}%
}{%
#1\{#2#1\}%
}%
}%
\begin{document}
$\bracc{1, 2}$
%$\bracc[\big]{1, 2}$% How to get this case to work?
\end{document}
xstring
here: ano
-type argument and\IfNoValueTF{#1}{<without option>}{<with option>}
should suffice, shouldn't it?