# In MathJax, how can one write a double underscript on a displayed summation sign?

Typically, summation is over some range, such as $$k=1,...,n$$, which might be written $$\sum_{k=1}^nx_k\quad\text{or}\quad\sum_{k=1,...,n}x_k.$$But suppose that the range is restricted by a further condition, for example $$k\neq\lfloor n/2\rfloor$$. Now the underscript reads as in$$\sum_{k=1;\;k\neq\lfloor n/2\rfloor}^nx_k\quad\text{or}\quad\sum_{k=1,...,n;\;k\neq\lfloor n/2\rfloor}x_k.$$Perhaps the right-hand one is better here, but better still is to follow it except with the extra condition $$k\neq\lfloor n/2\rfloor$$ underneath the primary condition $$k=1,...,n$$ (without the semicolon). I have seen this in journals, but unfortunately can't show what I mean here because I don't know how to do it in MathJax. So, how is it done in MathJax?

Of course, this extends to other operations, such as product, union, and so on.

• \substack helps. $$\sum_{\substack{k = 1 \\ k \neq \lfloor n/2\rfloor}}^{n} x_k$$ via \sum_{\substack{k = 1 \\ k \neq \lfloor n/2\rfloor}}^{n} x_k. Sep 22 '20 at 20:53
• Thank you, @DanielFischer . That seems to be the definitive answer, which I could accept if it were posted as such. Sep 22 '20 at 21:09
• By the way, $$\sum_{a=b\\b+c=d}e_{abc}$$ also makes a new line in Mathjax (but not latex) with less than ideal formatting $$\sum_{a=b\\b+c=d}e_{abc}$$ Sep 25 '20 at 12:41

The \substack command allows one to stack several lines under (and over) an operator symbol like $$\sum$$, $$\prod$$ etc. The argument is enclosed in braces, and lines are separated by a double backslash. For example \sum_{\substack{k = 1 \\ k \neq \lfloor n/2\rfloor}}^{n} x_k produces $$\sum_{\substack{k = 1 \\ k \neq \lfloor n/2\rfloor}}^{n} x_k$$ where two lines are used under the sum sign. It is rarely advisable to use more than three lines, in my opinion.