56

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?

2
  • 2
    related: stackoverflow.com/a/1988473/2541573
    – jub0bs
    Jan 11, 2014 at 9:49
  • 4
    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, 2014 at 9:53

1 Answer 1

77

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}

enter image description here

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.
3
  • 7
    Why is it wrong to have a smaller font size? Or am I missing something else?
    – fifaltra
    Jan 11, 2014 at 11:18
  • 12
    @fifaltra The font size should be the same as if there is a single line.
    – egreg
    Jan 11, 2014 at 11:20
  • 1
    That makes sense. Thanks for the clarification :)
    – fifaltra
    Jan 11, 2014 at 11:21

You must log in to answer this question.

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