Indefinite integrals
Write the integral sign with the integrand and differential:
\int x^2\,dx
The small spacing command before dx separates the differential visually without treating it as ordinary multiplication text.
Definite integrals
Attach lower and upper limits with subscripts and superscripts:
\int_{0}^{1} x^2\,dx
In display math, limits appear clearly around the operator. In inline math, the renderer may place them to the side to preserve line height.
Group complex bounds and integrands
Use braces whenever a bound or exponent has multiple tokens:
\int_{-\infty}^{\infty} e^{-x^2}\,dx
Keep the complete exponent grouped. A missing brace can move terms outside the exponential or attach them to the wrong operator.
Multiple and contour integrals
Common commands include:
\iint_D f(x,y)\,dA
\iiint_V \rho(x,y,z)\,dV
\oint_C \mathbf{F}\cdot d\mathbf{r}
Some multiple-integral commands depend on amsmath or renderer support. Check the package or supported-function list when the command fails.
Long calculations
For a derivation with several equality steps, use an aligned display environment rather than inserting manual spaces:
\begin{align}
\int_0^1 2x\,dx
&= [x^2]_0^1 \\
&= 1
\end{align}
Do not break a line between the integral sign and its integrand in a way that obscures scope.
Troubleshoot integral source
If a limit attaches to the wrong symbol, check where the subscript appears. If dx is italicized as two variables, use \,dx or a project-specific upright differential convention. If multiple integrals fail, load the expected package or use repeated \int commands as a fallback.
Common mistakes
- Omitting the differential entirely.
- Leaving multi-token limits ungrouped.
- Using an integral sign as a decorative symbol without defining the variable and domain.
- Mixing a contour integral with an ordinary line integral unintentionally.
- Forgetting the constant of integration for an indefinite integral.
Verify the mathematics
Differentiate an antiderivative to recover the integrand, or evaluate a definite integral numerically for a simple test case. Confirm that bounds, region labels, and differentials match the dimension and variables of the problem.
Editorial test case and error check
The test expression compared \int_0^1 2x\,dx with versions that omitted braces, the differential, or the spacing command. The correct source rendered the limits on the integral and evaluated to 1. The altered examples demonstrated why a source string can compile without an obvious error yet still communicate an incomplete or misleading mathematical operation.
Build a minimal test before the full expression
For write integrals in latex, start with the smallest source that contains the required command or environment. Render it with the same engine used by the final document, then add bounds, labels, alignment, and surrounding text one change at a time. This makes a missing brace, unsupported package, or environment error easy to isolate.
% Minimal test: keep only the structure being checked
\[ x^2 + y^2 = z^2 \]
Verify structure rather than appearance
- Confirm that every multi-token argument is grouped with braces.
- Check that operators, limits, and text labels use semantic commands rather than manual spacing.
- Compile with the intended packages and document class.
- Copy from the exported result and confirm that the editable source remains available.
Portability boundary
A command that works in a full TeX distribution may not work in KaTeX, MathJax, Word, or a Markdown renderer. Keep a fallback expression and record any required package. Convert to MathML only after the LaTeX structure is correct; conversion cannot recover semantics that were omitted from the source.
How this guide was checked
Review method: Intent alignment review, notation/source verification, worked-example check, cross-format rendering review, and duplicate-content comparison for How to Write Integrals in LaTeX
Verified against: Official standards, primary documentation, and the page-specific sources listed below
What changed: Removed repeated sitewide boilerplate and added content-type-specific decision, verification, and applicability guidance for this exact task.
Page purpose: write integrals in latex — Format and verify the topic in LaTeX
Automated quality check: Passed critical indexing checks.
Verification references
These primary standards and official documentation pages were used to check character identity, syntax, or platform behavior described above.
- LaTeX Project DocumentationThe LaTeX Project — LaTeX syntax, authoring model, and official documentation links.
- Comprehensive TeX Archive NetworkCTAN — Package documentation and command requirements.
- amsmath packageCTAN — Aligned equations, matrices, cases, operators, and advanced mathematical typesetting.
- KaTeX Supported FunctionsKaTeX — Browser-renderer command compatibility.