# Two lines subscript in summation symbol - LaTeX

The command substack in amsmath package enables summation subscripts to be multi lines.

$\sum_{ \substack{ n \in \Lambda \\ 0 < i < n } } f_{n} (a_{i})$


$\sum_{ \substack{ n \in \Lambda \\ 0 \lt i \lt n } } f_{n} (a_{i})$

If a subscript is too long, the spacing around the sum symbol is automatically adjusted by the subscript.

$\sum_{ \substack{ n \in \Lambda \\ 0 < i < \frac{\sqrt{n}}{2} + \sin n + n^{2p} } } f_{n} (a_{i})  \[ \sum_{ \substack{ n \in \Lambda \\ 0 \lt i \lt \frac{\sqrt{n}}{2} + \sin n + n^{2p} } } f_{n} (a_{i})$

The command \mathclap in mathtools package fixes that issue and the additional spacing between the sum and equation disappears.

$\sum_{ \mathclap{ \substack{ n \in \Lambda \\ 0 < i < \frac{\sqrt{n}}{2} + \sin n + n^{2p} } } } f_{n} (a_{i})$


$\sum_{ \mathclap{ \substack{ n \in \Lambda \\ 0 \lt i \lt \frac{\sqrt{n}}{2} + \sin n + n^{2p} } } } f_{n} (a_{i})$