# Better way to write multiple sums with complicated indices

Is there a way to display the indices of multiple series like that in a way that is clearer or easier to read? I am glad for any suggestions.

\documentclass{report}
\usepackage{amsmath}
\begin{document}
\begin{align}
\begin{split}
& \sum_{\{j=1,\dots ,m\}}
\sum_{\{p'\in X_{j}|s-l_{j}+1 \leq p' \leq s\}}
\sum_{\{q'\in Y_{j}|t-w_{j}+1 \leq q' \leq t\}}
\sum_{\{r'\in Z_{j}|u+1 \leq r' \leq H-h_{j}\}}
\left( \frac{P_{j}}{l_{j}\cdot w_{j}} \right)
\cdot x_{jp'q'r'} \\[10pt]
& \leq \sum_{\{i=1,\dots ,m\}}
\sum_{\{p\in X_{i}|s-l_{i}+1 \leq p \leq s\}}
\sum_{\{q\in Y_{i}|t-w_{i}+1 \leq q \leq t\}}
\sum_{\{r\in Z_{i}|u-h_{i}+1 \leq r \leq u\}}
\sigma_{i} \cdot x_{ipqr} \\[10pt]
& \forall s\in X, t\in Y, u\in Z.
\end{split}
\end{align}
\end{document}


• i do not understand what mean this math expresion: {\{p'\in X_{j}|s-l_{j}+1 \leq p' \leq s\}}? do you like to say that p'\in X_{j} and for indices of p are from domain: s-l_{j}+1 \leq p' \leq s ? can be this two part in two lines? welcome to tex.se! – Zarko Mar 11 '18 at 19:50
• the markup is more complicated than it need be, with split inside align, but also do you need multiple \sum can you not write it as a single summation and put all the ranges in a stack underneath (also use \mid not | to get better spacing for set expressions) – David Carlisle Mar 11 '18 at 20:01

Same idea as @David Carlisle's, with some improvements with mathtools:

\documentclass{report}
\usepackage{mathtools}

\begin{document}

\begin{multline}
\sum_{\substack{
j=1,\dots ,m\\
\mathclap{p'\in X_{j},\: s-l_{j}+1 \leq p' \leq s}\\
\mathclap{q'\in Y_{j},\: t-w_{j}+1 \leq q' \leq t}\\
\mathclap{r'\in Z_{j},\: u+1 \leq r' \leq H-h_{j}}
}}\mkern-6mu
\left( \frac{P_{j}}{l_{j}\cdot w_{j}} \right)
\cdot x_{jp'q'r'}
\leq\sum_{\substack{
i=1,\dots ,m\\
\mathclap{p\in X_{i},\: s-l_{i}+1 \leq p \leq s}\\
\mathclap{q\in Y_{i},\: t-w_{i}+1 \leq q \leq t}\\
\mathclap{r\in Z_{i},\: u-h_{i}+1 \leq r \leq u}
}}\mkern-12mu
\sigma_{i} \cdot x_{ipqr} \\%[10pt]
\forall s\in X, t\in Y, u\in Z.
\end{multline}

\end{document}


• yep I was in a rush mathclap a definite improvement here:=) – David Carlisle Mar 11 '18 at 21:32

If I understood the expression correctly, can you not use a single summation?

\documentclass{report}
\usepackage{amsmath}
\begin{document}
\begin{multline}
\sum_{\substack{
j=1,\dots ,m\\
p'\in X_{j}\mid s-l_{j}+1 \leq p' \leq s\\
q'\in Y_{j}\mid t-w_{j}+1 \leq q' \leq t\\
r'\in Z_{j}\mid u+1 \leq r' \leq H-h_{j}
}}
\left( \frac{P_{j}}{l_{j}\cdot w_{j}} \right)
\cdot x_{jp'q'r'}
\leq\sum_{\substack{
i=1,\dots ,m\\
p\in X_{i}\mid s-l_{i}+1 \leq p \leq s\\
q\in Y_{i}\mid t-w_{i}+1 \leq q \leq t\\
r\in Z_{i}\mid u-h_{i}+1 \leq r \leq u
}}
\sigma_{i} \cdot x_{ipqr} \\[10pt]
\forall s\in X, t\in Y, u\in Z.
\end{multline}
\end{document}


\documentclass{report}
\usepackage{amsmath}
\begin{document}
\begin{align*}
&\sum_{j=1}^m\
\sum_{\substack{p'=s-l_j+1\\p'\in X_j}}^s\
\sum_{\substack{q'=t-w_j+1\\q'\in Y_j}}^t\
\sum_{\substack{r'=u+1\\r'\in Z_j}}^{H-h_j}
\frac{P_jx_{jp'q'r'}}{l_jw_j}\\
&\leq\sum_{i=1}^m\
\sum_{\substack{p=s-l_i+1\\p\in X_i}}^s\
\sum_{\substack{q=t-w_i+1\\q\in Y_i}}^t\
\sum_{\substack{r=u-h_i+1\\r\in Z_i}}^u
\sigma_ix_{ipqr}
\quad\forall s\in X,\ t\in Y,\ u\in Z.
\end{align*}
\end{document}


• from math point of view you the second sum is equal to \sum_{p'\in X_j} where X_j=\{s-l+1, \dots, s\}` and can be written on the right side of equation. but i'm not sure, what op like to tell with used notation. – Zarko Mar 11 '18 at 20:25