35

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
    related: stackoverflow.com/a/1988473/2541573 – jub0bs Jan 11 '14 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 '14 at 9:53
51

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.
  • 4
    Why is it wrong to have a smaller font size? Or am I missing something else? – fifaltra Jan 11 '14 at 11:18
  • 7
    @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
  • As usual, not just unmatched technical proficiency, but valuable words of wisdom ;) Thanks as always @egreg – dpritch Sep 3 '18 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.