169

The problem is caused by the symbol of binomial coefficient (symbol of Newton), often used in math:

{N}\choose{k}

In my document I have formula:

$$ P(A) = \sum P(\{ (e_1,...,e_N) \})  =  {N}\choose{k} \cdot p^kq^{N-k}$$

which is rendered as:

enter image description here

but should be:

enter image description here

MC2DX
  • 2,447
  • Are you using LaTeX or plain TeX? – Torbjørn T. Aug 11 '13 at 14:14
  • I am compiling pdfs from files by pdflatex. – MC2DX Aug 11 '13 at 14:20
  • Is the symbol N really supposed to represent the physical unit for force (in which case you should render it in an upright rather than italic style), or are you using the symbol to denote an integer? – Mico Aug 11 '13 at 14:23
  • I mean that I've cited the formula which is correct but pdflatex generate something which I don't want. I'm sorry, but I translated binomial coefficient directly from Polish. Sorry for misrepresentation. – MC2DX Aug 11 '13 at 14:28

2 Answers2

258

To fix this, simply add a pair of braces around the whole binomial coefficient, i.e.

{N\choose k}

(The braces around N and k are not needed.)

However, as you're using LaTeX, it is better to use \binom from amsmath, i.e.

\binom{N}{k}

Further, it is not recommended to use $$ ... $$, see Why is \[ … \] preferable to $$? Last, I'll note that amsmath provides different commands for 'continuation dots', including \dotsc for triple dots between commas.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
 P(A) = \sum P(\{ (e_1,\dotsc,e_N) \})  =  \binom{N}{k} \cdot p^kq^{N-k}
\]
\end{document}
Torbjørn T.
  • 206,688
  • What differs between \dots and \dotsc, with overleaf.com, the outputs are identical. – pzorba75 Mar 28 '18 at 03:08
  • 3
    @pzorba75 The output of \dots depends on what it is placed between, try for example \documentclass{article} \usepackage{amsmath} \begin{document} $1,\dots,n$ $1+\dots+n$ \end{document}. Read also section 4.3 in the amsmath manual. – Torbjørn T. Mar 28 '18 at 06:28
11

Just add curly braces around it to separate it:

$$ P(A) = \sum P(\{ (e_1,...,e_N) \})  =  {{N}\choose{k}} \cdot p^kq^{N-k}$$

That should fix it.

Werner
  • 603,163
  • 2
    Hello @Lance Everhart! $$ ... $$ is obsolet. Use \[ ... \] see l2tabu on page 6. – Su-47 Mar 27 '18 at 22:25
  • 2
    Isn’t this exactly the same as the first line of the other answer? – GuM Mar 27 '18 at 22:25
  • Hello @GuM! No. Before the braces { and } weren't escaped by the slash sign. – Su-47 Mar 27 '18 at 22:29
  • I beg your pardon, escaped by what? – GuM Mar 27 '18 at 22:36
  • Hello @GuM! Maybe escaped isn't the correct word here. My english isn't well. If you wish to use { or } as a text sign, you should type \{ and \}. I meant the braces before and after (e_1,...,e_N). I hope it's now clear. – Su-47 Mar 27 '18 at 22:45
  • 2
    @Su-47: I don’t want to seem obstinate, but the braces around (e_1,...,e_N) are correctly indicated as \{ and \} in the existing answer too… – GuM Mar 27 '18 at 23:18
  • @GuM {{N}\choose{k}} is the difference. – CarLaTeX Mar 28 '18 at 03:05
  • 1
    @Su-47 $$...$$ is not obsolete, is TeX (and it should not be used in a LaTeX document, where you should use \[...\]). – CarLaTeX Mar 28 '18 at 03:10
  • @CarLaTeX: What’s the difference between {N\choose k} and {{N}\choose{k}} in this context? – GuM Mar 28 '18 at 08:22
  • @GuM Nothing, but I think that is the difference the OP was pointing out... – CarLaTeX Mar 28 '18 at 08:25
  • "{{N}\choose{k}}" instead of "{N}\choose{k}" binds the \choose operation to only what is in the outer braces instead of doing it over everything on the left side to everything on the right side of \choose, try the difference out and it works fine – Lance Everhart Mar 29 '18 at 17:00
  • @GuM: Ah sorry, its been fixed. I think it erased the slashes on them when I wrote my answer, those weren't meant to be removed, it was the extra braces around the {N}\choose{K} that was only meant to be different. – Lance Everhart Mar 29 '18 at 17:05
  • @LanceEverhart: I know how \choose works, I was just saying that your answer adds nothing to the other one, that was posted five years ago. I hate to sound that harsh, but the policy of this site is to ask users to avoid such duplicates. – GuM Mar 29 '18 at 17:21
  • @GuM I see what you are saying now. Sorry about that, I missed where the other person said {N\choose k}. – Lance Everhart Mar 29 '18 at 21:24
  • Hello @GuM! At the time I wrote my comment the braces { and } around (e_1,...,e_N) hadn't the backslash sign in front of each. In this time Werner corrected it, see. This is what I'm writing about. I hope it's now clear. In my comment above is an typo: I wrote slash sign and meaning backslash sign. – Su-47 Mar 30 '18 at 17:24