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}
xstringhere: ano-type argument and\IfNoValueTF{#1}{<without option>}{<with option>}should suffice, shouldn't it? – cgnieder Feb 25 '13 at 19:57\\\in the argument? – Matthew Leingang Feb 26 '13 at 12:36\bigggetc. is when I have to match delimeters in an aligned environment where the beginning delimiter is on one line and the ending delimiter is on the following line (something really long within the delimiters). That's exactly where\left( ... \right)won't work. – Matthew Leingang Feb 27 '13 at 02:45