Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have an error in this line of LaTeX.

\frac{ {{2}\choose{2}} {{1}\choose{1}} } { {1}\choose{1} }

The error notes

Ambiguous; you need another { and }.

I matched up the curly braces, and I don't think I need one though. What is going on?

share|improve this question
add comment

2 Answers

up vote 7 down vote accepted

The \choose macro needs to know where the top and the bottom part starts and ends:

\frac{ {2\choose 2} {1\choose 1}}{{1 \choose 1}}

But, as far as I know, \choose is a plainTeX macro, you better use \binom (it is in the same family like \frac but needs the amsmath package):

\frac{\binom{2}{2} \binom{1}{1}}{\binom{1}{1}}

enter image description here

You have also \tbinom and \dbinom for textstyle and displaystyle respectively.

Explanation

Consider the following example:

{1 + 23 \choose 4a - 7} \neq 1 + {23 \choose 4}a - 7

It does render as
enter image description here

A additional {23} and {4} just groups those parts with no relation to the \choose macro. (Kind of like \bfseries does in text mode.)

share|improve this answer
    
Thanks! $\binom$ works great. I still don't see why $\choose$ is erring though. Why does your form tell $\choose$ where the top and bottom ends, and my form does not? –  David Faux Sep 19 '12 at 15:31
2  
@DavidFaux \choose uses the "primitive" TeX syntax for fractions, where the (almost) equivalent of \frac{1}{2} is {1\over 2} (the braces can be omitted if the formula has only the fraction). Everything before \over (or \choose) is the numerator, everything after is the denominator and the braces block the scanning. It's a syntax borrowed from nroff and one of the bad choices Knuth did for TeX. –  egreg Sep 19 '12 at 15:35
    
Ah, so the braces are causing the error for choose. Thanks! –  David Faux Sep 19 '12 at 15:38
    
@DavidFaux In addition to egreg's comment I added an example that, hopefully, makes it clear. Just for fun, loose one pair of {} and compile. –  Qrrbrbirlbel Sep 19 '12 at 15:41
1  
it's not been stated explicitly so far: when \choose is evaluated, the delimiting braces are stripped off. that removes the braces that \frac needs to delimit its arguments. (and yes, this is, sadly, bad design; i've not heard knuth say so, but i think that he'd now agree, as he has said regarding the choice of toggled $ signs as opposed to clear begin/end markers.) –  barbara beeton Sep 24 '12 at 14:37
show 2 more comments

To add to Qrrbrbirlbel's practical answer, I'd like to explain why exactly TeX says that your expression

\frac{ {{2}\choose{2}} {{1}\choose{1}} } { {1}\choose{1} }

is ambiguous although it doesn't look ambiguous. For simplicity let's look at the simpler expression \frac{1}{ {1}\choose{1} }. By LaTeX's definition of \frac, this expands to

{\begingroup 1 \endgroup \over {1}\choose{1} }

And here you already see the trouble: TeX has no way to know what is meant,

  1. \begingroup 1 \endgroup over {1}\choose{1}  or
  2. \begingroup 1 \endgroup \over {1} choose {1} .

The braces and \begin/endgroup are not relevant here, so essentially the question is:
1 over 1 \choose 1, or 1 \over 1 choose 1?

share|improve this answer
add comment

Your Answer

 
discard

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.