28

I'm trying to get a sum to display "properly" within a fraction. My input is:

\begin{equation}
    E = 1 - \dfrac{\sum_{i=1}^{n}(O_{i}-P_{i})^{2}}{\sum_{i=1}^{n}(O_{i}-\bar{O})^{2}}
\end{equation}

And the output looks like this: enter image description here

I want the indices to appear above and below the sum as opposed to the side. How can I go about doing this?

1
  • 3
    This is the proper way, in order to save some vertical space.
    – yo'
    Jun 9 '14 at 13:23
37

Use \limits just before _ and ^ in connection with \sum command, the same holds also for an integral \int\limits^{b}_{a} for example.

\documentclass[paper=a4,12pt]{book}


\usepackage{amsmath}
\begin{document}

\begin{equation}
    E = 1 - \dfrac{\sum\limits_{i=1}^{n}(O_{i}-P_{i})^{2}}{\sum\limits_{i=1}^{n}(O_{i}-\bar{O})^{2}}
\end{equation}

\end{document}

enter image description here

5
  • But shouldn't \dfrac make both numerator and denominator in \displaystyle mode?
    – Manuel
    Jun 9 '14 at 13:23
  • @Manuel: Yes, that is true, see tex.stackexchange.com/questions/135389/…, but as far as I know \displaystyle mode has no effect on the positioning of limits of sum or integral symbols
    – user31729
    Jun 9 '14 at 13:35
  • 1
    No, in fact it doesn't have to make both of them \displaystyle. If I'm not mistaken it just makes the whole fraction \displaystyle (therefore, the two parts are \textstyle).
    – Manuel
    Jun 9 '14 at 13:43
  • There is no need for \dfrac; here, \frac suffice. Jun 11 '14 at 7:49
  • @SvendTveskæg: I just used it from the 'MWE' above
    – user31729
    Jun 11 '14 at 7:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.