0
    $\[ \sum_{k=0}^{n} \binom{n}{k} = 2^n\] $

Do I need a special package, or is something else wrong with this?

Ingmar
  • 6,690
  • 5
  • 26
  • 47
Matko
  • 101
  • 3
    You had not insert display math environment inside inline math environment! Should be \[ \sum_{k=0}^{n} \binom{n}{k} = 2^n\]. – Zarko Mar 31 '22 at 15:22
  • 6
    you can not have \[ inside $ use $ for inline math or \[ for display math, not both. – David Carlisle Mar 31 '22 at 15:22
  • 5
    also \binom is not defined by default, (comes from amsmath) – David Carlisle Mar 31 '22 at 15:23
  • You wrote $ $$ \sum_{k=0}^n ... $$ $ which seems to be over complicated. – wipet Mar 31 '22 at 19:31
  • thanks, to give some context the problem is it doent display it right when i pput $$, the limits of the sum are not above and below sigma , i dont know how to do this – Matko Apr 02 '22 at 10:37

2 Answers2

7

It seems you are struggling with some very basic tasks of LaTeX. Please consider consulting an introductory text. You can find an exhaustive list here:


You are trying to nest displayed math inside inline math. This cannot work. You can only use one of the two at a time.

Display math is introduced by \[ ... \] whereas inline math is delimited by $ ... $. Without context it's hard to say which one is more appropriate here, but I guess it is display math (i.e. centered horizontally and on a separate line).

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

[ \sum_{k=0}^{n} \binom{n}{k} = 2^n ]

\end{document}

enter image description here

Henri Menke
  • 109,596
  • Thanks for the quick answer. – Matko Apr 02 '22 at 10:33
  • I did use latex some time ago, but i forgot even that little i knew in what now im 1000 lines in and i didnt know about this [] function. – Matko Apr 02 '22 at 10:35
  • But its not what i need, cause i want the equation in a sentence so i need $$, but then it doesnt display the limits of the sum the same way, above the sigma symbol. – Matko Apr 02 '22 at 10:36
  • @Matko That is on purpose, so that the vertical height of the sum doesn't open up the line too much. If you don't care about that you can use $\sum\limits_{k=0}^{n} \binom{n}{k} = 2^n$. – Henri Menke Apr 02 '22 at 18:22
  • Oh yea that's what I wanted thanks. – Kugutsu-o Apr 03 '22 at 19:48
  • Sorry for wrong name they ip banned me on skeptics. They really don't like those covid questions lol. – Kugutsu-o Apr 03 '22 at 19:50
  • I love this community though somebody is always willing to help, even for a minor derail like this, but Iv really found it strange to have sums in that form, the latter is much nicer to me even if it takes up some more space. – Kugutsu-o Apr 03 '22 at 19:52
0

You can use the command \displaystyle in an inline expression (with $...$) to have equations displayed as in isolated math mode (the one you obtain with \[...\]).

In your example, it would be: $\displaystyle\sum_{k=0}^n \binom{n}{k} = 2^n$.

  • 1
    Your suggestion is possible, but not recommended. Using it lead to very poor typography. That is reason why latex has different formatting of in-line math from displayed ones. Also it not explain the OP problem. – Zarko Apr 05 '22 at 16:14
  • According to the comments of OP, that was what he was trying to achieve by combining \[...\] and $...$. Though it is not proper typography, it can prove useful in some context, and it is the author decision to make. – pandamoniark Apr 06 '22 at 11:56