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.

  • 9
    $\begingroup$ \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. $\endgroup$ Commented Sep 22, 2020 at 20:53
  • 1
    $\begingroup$ Thank you, @DanielFischer . That seems to be the definitive answer, which I could accept if it were posted as such. $\endgroup$ Commented Sep 22, 2020 at 21:09
  • $\begingroup$ 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}$$ $\endgroup$ Commented Sep 25, 2020 at 12:41

1 Answer 1


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.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .