# How to stack limits for maths operators?

I have a question on how is it possible to create a \sum with two lower limits directly positioned right underneath each other. I have tried hard and cant seem to get anywhere with it.

-

I like it better when the i and j are aligned:

This is done by \mathrlap and \mathclap (see this TuGboat article). The article describes the use of some new macro's, including:

\def\mathrlap{\mathpalette\mathrlapinternal}
\def\mathclap{\mathpalette\mathclapinternal}
\def\mathllapinternal#1#2{\llap{$\mathsurround=0pt#1{#2}$}}
\def\mathrlapinternal#1#2{\rlap{$\mathsurround=0pt#1{#2}$}}


add these to your preamble (or load the mathtools package) and you can do something like this:

$\sum\limits_{\substack{\mathllap{1\le} i \mathrlap{\le 10} \\ \mathllap{1 \le} j \mathrlap{\le 5}}}^\infty x^i y^j$


which produces, in my opinion, a far superior result:

Note that I've added the upper limit \inftyas an example, although I don't see how i and j would be smaller than 10 of 5 and still run up to ininity (ah well, it's just an example).

-
maybe it should also be said that the \mathclap etc... macros (or some slightly improved version of them, according to the doc) are available via the mathtools package? – jfbu May 1 '11 at 7:53
ok yes, I didn't know that myself (I only skimmed the article once), great tip! – romeovs May 1 '11 at 7:56
\documentclass[12pt]{article}
\usepackage{mathtools}
\begin{document}

$\sum_{\substack{1 \le i \le 10\\ 1 \le j \le 5}}^\infty x^{i} y^{j} \qquad \sum_{\mathclap{\substack{1 \le i \le 10\\ 1 \le j \le 5}}}^\infty x^{i} y^{j}$

\end{document}


-
 Thanks a ton. I never knew of this command. Could you please edit your answer to show how to also inlcude the top limit, say "infinity". – night owl May 1 '11 at 6:00 @night owl: it is done as usual, see edit – Herbert May 1 '11 at 6:30 you didn't update the image, so perhaps mention that \infty will indeed appear. – Bruno Le Floch May 1 '11 at 6:52

Use \substack, as in

\documentclass[12pt]{article}
\usepackage{amsmath}
\begin{document}
\thispagestyle{empty}

$$\sum_{\substack{1 \le i \le 10\\ 1 \le j \le 5}} x^{i} y^{j}$$

\end{document}


which produces:

-
 Thank You. Looks good. – night owl May 1 '11 at 6:01