Skip to main content
To write math inside a sentence in LaTeX (inline math), wrap the formula in $...$ or \(...\). To center a formula on its own line (display math), use \[...\] for an unnumbered equation or \begin{equation}...\end{equation} for a numbered one. Load \usepackage{amsmath} in your document preamble from the start—it supplies display environments, \text, multiple-integral symbols, and other commands used throughout standard mathematical writing.

Inline and display math

Inline math compresses tall elements such as fractions and sums so line spacing stays even. Display math sets them at full size on a separate centered line.
inline-math.tex
Ready to use this syntax? Continue in the browser editor when you want to adapt the example in a real project.Open LaTeX Cloud Studio
If you want to compose a formula interactively first, you can type it into the LaTeX equation editor and copy the code.

Powers, roots, fractions, and exponentials

Most introductory formulas combine five commands that work in both inline and display math:
  • Superscripts and subscripts: ^ and _. Wrap multi-character arguments in braces, such as x^{10} or a_{i,j} (see Subscripts and superscripts for nested indices and primes).
  • Fractions: \frac{numerator}{denominator} (see Fractions and binomials for \dfrac, \tfrac, \cfrac, and \binom).
  • Roots: \sqrt{x} for a square root and \sqrt[n]{x} for an n-th root.
  • Exponentials and logarithms: write e^x or e^{-x^2} for short exponents, and \exp(...) when the exponent is tall or fractional; use \ln, \log, and \log_2 so function names render upright instead of as italic variables.
For ordinary and partial derivatives (such as \frac{d^2y}{dx^2} and \frac{\partial^2 f}{\partial x^2}), see the Physics and Engineering Notation section of Subscripts and superscripts.
roots.tex

Sums and products

Use \sum for summation and \prod for products, attaching lower and upper bounds with _ and ^. Limits sit beside the operator in inline math and above and below it in display style; see Operators and spacing to control limit placement.
example.tex

Integrals

Use \int for a single integral and \oint for a contour integral (both built into LaTeX). Load amsmath for double and triple integrals (\iint, \iiint). Put a thin space \, before the differential (dx) so it separates cleanly from the integrand.
example.tex

Limits

Use \lim with a subscript and \to (arrow) for limits, and \sup or \inf for supremum and infimum.
example.tex

Quick reference

Common mistakes

  • Using $$...$$ for display math: $$...$$ is a TeX primitive that ignores LaTeX display options such as the fleqn class option. Use \[...\] instead.
  • Omitting braces on multi-character exponents: $x^10$ raises only 1 and leaves 0 on the baseline. Write $x^{10}$.
  • Typing words or function names bare in math mode: $sin x$ and $speed * time$ set every letter as an italicized variable with no word spacing. Use \sin x for functions and \text{...} (from amsmath) for words.

Try it in the editor

LaTeX Cloud Studio compiles with the full TeX Live 2026 distribution, so amsmath and amssymb are available without extra setup. Start from the Basic Article template in LaTeX Cloud Studio and replace main.tex with the complete example above.