# \atop vs. \substack for multiple lines under a sum

I did a search trying to find out how one can typeset multiple lines under a sum and found out that there is the possibility to use \atop or \substack together with a remark that one shouldn't use \atop.

Is there any good reason for that? Does it commit some typographical sins I am not aware of?

• – jub0bs Jan 11 '14 at 9:49
• See tex.stackexchange.com/a/73825/5001 for a discussion why \over (which shares many similarities with \atop) shouldn't be used in LaTeX documents -- any why \frac should be used instead. The syntax of the TeX "primitive" commands \atop and \over is quite different from that used by most other TeX macros, and if you violate one of these syntax rules you're liable to get weird, bad crashes. In contrast, \substack is crafted much more robustly. – Mico Jan 11 '14 at 9:53

Using \atop is abusing its functionality; if you want to turn a screw, sometimes a knife can help, but a screwdriver is surely better.

In other words, use \substack that has been specifically defined for this task and can accommodate any number of lines. It's also easier to use even for two lines.

\documentclass{article}
\usepackage{amsmath}

\begin{document}
$\sum_{1\le i\le n\atop i\ne j}\quad \sum_{\scriptstyle 1\le i\le n\atop\scriptstyle i\ne j}\quad \sum_{\substack{1\le i\le n\\ i\ne j}}$
\end{document}


The first is wrong; the second is complicated to write. With \substack you also avoid the warning

Package amsmath Warning: Foreign command \atop;
(amsmath)                \frac or \genfrac should be used instead
(amsmath)                 on input line 6.

• Why is it wrong to have a smaller font size? Or am I missing something else? – fifaltra Jan 11 '14 at 11:18
• @fifaltra The font size should be the same as if there is a single line. – egreg Jan 11 '14 at 11:20
• That makes sense. Thanks for the clarification :) – fifaltra Jan 11 '14 at 11:21