The summation Σ, the integral ∫, the set union ⋃ — these are special symbols, set large within a formula and carrying a range (limits) above, below, or beside them. LaTeX calls this family the variable-size operators (big operators) and produces them with commands such as \sum, \int, and \bigcup. The shared mechanic: a subscript _ and superscript ^ become the operator’s limits, which stack above and below the symbol in a display but sit at its right side within running text. This page sorts out how limits attach, how to control their position (\limits, \nolimits), multi-line subscripts, and how to define operators of your own.
What variable-size operators are
Math symbols come in two kinds: fixed-size ones that fit within the letter height (+, =, \cup, …), and variable-size operators that change size with the context they are set in. The headline examples are the summation \sum, the product \prod, the integral \int, and the set union \bigcup. These are set large in display style and compactly in text style, and each treats its subscript and superscript specially, as limits.
By “limits” we mean the subscripts that express the range of a sum or integral. Writing \sum_{i=1}^{n} makes i=1 the lower limit and n the upper limit. This is handled differently from an ordinary subscript or superscript (the kind that sits at the upper or lower right, as in x_i or x^2): a script attached to a variable-size operator may be placed directly below and above the symbol. Which of the two you get depends on the style it is set in and on the kind of symbol — the subject of the next section.
The core members are built into standard LaTeX (in fact into the underlying TeX) and need no extra package. The multiple integrals \iint and \iiint, the multi-line subscript \substack below, and the operator-defining \DeclareMathOperator all require the amsmath package. Since amsmath is the de facto standard, it is worth putting \usepackage{amsmath} in the preamble whenever you set serious mathematics.
Sums, products & how limits attach
The summation is \sum, the product is \prod, and the coproduct is \coprod. You give the range with a subscript _ and a superscript ^. In the summation \sum_{k=0}^{n} a_k, for instance, a display sets the summation sign Σ large with k=0 **directly below it and n directly above**. The same formula inline keeps Σ small so as not to disturb the line height, and sets k=0 and n small at the symbol’s right side, one above the other.
別行立て:
\[
\sum_{k=0}^{n} a_k = a_0 + a_1 + \dots + a_n,
\qquad \prod_{k=1}^{n} k = n!
\]
本文中: 級数 $\sum_{k=0}^{n} a_k$ は行内に収まる。This above/below-versus-side switch is the default behavior, tied to the style. The sum-class symbols — summation, product, coproduct, and the like — stack their limits above and below in display style but place them to the side in text style; amsmath calls this scheme displaylimits (limits above/below only when displayed). It is a sensible default that keeps the surrounding line spacing from spreading needlessly.
When the range has only one part, write just the one script. You can also place a condition in the lower limit, as in \sum_{i \in S}, which in a display sets i ∈ S directly under Σ. When a script spans more than one token, always wrap it in { } (as with the k=1 in \sum_{k=1}). Forget this and write \sum_k=1, and only the k becomes a subscript while =1 spills out to the right of the symbol.
Integrals — limits to the side
The integral sign is \int, and its range (the limits of integration) is again given by a subscript and superscript. Writing \int_a^b f(x)\,dx gives a definite integral with lower bound a and upper bound b. The important point is that integrals behave differently from sums by default. The integral-class symbols such as \int place their limits at the symbol’s right side even in a display. This follows mathematical convention: the definition of \int has \nolimits (side placement) built into it.
\[
\int_{0}^{\infty} e^{-x}\,dx = 1,
\qquad \oint_{C} \mathbf{F}\cdot d\mathbf{r}
\]Even in a display, this example sets 0 at the **lower right and ∞ at the upper right** of ∫ (where a sum would stack them above and below). The \, (thin space) between the integrand and dx is the small gap conventionally inserted in mathematical typesetting. A contour integral (around a closed curve) is \oint, which draws a small circle over the ∫.
You can set a multiple integral by repeating the symbol as \int\int, but the spacing between signs tends to look clumsy. Loading amsmath gives you dedicated commands with the spacing optimally tightened: the double integral \iint, triple \iiint, quadruple \iiiint, and the dotted multiple integral \idotsint (which places dots between two integral signs, as in ∫⋯∫). The spacing is adjusted for both inline and display use.
\[
\iint_{D} f(x,y)\,dx\,dy,
\qquad \iiint_{V} f\,dV,
\qquad \idotsint_{A} f\,dV
\]If you need the closed integral signs common in physics — the double and triple contour integrals over surfaces and volumes — the esint package provides \oiint, \oiiint, and the like. Out of the box, only \oint is available.
Changing limit position (`\limits` / `\nolimits`)
You can override the default placement with two commands. Put \limits immediately after an operator to force its limits above and below, or \nolimits to force them to the side. To push a sum’s range above and below within running text, for example, write \sum\limits_{k=1}^{n}; conversely, to stack the limits on a displayed integral, write \int\limits_0^1.
本文中で上下に: $\sum\limits_{k=1}^{n} k$
別行立ての積分を上下に:
\[
\int\limits_{0}^{1} x^2\,dx = \frac{1}{3}
\]What matters here is where you put it. \limits and \nolimits must come right after the operator they apply to (before the scripts). Placing one after the scripts, as in \sum_{k=1}\limits, is an error. When several of \limits, \nolimits, or \displaylimits appear in a row, the last one wins.
To return a symbol to the style-linked default (the sum-class displaylimits), use \displaylimits. The table below summarizes the default for each kind of symbol and the effect of the override commands.
| Symbol / command | Display style | Inline style |
|---|---|---|
\sum, \prod, \bigcup … | Stacked above/below | At the right side |
\int, \oint, \iint … | At the right side | At the right side |
\limits(作用素の直後) | Stacked (forced) | Stacked (forced) |
\nolimits(作用素の直後) | At the side (forced) | At the side (forced) |
\displaylimits | Stacked above/below | At the right side |
Limits & bounds (the `\lim` family)
\lim (limit), \limsup (limit superior), and \liminf (limit inferior) are operators set upright (roman) like function names, but their scripts behave in the sum-class way: in a display the subscript sits directly below, and inline it sits at the lower right. \limsup and \liminf are set as the two words “lim sup” and “lim inf,” with the proper space between them.
\[
\lim_{n \to \infty} \frac{1}{n} = 0,
\qquad \limsup_{n \to \infty} a_n \ge \liminf_{n \to \infty} a_n
\]Because this is a display, n→∞ is set directly below lim. The same formula inline sets n→∞ small at the lower right of lim. \sup, \inf, \max, and \min belong to the same family and place a subscript below (they are also gathered in the function-name section of “Math mode basics”). The arrow → is \to, and infinity is \infty.
Big operators (n-ary)
The n-ary operators used in set theory, logic, and algebra also have variable-size “big” versions, just like \sum. The command is the name of the corresponding binary operator prefixed with big. For the binary union \cup (A ∪ B), for instance, the variable-size version is \bigcup. All of these are sum-class, so they stack their limits above and below in a display and set them to the side inline.
| Command | Meaning | Binary counterpart |
|---|---|---|
\bigcup | Union (n-ary) | \cup (∪) |
\bigcap | Intersection (n-ary) | \cap (∩) |
\bigsqcup | Square union (disjoint) | \sqcup (⊔) |
\biguplus | Multiset union | \uplus (⊎) |
\bigvee | Logical OR / join | \vee (∨) |
\bigwedge | Logical AND / meet | \wedge (∧) |
\bigoplus | Direct sum (circled +) | \oplus (⊕) |
\bigotimes | Tensor product (circled ×) | \otimes (⊗) |
\bigodot | Circled dot (n-ary) | \odot (⊙) |
\[
\bigcup_{i=1}^{n} A_i, \qquad
\bigcap_{i \in I} A_i, \qquad
V = \bigoplus_{k} V_k
\]Because this is a display, \bigcup_{i=1}^{n} stacks i=1 directly below the large ⋃ and n above it. \bigoplus_{k} places k below an enlarged ⊕, expressing a direct sum V = V₁ ⊕ V₂ ⊕ … with a single symbol. Set inline, every one of these limits sits small at the symbol’s right side.
Multi-line subscripts (`\substack` & `subarray`)
You often want to write a condition on several lines under a sum or big operator (such as “0 ≤ i ≤ m and 0 < j < n”). With amsmath’s \substack{…}, each line separated by \\ becomes a centered, stacked subscript. Note that you put the whole \substack{…} in the subscript position.
\[
\sum_{\substack{0 \le i \le m \\ 0 < j < n}} P(i,j)
\]In a display this stacks “0 ≤ i ≤ m” and “0 < j < n” on two lines directly below Σ, each line centered. The \\ inside \substack separates lines and is not placed after the final line.
To left-align the lines, use the more general subarray environment. The {l} in \begin{subarray}{l} … \end{subarray} specifies left alignment ({c} would center), and you break lines with \\ as in \substack. It reads better when you want the conditions flush on the left.
\[
\sum_{\begin{subarray}{l} i \in \Lambda \\ 0 < j < n \end{subarray}} P(i,j)
\]Defining operators (`\DeclareMathOperator*`)
When you need an operator name that is not on the list, set upright and with its subscript directly below — think argmax, argmin, or esssup — use amsmath’s \DeclareMathOperator. Declare it once in the preamble, then call it as a short command in the body. The key to placing the limit directly below (the sum-class behavior of \lim) is the **starred form \DeclareMathOperator***. Without the star, the subscript sits at the lower right of the name.
% プリアンブルで:
\usepackage{amsmath}
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator{\rank}{rank}
% 本文で:
\[
\hat{\theta} = \argmax_{\theta} L(\theta),
\qquad \rank A \le n
\]Here \argmax is defined with the star, so a display sets θ directly below arg max (at the lower right inline). The \, in the name text is a thin inter-word space that separates the two words “arg max” nicely. \rank, by contrast, has no star, so \rank A is set as rank A upright and properly spaced, with any subscript at the lower right. For a one-off use you can also write \operatorname{rank} directly without declaring it (or \operatorname*{…} to place the limit below).
The name text follows special conventions: a hyphen - is set as an ordinary text hyphen (not a minus sign), and an asterisk * as a raised text asterisk (not the centered binary star). Function names should be set with \DeclareMathOperator or \mathrm, not \text{…}; this way the spacing around them is adjusted automatically and they stay upright even in an italic context such as a theorem environment.
A related trick: to put scripts at the four corners of a sum-class symbol — for example a prime (′) on a summation — amsmath offers \sideset. Writing \sideset{}{'}\sum_{n} a_n adds a prime at the upper right of Σ while still placing a limit below. \sideset is only for sum-class symbols; its first argument sets the left corners and its second the right.