[Tex/LaTex] Subscript of sum

math-modemath-operatorssubscripts

How can I make a subscript for sum in latex like the following picture:

enter image description here

I tried \sum_{q_i} but that doesn't make the result I want. It makes the following result:
enter image description here

Best Answer

That is expected; it's a matter of inline math mode versus display math mode.

Inline math is meant for small fragments inside the running text, so it is typeset in a compact way, with the subscript to the side of the sum symbol. Inline math is done with $...$.

Display math is meant for larger, standalone equations, and is set in a paragraph of its own. Because it has more space, the subscript can be put underneath the sum symbol. Display math is done with \[...\] or a whole variety of environments.