- First code:
When I write the following code in TeX:
\begin{align*}
\sum_{i=1}^{5}a_i
\end{align*}
then in the output
the sub-script i=1 appears exactly in the bottum of the sigma-symbol;
and the super-script 5 appears exactly above the sigma-symbol.
- Second code:
But when I write the following code in TeX:
note that
$\sum_{i=1}^{5}a_i$
is greater than zero
in the outcome
the sub-script i=1 appears in the right-bottom of the sigma-symbol;
and the super-script 5 appears in the right-above of the sigma-symbol.
What changes should I apply to the second code;
such that the outcome is like the first code?
i.e. in the outcome the sub-scripti=1appears exactly in the bottum of thesigma-symbol; and the super-script5appears exactly above thesigma-symbol.

$is inline math designed to fit within the baseline spacing of the paragraph so normally you would use\[\sum...\]to get the displaystyle but if you really must, you can use$\displaystyle\sum...– David Carlisle Oct 14 '17 at 14:37\[\sum_{i=1}^{5}a_i\]as it is wrong to usealign*for single line displays with no alignment – David Carlisle Oct 14 '17 at 14:38