# \sum_i acts as \sum\limits_i but just sometimes

The code part looks like this

$$\frac { \left(\sum_i r_{ik}x_{ij}\right) - \mu'_{kj}\left(\sum_i r_{ik}\right) + (\alpha-1)-\mu'_{kj}(\alpha+\beta-2) } { \mu'_{kj}(1-\mu'_{kj}) } = 0$$
$$\left(\sum_i r_{ik}x_{ij}\right) - \mu'_{kj}\left(\sum_i r_{ik}\right) + (\alpha-1)-\mu'_{kj}(\alpha+\beta-2) = 0$$
$$\mu'_{kj} \left[\left(\sum_i r_{ik}\right)+\alpha+\beta-2\right] = \left(\sum_i r_{ik} x_{ij}\right)+\alpha-1$$
$$\mu'_{kj} = \frac{ \left(\sum_i r_{ik} x_{ij}\right)+\alpha-1 } { \left(\sum_i r_{ik}\right)+\alpha+\beta-2 }$$


For the first and last equation the \sum_i gets rendered as it should but for the two mid-equations the \sum_i gets rendered as \sum\limits_i which doesn't look good at all.

What has happened with my code?! The rest of the code can be found here: https://github.com/Jim-Holmstroem/dd2447/blob/map_first/homework/assignment2/doc.tex#L266

-

This is a displaystyle mathmode vs inline mathmode issue.

In your particular case, it comes down to using \sum in a \frac or not. You'll notice that in your first and last equation you haven't used \sum inside of a \frac. In your middle two equations, you have used it inside a \frac.

By default, TeX will display a \sum inside of a \frac as inline mode. You can change this by using \displaystyle immediately before it, or (better) \dfrac from the amsmath package.

If you're in displaystyle mode and you want it look like inline, then you can use the \textstyle command, which is (kind of) the opposite of \displaystyle. For example

$$\textstyle\sum_i$$


works fine, but I'm not sure how recommendable it is :)

-
I'd use \sum\limits_i in this case. – egreg Nov 23 '12 at 18:09