0
$$
\left(
\begin{array}{c}
m+n\\
m
\end{array}
\right)
= \frac{(m+n)!}{m!n!}
= \frac{\overbrace{(m+n)(m+n-1)\cdots(n+1)}^\mbox{$m$ factors}}{\underbrace{m(m-1)\cdots 1}_\mbox{$m$ factors}}
$$

I am getting an error and cannot figure out the cause.

2
  • 6
    Next time, please also post the content of the error. And if you can include the documentclass etc that make this into a MWE, that would be even better.
    – Teepeemm
    Jul 18 '16 at 3:30
  • 3
    Since the answers don't tell: ^\mbox{...} and _\mbox{...} are the problems. Better: ^{\mbox{...}}. Even better: ^{\text{...}}. (Also please have a look at Why is \[ … \] preferable to $$ … $$?)
    – cgnieder
    Jul 18 '16 at 8:14
6

I suggest you use \[ \] instead $$ $$ for display math formulas. Like @WillieWong say, with amsmath package You can get a result, perhaps, more appropriate:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\[
  \binom{m+n}{m}
     = \frac{(m+n)!}{m!\,n!}
     = \frac{\overbrace{(m+n)(m+n-1)\cdots(n+1)}^{m \text{ factors}}}{\underbrace{m(m-1)\cdots 1}_{m \text{ factors}}}
  \]
 \end{document}

enter image description here

2
  • 2
    ^{\text{$m$ factors}} is better
    – egreg
    Jul 18 '16 at 8:22
  • I see, can you explain me, why ^{\text{$m$ factors}} is better?
    – juanuni
    Jul 19 '16 at 2:27
2

This will do:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

$$
\left(
\begin{array}{c}
m+n\\
m
\end{array}
\right)
= \frac{(m+n)!}{m!n!}
= \frac{\overbrace{(m+n)(m+n-1)\cdots(n+1)}^{\mbox{$m$ factors}}}{\underbrace{m(m-1)\cdots 1}_{\mbox{$m$ factors}}}
$$
\end{document}

The ^\mbox{$m$ factors} was changed to ^{\mbox{$m$ factors}} in two cases (one for superscript and another for subscript), which should be grouped using curly braces.

2
  • 2
    If one is using amsmath, one might as well use \binom instead of doing it by hand in the left hand side. It may also make sense using \text instead of \mbox. Jul 18 '16 at 3:29
  • @WillieWong: I do agree with you regarding the use of \text instead of \mbox.
    – Jagath
    Jul 18 '16 at 4:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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