The integral sign never stacks on its own
The behaviour that confuses everyone for the first time: \int_a^b f(x)\,\mathrm{d}x puts a and b at the side of the sign, in a display as well as inline, and that is correct. TeX splits operators into two declarations. The large operators — \sum, \prod, \bigcup — are declared to take their limits above and below, which happens only in display style; the integral family is declared the other way, so its bounds stay at the side in both styles. That is literally how the format files define them, and the reason is the glyph: an integral sign already runs well above and below the math axis, so stacking bounds on top of it buys nothing and costs a line.
You can override it per occurrence with \int\limits_a^b (stacked) or \int\nolimits_a^b (side-set, which is already the default). \limits is a postfix switch that binds to the operator it follows, so it changes position only — never size, and never for the next operator on the line. Stacking is a house-style decision rather than a right answer: most maths publishers keep integral bounds at the side and reserve the stacked form for sums, so the places where \int\limits is clearly right are a multi-line condition that has to be read as a block, and matching a series or journal that stacks everything.
One consequence people hit in aligned blocks: because a display-sized stacked bound makes the whole row taller, one \int\limits in a four-line derivation moves every other row with it. Check whether the row is actually more readable, or whether you have just paid leading for a habit.
\int_a^b f(x)\,\mathrm{d}x
\int\limits_a^b f(x)\,\mathrm{d}x \qquad \int\nolimits_a^b f(x)\,\mathrm{d}x
Bounds: the one-token rule and the infinity case
A bound is an ordinary subscript or superscript, so the one-token rule applies: \int_a^b, \int_0^1, \int_{-\infty}^{\infty} all work because the bound is one token or is braced. The failure mode is the compound bound. \int_{n+1}^{2n} is right; \int_n+1^{2n} compiles without complaint and prints a subscript n, a +1 at full height and a superscript on the wrong object. It survives proof-reading precisely because nothing is missing — the material is simply at the wrong height.
Infinity bounds need no special handling: \int_{0}^{\infty}, \int_{-\infty}^{\infty}, \int_{a}^{+\infty} are all just symbols. What does need care is honesty about what the notation claims. \int_{0}^{\infty} is an improper integral — a limit of \int_{0}^{R} as R grows — and where that limit process is the point of the argument, write the limit explicitly rather than hiding it in a bound. Same for a singular lower bound: \int_{\varepsilon}^{1} with a following \lim_{\varepsilon \to 0^{+}} says something an \int_{0}^{1} does not.
The upper bound sits at the top of the tail of the sign and the lower bound at the bottom, so neither is vertically centred; that asymmetry is the glyph, not a bug, and it is why \int\limits with a long lower bound looks lopsided to a reader used to \sum.
\int_{-\infty}^{\infty} e^{-x^{2}}\,\mathrm{d}x = \sqrt{\pi} \qquad \int_{0}^{\infty} \frac{\mathrm{d}x}{1+x^{2}} = \frac{\pi}{2}
\int_{0}^{\infty} \frac{x^{s-1}}{e^{x}-1}\,\mathrm{d}x = \Gamma(s)\,\zeta(s)
Multiple and iterated integrals
Use the dedicated glyphs: \iint, \iiint and \iiiint are the amsmath integrals of multiplicity two, three and four, while the closed-surface forms \oiint and \oiiint come from additional packages (esint, wasysym). Do not build them by hand with \int\!\!\int: the kerning is approximate, the two signs have no shared relationship to the axis, and any bound you attach lands on whichever integral is nearest, not on the pair.
A multiple integral and an iterated integral are different objects and should look different. \iint_{D} f\,\mathrm{d}x\,\mathrm{d}y says: integrate over the region D. \int_{0}^{1}\int_{0}^{x} f(y)\,\mathrm{d}y\,\mathrm{d}x says: the order matters, here are the two one-dimensional integrations. When you change the order of integration the bounds and the differentials swap, which is the most common algebraic slip in a chapter of multivariable calculus — write the differentials last-to-first in the same order you rewrite the bounds, and readers can check you.
For an area element, \mathrm{d}A (or \mathrm{d}\sigma, \mathrm{d}S for surfaces) keeps the integrand short when the coordinate order is not the point. And when the bound of an inner integral is itself a formula — \int_{g_1(x)}^{g_2(x)} — braces are mandatory, and the subscripts on g are scriptstyle inside an already-scriptstyle bound, so keep those names one letter.
\iint_{D} f\,\mathrm{d}x\,\mathrm{d}y \qquad \iiint_{V} \rho\,\mathrm{d}V
\int_{0}^{1} \int_{0}^{x} f(y)\,\mathrm{d}y\,\mathrm{d}x = \int_{0}^{1} (1-y) f(y)\,\mathrm{d}y
Contour, surface and closed-path integrals
The circle on the sign carries meaning: \oint is integration over a closed curve, \oiint over a closed surface, \oiiint over a closed volume. If the path is not closed, write \int_{\gamma} — using the loop glyph for an open arc is a notation error, not a font preference. Conversely, once the loop is the point, \oint beats \int_{C} at a glance, which is why complex analysis is full of it.
Orientation is normally encoded in the text or in the path name, not in the glyph (\oint_{\partial \Omega} with \partial\Omega positively oriented, stated once). If you need the direction in the symbol, packages give you \ointctrclockwise and \ointclockwise (esint) or the arrows of \vec-annotated paths; most authors are better off writing it in a \text{…} note.
For averages over a domain — flux averages, mean values in PDE estimates — \fint or \dashint from the esint package is the one-character-percentage-of-your-life improvement; hand-built \frac{1}{\lvert B_r \rvert}\int is correct but shifts attention to the prefactor.
One practical warning: \iiiint, \oiint and \dashint are not universally supported outside LaTeX itself. The double and triple forms and \oint render in KaTeX, MathJax and pdfLaTeX alike; four-fold integrals and dashed signs are LaTeX-and-package specific, so on web renderers they degrade to text.
\oint_{\partial \Omega} P\,\mathrm{d}x + Q\,\mathrm{d}y = \iint_{\Omega} \left( \frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y} \right) \mathrm{d}x\,\mathrm{d}y
\operatorname{p.v.} \int_{-\infty}^{\infty} \frac{e^{ix}}{x}\,\mathrm{d}x = i\pi
The evaluation bar, and the invisible mate it needs
The fundamental-theorem shorthand — a vertical bar with the bounds at its foot and head — has no dedicated glyph, so it is built out of an auto-sized delimiter pair with one side silenced: \left. F(x) \right\rvert_{a}^{b}. The \left. is a real command, not an abbreviation: \left and \right must come in matched pairs inside the same maths list, and the period is the name of the zero-width delimiter. Leave it out and TeX does not guess — it reports a missing \right. or silently sizes the wrong thing.
Two manual alternatives, both better in a tight display: \Bigl[ F(x) \Bigr]_{a}^{b} when the brackets are part of the notation, and \bigl. \dots \bigr\rvert when you want a size you have chosen rather than one measured from the box. In an aligned derivation the manual ladder is the only option that can be kept constant across rows, because \left measures each row separately and the bars will not line up.
If this notation appears more than a few times, make it a command in the preamble: \newcommand{\eval}[2]{\left.#1\right\vert_{#2}}. Two arguments instead of one is usually right, since an evaluation point of x = 0 needs to be typeset as a subscript, and doing that by hand at every use is how the = goes missing from half of them.
\left. \frac{x^{2}}{2} \right|_{0}^{1} = \frac{1}{2} \qquad \Bigl[ F(x) \Bigr]_{a}^{b}
\left. or \right. as the mate, never a missing pair.The differential: roman or italic, and the space before it
\int f(x) dx is wrong twice over. The d is italic, so a reader parses it as a variable multiplied by x; and the space you typed does not exist, so d and x are glued. The standard fix is a thin space and an upright letter: \int f(x)\,\mathrm{d}x. ISO 80000-2 asks for the upright d, most analysis books keep the italic one, and both are defensible — what is not defensible is mixing them in one document, which reads as uncorrected copy-paste.
For the roman form, a bare \mathrm{d} has a small spacing flaw: it is an ordinary atom, so a preceding relation or minus does not get its usual operator spacing, and \mathrm{d} hugs whatever precedes it. The robust definition, used in a preamble, is \newcommand{\dd}{\mathop{}\!\mathrm{d}}: it makes the d behave like a prefix operator and then removes the space that classification adds. Then \int_{0}^{1} x^{2} \dd x is correct everywhere, including after a -.
The thin space is not decoration: it is what tells the reader that \mathrm{d}x is the operator being applied and not part of the integrand, and it is also what stops f(x)\,\mathrm{d}x\,\mathrm{d}y from setting as one long word. Put a \, before every differential and between stacked differentials, and keep the measure symbol attached where it belongs: \mathrm{d}\mu(x), \mathrm{d}^{2}x, \mathrm{d}\mathbf{A}.
\int \frac{\mathrm{d}x}{1+x^{2}} = \arctan x + C
\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb}
\usepackage{esint} % \fint, \dashint, \ointctrclockwise …
\title{Integrals: glyphs, bounds and differentials}
\author{A. Student}
\date{\today}
% A roman d that behaves like an operator: correct spacing after a relation
\newcommand{\dd}{\mathop{}\!\mathrm{d}}
% Evaluation bar: \eval{F(x)}{0}{1}
\newcommand{\eval}[3]{\left.#1\right|_{#2}^{#3}}
\begin{document}
\maketitle
\section{Definite integrals}
The bounds belong to the operator, so braces matter: for a bound longer
than one token write \verb|\int_{n+1}^{2n}|, never \verb|\int_n+1^{2n}|.
\[
\int_{0}^{1} x^{2} \dd x = \frac{1}{3},
\qquad
\eval{\frac{x^{2}}{2}}{0}{1} = \frac{1}{2}.
\]
\section{Several integrals}
\[
\iint_{D} f \dd A = \int_{a}^{b}\!\!\int_{g_1(x)}^{g_2(x)} f(x,y) \dd y \dd x,
\qquad
\iiint_{V} \rho \dd V = \int_{0}^{2\pi}\!\int_{0}^{1}\!\int_{0}^{r} F \dd z \dd r \dd\theta
\]
Average values use \verb|\fint| from the \texttt{esint} package:
\( \fint_{B_r} u \dd x \).
\section{Contour integrals}
\[
\oint_{\gamma} \frac{f(z)}{z-a}\,\dd z = 2\pi i\,f(a),
\qquad
\oiint_{\partial K} \mathbf{E}\cdot \dd\mathbf{A} = \iiint_{K} \frac{\rho}{\varepsilon_0} \dd V
\]
\section{Improper integrals}
Write the limit that is actually being taken; \verb|\int_0^\infty| is
shorthand, and where the shorthand hides a real argument it belongs in
the text:
\[
\int_{0}^{\infty} \frac{\dd x}{\sqrt{x}(1+x)}
= \lim_{R \to \infty} \int_{1/R}^{R} \frac{\dd x}{\sqrt{x}(1+x)}
= \pi.
\]
\end{document}
Long bounds, stacked conditions and layout
When a bound is genuinely a compound statement — a band of indices, a domain with two conditions — the honest shape is a stacked block under the operator: \iint\limits_{\substack{0 \le t \le T \\ x \in \Omega}}. \substack comes from amsmath, sets its lines in scriptstyle, centres them, and is the only construct that keeps the alignment of a two-line bound sane. The alternative \begin{subarray}{l} gives you left-aligned lines inside the same slot when the conditions share a prefix.
Everything on that line has now got taller, so check the neighbours: inside aligned a single stacked bound moves the whole row, and a bound that is wider than the operator makes the display look drunken. In prose, the better answer is usually to shorten the bound and name the set: \int_{\Omega_T} with \Omega_T = (0,T) \times \Omega defined once earlier, which is also what referees will ask you for.
Finally, remember that an integral is an operator in a sentence, and sentences drive spacing. \int_{0}^{1} f = 1 inside a clause needs no extra space around it; a \text{for} or \text{if} clause after a differential wants \quad; and a displayed formula ending in \,\mathrm{d}x followed by a comma should have that comma outside the maths — … \,\mathrm{d}x, — because the comma is prose, not part of the integrand.
\iiint\limits_{\substack{0 \le \theta \le 2\pi \\ r \le R}} f(r, \theta)\,\mathrm{d}V
\int_{a}^{b} f\,\mathrm{d}x = \int_{a}^{c} f\,\mathrm{d}x + \int_{c}^{b} f\,\mathrm{d}x
\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb,booktabs}
% There is no reliable global switch: \limits is a per-occurrence postfix.
% To stack every integral in a file, define a macro and use it instead of \int.
\newcommand{\sdint}{\int\limits} % stacked definite integral
\newcommand{\ddint}{\iint\limits}
\title{Four ways to bound an integral}
\author{A. Student}
\date{\today}
\begin{document}
\maketitle
\begin{table}[htbp]
\centering
\begin{tabular}{@{}lll@{}}
\toprule
source & in a sentence & on its own line \\
\midrule
\verb|\int_a^b f\,\mathrm{d}x|
& $\int_a^b f\,\mathrm{d}x$
& $\displaystyle \int_a^b f(x)\,\mathrm{d}x$ \\[12pt]
\verb|\int\limits_a^b f\,\mathrm{d}x|
& $\int\limits_a^b f\,\mathrm{d}x$
& $\displaystyle \int\limits_a^b f(x)\,\mathrm{d}x$ \\[12pt]
\verb|\sum_{k=1}^{n} k|
& $\sum_{k=1}^{n} k$
& $\displaystyle \sum_{k=1}^{n} k$ \\[12pt]
\verb|\sdint| (own macro)
& $\sdint_0^1 f\,\mathrm{d}x$
& $\displaystyle \sdint_0^1 f(x)\,\mathrm{d}x$ \\
\bottomrule
\end{tabular}
\caption{An integral keeps its bounds at the side in both styles; a large
operator such as \(\sum\) stacks only on its own line. \texttt{\textbackslash
limits} moves the bounds and pays the leading, and there is no global way to
ask for it that does not also affect sums, unions and limits.}
\end{table}
\[
\ddint_{D} f \,\mathrm{d}A = \int_{a}^{b}\!\int_{g_1(x)}^{g_2(x)}
f(x,y)\,\mathrm{d}y\,\mathrm{d}x
\]
\end{document}
Lesson cheat sheet
One key line of code from each section — jump to it or copy it straight from here.
\int_a^b f(x)\,\mathrm{d}x
\int_{-\infty}^{\infty} e^{-x^{2}}\,\mathrm{d}x = \sqrt{\pi} \qquad \int_{0}^{\infty} \frac{\mathrm{d}x}{1+x^{2}} = \frac{\pi}{2}
\iint_{D} f\,\mathrm{d}x\,\mathrm{d}y \qquad \iiint_{V} \rho\,\mathrm{d}V
\oint_{\partial \Omega} P\,\mathrm{d}x + Q\,\mathrm{d}y = \iint_{\Omega} \left( \frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y} \right) \mathrm{d}x\,\mathrm{d}y
\left. \frac{x^{2}}{2} \right|_{0}^{1} = \frac{1}{2} \qquad \Bigl[ F(x) \Bigr]_{a}^{b}
\documentclass[11pt,a4paper]{article}
Common mistakes
- An unbraced compound bound:
\int_n+1^{2n}compiles and prints+1at full height. Brace every bound longer than one token. \int\!\!\intinstead of\iint: the signs are hand-kerned, and bounds attach to one sign rather than to the pair.- Using
\ointfor an open path, or\int_Cfor a closed one when the closure is the point. The circle encodes topology, not taste. dxitalic with no thin space: TeX ignores your blank, so thedand thexset as a product of two variables. Write\,\mathrm{d}x, or define\ddonce in the preamble.- Forgetting the invisible mate in
\left. F \right|_{a}^{b}. There is no such thing as a lone\leftor a lone\right; the missing half is the error you get. - Stacking bounds with
\int\limitsin one row of analignedblock and then chasing the resulting ragged leading row by row with\\[6pt]. - Iterating an integral and rewriting the bounds while leaving
\mathrm{d}x\,\mathrm{d}yin the old order — the differentials must be read inside-out against the bounds.
Questions about this lesson
How do I put the limits of an integral above and below the sign?
\int\limits_a^b f(x)\,\mathrm{d}x. By default TeX keeps integral bounds at the side in both text and display style, because an integral is a variable-symbol operator rather than a large operator like \sum. Use the stacked form when the lower bound is a multi-line condition or when your house style stacks everything; otherwise leave it side-set.What is the difference between \int, \iint, \iiint and \oint?
\oint (and \oiint, \oiiint) adds a circle meaning "over a closed curve" — or closed surface, closed volume. Use the multiple glyphs rather than hand-kerned \int\!\!\int.Should the d in dx be roman or italic?
\mathrm{d} is the ISO 80000-2 recommendation and the convention in applied maths and physics; italic d remains standard in much pure analysis. Both are correct, one document must pick one, and either way you need the thin space before it.How do I typeset the vertical bar with bounds used after integration?
\left. F(x) \right|_{a}^{b}. Manually sized alternatives are \Bigl[ F(x) \Bigr]_{a}^{b} and \bigl. \dots \bigr|, which are the versions that stay consistent across the rows of an aligned derivation.Why do my integral bounds disappear in a subscript?
Is \iiiint safe to use?
Live playground: edit the LaTeX, see it render
The preview updates as you type — break it on purpose to see how errors look.
Keep reading
Three ways into the same idea: the notation itself, the lesson that teaches it, and an article that applies it.