TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


which works fine but I would rather be able to specify \big (i.e, with the \) instead.



\NewDocumentCommand{\bracc}{O{} m}{%

    $\bracc{1, 2}$  
    %$\bracc[\big]{1, 2}$% How to get this case to work?
share|improve this question
Of course only after composing the question do I find a solution. So am leaving this here in case someone else finds it useful. I will post an answer if one does not show up in a while. – Peter Grill Feb 25 '13 at 19:41
Probably a good reference: Removing a backslash from a character sequence – Werner Feb 25 '13 at 19:46
I don't see the need for xstring here: an o-type argument and \IfNoValueTF{#1}{<without option>}{<with option>} should suffice, shouldn't it? – clemens Feb 25 '13 at 19:57
@Werner: Thanks. I need that for another problem of mine. – Peter Grill Feb 25 '13 at 19:58
@cgnieder: Yeah that was the solution I came up with just after composing the question. You can post it an answer if you want -- don't think there is going to be anything easier than that. – Peter Grill Feb 25 '13 at 19:59

You don't need any packages for this, also you should (effectively) use \bigl and \bigr if \big is specified:



    $\bracc{1, 2}$  

    $\bracc[\big]{1, 2}$% How to get this case to work?
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.