# [Tex/LaTex] Subscript of sum

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

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

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.