# How to place the subscript under two summation signs in a fraction?

I would like to place a subscript under two summation signs in a fraction, in an equation. The code showed works when it is not in a fraction, but as soon as I use it in a fraction the subscript is placed after the two summation signs, instead of under the two summation signs.

$$\frac{{\sum\sum\limits}_{i \neq j} \sum\limits_{x}\sum\limits_{y}[\pi_{x(i),y(j)} - \pi_{x(i)}\pi_{y(j)}]} {\sigma^2_X}$$


Does anyone know how to solve this?

• Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Jan 28 '15 at 13:02

You need to enclose the two summation symbols in \mathop{} and then place \limits after that.

\documentclass{article}
\begin{document}

$$\frac{\mathop{\sum\sum}\limits_{i \neq j} \sum\limits_{x}\sum\limits_{y}[\pi_{x(i),y(j)} - \pi_{x(i)}\pi_{y(j)}]}{\sigma^2_X}$$

\end{document}


• +1. Also, I'd add the new operator double sum \DeclareMathOperator*{\dsum}{\sum\sum} – Sigur Jan 28 '15 at 13:01
• @Sigur True, even thought I would only declare a new operator if I were to use this construct multiple times. – Henri Menke Jan 28 '15 at 13:06

If you use lualatex, you can place the \limits outside of the braces:

{\sum\sum}\limits_{i\neq j}


However, this will throw an error if compiled with pdflatex or xelatex, then you need a \mathop:

\mathop{\sum\sum}\limits_{i\neq j}


If you need this more often, you can define a new mathoperator (needs amsmath), if you use the starred Version, the default is the use of \limits.

\DeclareMathOperator*{\ssum}{\sum\sum}


If you are inside a \frac, displaymode is turned of, you can switch it back on:

$$\frac{\displaystyle \ssum_{i\neq j}}{2}$$

• It does not work. Limit controls must follow a math operator. ...} {\sum\sum}\limits – Sigur Jan 28 '15 at 13:04
• This won't work. ! Limit controls must follow a math operator. Please improve your answer. – Henri Menke Jan 28 '15 at 13:04
• i compiled it! With lualatex using mathtools and unicode-math – MaxNoe Jan 28 '15 at 13:05
• @MaxNoe, in that case, it works. – Sigur Jan 28 '15 at 13:08
• @MaxNoe Aha! You found another tex vs. luatex incompatibility. – Henri Menke Jan 28 '15 at 13:08