Definition of \limits

I am trying to understand how the \limits comand works in math mode but I cannot find its definition anywhere. So far, I've tried latex.ltx and amsmath.sty but I am now assuming it is stored somewhere else.

\limits is a tex primitive. from victor eijkhout's "tex by topic" (pp. 287, 289):

• \limits (primitive command) Place limits over and under a large operator. This is the default position in display style.
• \nolimits (primitive command) Place limits of a large operator as subscript and superscript expressions. This is the default position in text style.

• \displaylimits (primitive command) Restore default placement for limits.

chapter 37 of "tex by topic" is a glossary of tex primitives. if you are using a tex live system with documentation loaded, you can refer to this book online by texdoc texbytopic.

• There's also \displaylimits. ;-) Can you add what's the behavior when these control sequences are one after another? – egreg Jun 15 '13 at 17:54
• @egreg -- done. (i argued with myself whether i should include it first time around, and lost the argument.) – barbara beeton Jun 15 '13 at 18:00
• Thanks for the texbytopic reference. – pluton Jun 15 '13 at 18:07

\limits is a TeX primitive.

When you have a doubt whether a command is a primitive or not, I suggest you to have a look at TeX Primitive Control Sequences.

This is the definition you can find there:

SEVERAL math symbols such as summation and integration often appear with subformulas as subscripts and superscripts.

The subformulas may be typeset either above and below or to the right of the symbol. Normal mathematical conventions use the first method for most displayed expressions and the second for most in-line expressions.

TeX's conventions use the first method in display style and the second method in text style.

TeX has three commands which change these conventions: \limits always uses the first method; \nolimits always uses the second method; and \displaylimits uses TeX's normal conventions.

If two or more of these commands follow each other, the last one controls how the expression is typeset. Each of these commands must follow a large operator (class 1). Otherwise, TeX generates an error.

From "The TeXbook" by Donald E. Knuth:

[…]
If you say \nolimits\limits ([…]), the last word takes precedence. There's also a command \displaylimits that can be used to restore TeX's normal conventions; i.e., the limits will be displayed only in styles D and D'.
[…]
Certain kinds of atoms carry additional information besides their nucleus, subscript, and superscript fields: An Op atom will be marked \limits or \nolimits if the normal \displaylimits convention has been overwritten; […]

Chapter 26: Summary of Math Mode
[…]
• \displaylimits, \limits, \nolimits. These commands are allowed only if the current list ends with an Op atom. They modify a special field in that Op atom, specifying what conventions should be used with respect to limits. The normal value of that field is \displaylimits.

\limits is a TeX primitive. If you write \show\limits, the result in the *.log file is

> \limits=\limits.


According The TeXBook, p. 144:

A displayed \sum usually occurs with \limits, i.e., with subformulas
that are to appear above and below it.