Inline and Display Math in LaTeX: $…$, \[…\] and equation

Quick answer

  • Inline math (in line with the text): $a^2 + b^2 = c^2$ or \(a^2 + b^2 = c^2\).
  • Display math, unnumbered: \[ E = mc^2 \], on its own centred line.
  • Display math, numbered: \begin{equation} E = mc^2 \end{equation}; equation* (amsmath) for no number.
  • Do not use $$ ... $$: it is plain TeX and breaks fleqn, \tag and amsmath spacing.
  • Words inside math: \text{if } x > 0 (amsmath).
  • Full-size fraction inline: $\displaystyle\frac{1}{2}$ or $\dfrac{1}{2}$.

LaTeX has two math modes. Inline math sits inside a sentence and is written between $...$ or \(...\); display math stands on its own line and is written with \[...\] or, when it needs a number, the equation environment. This guide covers both modes and the basic LaTeX math syntax, then fractions, roots, piecewise functions, brackets, aligned equations, numbering, spacing, text inside math, and the errors you will meet along the way.

Inline Math in LaTeX

To put math in line with your text, wrap it in single dollar signs, $...$, or in \(...\). The formula is set at text size inside the paragraph and the line breaks around it like any other word:

\documentclass{article}
\begin{document}

The Pythagorean theorem states that $a^2 + b^2 = c^2$.

% The same thing with \( ... \)
The Pythagorean theorem states that \(a^2 + b^2 = c^2\).

Let $f(x) = x^2$ and $n \geq 1$; then $f(n) \geq n$.

\end{document}

The two forms produce identical output. \(...\) has one practical advantage: the opening and closing commands differ, so a forgotten \) is caught at the next \( with Bad math environment delimiter. A forgotten $ silently pairs with the next $, and the error shows up lines later. Most people still type $ because it is shorter; either is correct.

Inline math is set in text style: fractions shrink, and limits on sums and integrals move to the side so the formula fits the line height. That is why $\frac{1}{2}$ and $\sum_{i=1}^n i$ look smaller in a sentence than in a display.

\displaystyle inline

To force full-size pieces inside a sentence, start the formula with \displaystyle, or use \dfrac for a single fraction. The reverse, \textstyle and \tfrac, shrinks pieces inside a display:

\documentclass{article}
\usepackage{amsmath}   % for \dfrac and \tfrac
\begin{document}

The series $\displaystyle\sum_{n=1}^{\infty} \frac{1}{n^2}$ converges.

The ratio $\dfrac{a}{b}$ is large; the exponent $2^{\tfrac{n}{2}}$ is small.

\[
  \textstyle\frac{1}{2} \qquad \textstyle\sum_{i=1}^{n} \qquad \textstyle\int_0^1
\]

\end{document}

Use \displaystyle inline sparingly: it makes the line taller and pushes the lines around it apart. If an inline formula needs display style, it usually wants to be a display.

Display Math in LaTeX: \[...\], equation and displaymath

Display math puts the formula on its own line, centred, with space above and below. Fractions, sums and integrals are set at full size. There are four ways to write it:

SyntaxNumberedNeedsUse it for
\[ ... \]NonothingMost unnumbered displays
\begin{displaymath} ... \end{displaymath}NonothingSame as \[...\], long form
\begin{equation} ... \end{equation}YesnothingEquations you will refer back to
\begin{equation*} ... \end{equation*}NoamsmathAn unnumbered equation, e.g. while drafting
$$ ... $$NonothingNothing: plain TeX, avoid in LaTeX
\documentclass{article}
\usepackage{amsmath}
\begin{document}

An unnumbered display:
\[
  E = mc^2
\]
and the same with the long form:
\begin{displaymath}
  E = mc^2
\end{displaymath}

A numbered display:
\begin{equation}
  E = mc^2 \label{eq:energy}
\end{equation}
As \eqref{eq:energy} shows, mass and energy are equivalent.

\begin{equation*}
  E = mc^2   % no number, amsmath
\end{equation*}

\end{document}

Do not leave a blank line before or inside a display. A display belongs to the paragraph around it, so a blank line before \[ adds an unwanted paragraph break and extra space, and a blank line inside it stops the compile with Missing $ inserted.

equation vs equation*

equation numbers the display, (1), (2) and so on, and lets you attach a \label for \ref or \eqref. equation* is the same environment without the number; it comes from amsmath and gives the same result as \[...\]. Switching between the two is a one-character change, which makes equation* handy for equations whose number you may need later. Both hold exactly one line; for several lines use align or split (see multiline equations).

Why $$...$$ is discouraged

You will see $$...$$ in older documents and on the web, and it does compile. It is plain TeX syntax, though, and in LaTeX it misbehaves in three ways: it ignores the fleqn class option, so that display stays centred while every \[...\] moves to the left margin; amsmath does not know about it, so \tag stops with \tag not allowed here and the spacing above the display can come out wrong; and it is unchecked, so a stray $$ goes unnoticed where \[ would report an error. Use \[...\]; it is the same number of keystrokes.

% Avoid
$$ E = mc^2 $$

% Prefer
\[ E = mc^2 \]

When to use each

  • Inline math: short expressions in running text, such as “where $n$ is a positive integer”.
  • Display math: important equations, long formulas, or anything the reader should study.
  • Numbered display (equation, align): anything you will refer back to.

LaTeX Math Syntax Basics

Inside either math mode the same rules apply. These cover most of what you type in LaTeX maths:

  • Superscripts and subscripts: x^2, a_i. Braces group more than one character: x^{10}, a_{ij}.
  • Commands start with a backslash: \alpha, \infty, \leq, \sin. Arguments go in braces: \frac{a}{b}, \sqrt{x}.
  • Spaces are ignored: $a+b$ and $a + b$ are identical. LaTeX spaces operators and relations itself; use \, or \quad to add space.
  • Letters are variables: each letter is set in italic as a separate symbol, so words need \text and function names need \sin, \log or \operatorname.
  • Reserved characters: { } group, & aligns, % starts a comment. Write \{ \}, \&, \% to print them.
\documentclass{article}
\usepackage{amsmath}
\begin{document}

Scripts: $x^2$, $x^{10}$, $a_{ij}$, $e^{-x^2}$, $x_1^2$.

Commands: $\alpha + \beta \leq \infty$, $\sin x$, $\frac{a}{b}$, $\sqrt{2}$.

Spacing is automatic: $a+b=c$ and $a + b = c$ look the same.

Text in math: $f(x) = 0 \text{ for all } x$.

Literal characters: $\{1, 2, 3\}$, $50\%$.

\end{document}

Text inside math: \text{}

Typed words inside $...$ come out as italic variables run together (forall instead of “for all”). Wrap them in \text from amsmath, which uses the surrounding text font and scales correctly in sub- and superscripts. Put the spaces inside the braces, because spaces in math are ignored:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\[
  f(x) = x^2 \quad \text{for all } x \geq 0
\]

% \text inside a subscript scales down with it
\[
  v_{\text{max}} = 3 \text{ m/s}
\]

% Math inside \text goes back in $...$
\[
  g(n) = 1 \quad \text{if $n$ is prime}
\]

\end{document}

\mathrm and \mbox are alternatives, covered under Text Inside Math further down.

Keeping heights consistent with \mathstrut

Radicals, fractions and brackets size themselves to their content, so \sqrt{a} and \sqrt{y} come out with roots of different heights. \mathstrut is an invisible box as tall as a parenthesis; putting it inside each root makes them match:

\[
  \sqrt{a} + \sqrt{b} + \sqrt{y}                          % uneven
  \qquad
  \sqrt{\mathstrut a} + \sqrt{\mathstrut b} + \sqrt{\mathstrut y}   % even
\]

Fractions

Fractions are one of the most common constructs in mathematical writing. LaTeX provides several commands depending on how you want them displayed.

\frac{}{} – Standard Fraction

The basic \frac command adapts its size to the current mode: full-size in display math, compact in inline math.

% Display mode – full size
\[
  \frac{a}{b} + \frac{c}{d} = \frac{ad + bc}{bd}
\]

% Inline mode – compact
The probability is $\frac{1}{6}$ for each face.

\dfrac{}{} – Display-Style Fraction

Forces a full-size (display-style) fraction even in inline mode. Requires theamsmath package.

% Force display-size fraction inside inline text
The answer is $\dfrac{n!}{k!(n-k)!}$.

\tfrac{}{} – Text-Style Fraction

Forces a compact (text-style) fraction even in display mode. Useful inside exponents or subscripts.

\[
  2^{\tfrac{n}{2}} \quad \text{instead of} \quad 2^{\frac{n}{2}}
\]

\cfrac – Continued Fractions

Designed specifically for continued fractions, keeping each level properly sized.

\[
  \cfrac{1}{1 + \cfrac{1}{1 + \cfrac{1}{1 + \cfrac{1}{\ddots}}}}
\]

Square Roots, Nth Roots and Radicals

The \sqrt command produces a square root symbol that automatically stretches to fit its argument.

Basic Square Root

\[
  \sqrt{a^2 + b^2} \qquad \sqrt{\frac{a}{b}} \qquad \sqrt{2} \approx 1.414
\]

Nth Root

Pass an optional argument in square brackets for an arbitrary root index. The radical and its index are equivalent to a fractional power, which is often clearer in running text.

\[
  \sqrt[3]{27} = 3
  \qquad
  \sqrt[n]{x} = x^{1/n}
  \qquad
  \sqrt[4]{x^3}
  \qquad
  \sqrt[n]{a^n} = |a|
\]

Positioning the index: \leftroot and \uproot

A tall or wide index such as n or \beta can sit too low and too far from the radical. amsmath provides \leftroot and \uproot to nudge it; the arguments are in small units, negative \leftroot moves the index right (closer to the radical) and positive \uproot moves it up:

\usepackage{amsmath}

\[
  \sqrt[n]{x}
  \qquad
  \sqrt[\leftroot{-2}\uproot{2}n]{x}        % index tucked in and raised
  \qquad
  \sqrt[\leftroot{-3}\uproot{3}\beta]{k}
  \qquad
  \sqrt[\uproot{3}n]{x}                      % raise only
\]

Nested Roots

LaTeX handles nested roots gracefully; each inner root is drawn at the size of its content. For deeply nested expressions you may want to add a small space with \, for readability, and \smash[b] keeps a root with a descender (such as y) from being taller than its neighbours.

\[
  \sqrt{1 + \sqrt{1 + \sqrt{1 + \sqrt{1 + x}}}}
  \qquad
  \sqrt{2 + \sqrt{3}}
  \qquad
  \sqrt{x}\,\sqrt{y}
  \qquad
  \sqrt{\smash[b]{y}}
\]

Parentheses and Brackets

Delimiters (parentheses, brackets, braces) are essential for grouping sub-expressions. LaTeX can automatically scale them to fit or you can control sizing manually. The brackets guide covers every delimiter in detail; here are the essentials.

Basic Delimiters

\[
  (a + b) \quad [a + b] \quad \{a + b\}
  \quad \langle a + b \rangle
  \quad |a + b| \quad \|a + b\|
\]

Auto-Sizing with \left and \right

Wrap your delimiters with \left and \right to scale them automatically to the height of the enclosed content.

\[
  \left( \frac{a}{b} \right)
  \qquad
  \left[ \sum_{i=1}^{n} x_i \right]
  \qquad
  \left\{ \frac{1}{2}, \frac{1}{3}, \frac{1}{4} \right\}
\]

If you need only one side, use \left. or \right. for an invisible delimiter:

\[
  \left. \frac{d f}{d x} \right|_{x=0}
\]

Manual Sizing

Sometimes \left/\right don't produce the size you want. Use the manual sizing commands for precise control:

\[
  \big( \Big( \bigg( \Bigg(
  \quad
  \big] \Big] \bigg] \Bigg]
  \quad
  \big\{ \Big\{ \bigg\{ \Bigg\{
\]

This is especially helpful inside multi-line equations where auto-sizing cannot span across line breaks.

Aligned Equations

When you have multiple lines of equations that should line up at a particular point (usually the equals sign), use alignment environments from theamsmath package. The multiline equations guide goes through every case.

The align Environment

The workhorse for multi-line equations. Use & to mark the alignment point and \\ to break lines.

\begin{align}
  f(x) &= x^2 + 2x + 1 \\
       &= (x + 1)^2
\end{align}

Each line is numbered by default. Use align* to suppress all numbers, or \nonumber on individual lines.

\begin{align}
  a &= b + c \nonumber \\
  d &= e + f \label{eq:important}
\end{align}

The split Environment

Use split inside an equation environment when you want a single equation number for multiple lines.

\begin{equation}
  \begin{split}
    (a + b)^3 &= (a + b)(a + b)^2 \\
              &= (a + b)(a^2 + 2ab + b^2) \\
              &= a^3 + 3a^2b + 3ab^2 + b^3
  \end{split}
\end{equation}

The multline Environment

For a single long equation that must be broken across lines. The first line is left-aligned, the last is right-aligned, and middle lines are centred.

\begin{multline}
  p(x) = x^8 + x^7 + x^6 + x^5 \\
       + x^4 + x^3 + x^2 + x + 1
\end{multline}

The gather Environment

Centres every line independently with no alignment point. Useful for listing several separate equations together.

\begin{gather}
  x + y = 4 \\
  x - y = 2
\end{gather}

Equation Numbering

Numbered equations are essential for academic papers so you can reference results later. LaTeX makes this effortless.

The equation Environment

Produces a single numbered display equation.

\begin{equation}
  E = mc^2
  \label{eq:einstein}
\end{equation}

As shown in Equation~\ref{eq:einstein}, energy and mass are equivalent.

\label and \ref

Assign a label to any numbered equation with \label{eq:name}and reference it anywhere in your document with \ref{eq:name}or \eqref{eq:name} (the latter adds parentheses automatically and requires amsmath).

From \eqref{eq:einstein} we can derive...

Custom Tags with \tag{}

Override the automatic number with a custom label.

\begin{equation}
  a^2 + b^2 = c^2 \tag{Pythagoras}
\end{equation}

Unnumbered Equations

Add a * to suppress numbering: equation*,align*, gather*, etc.

\begin{equation*}
  \sum_{k=0}^{\infty} x^k = \frac{1}{1-x}, \quad |x| < 1
\end{equation*}

Piecewise Functions with cases

The cases environment (from amsmath) is the standard way to write piecewise-defined functions. It draws a single left brace that grows with the number of cases; inside it, & separates each value from its condition and \\ starts the next case.

\[
  f(x) =
  \begin{cases}
    x^2       & \text{if } x \geq 0 \\
    -x^2      & \text{if } x < 0
  \end{cases}
\]

The condition is ordinary text, so wrap words in \text and keep the trailing space inside the braces (\text{if }), otherwise “if” runs into the variable. You can have as many cases as you need, and commas or full stops after the values are fine:

\[
  |x| =
  \begin{cases}
    x,  & \text{for } x \geq 0, \\
    -x, & \text{for } x < 0.
  \end{cases}
\]

% Sign function
\[
  \operatorname{sgn}(x) =
  \begin{cases}
    1   & \text{if } x > 0 \\
    0   & \text{if } x = 0 \\
    -1  & \text{if } x < 0
  \end{cases}
\]

% Text conditions with math inside them
\[
  f(n) =
  \begin{cases}
    n/2    & \text{if $n$ is even} \\
    3n + 1 & \text{if $n$ is odd}
  \end{cases}
  \qquad
  \chi(x) =
  \begin{cases}
    1, & x \in \mathbb{Q} \\
    0, & \text{otherwise}
  \end{cases}
\]

% Extra space before the conditions with \quad
\[
  f(x) =
  \begin{cases}
    x^2  & \quad \text{if } x \geq 0 \\
    -x^2 & \quad \text{if } x < 0
  \end{cases}
\]

% A numbered piecewise definition
\begin{equation}
  \delta_{ij} =
  \begin{cases}
    1 & i = j \\
    0 & i \neq j
  \end{cases}
  \label{eq:kronecker}
\end{equation}

Fractions in cases: dcases from mathtools

The contents of cases are set in text style, so a fraction inside it comes out small. The mathtools package provides dcases, which sets each case in display style, and cases* / dcases*, whose second column is plain text so you can drop the \text:

\usepackage{mathtools}

\[
  f(x) =
  \begin{cases}
    \frac{1}{x} & x \neq 0 \\
    0           & x = 0
  \end{cases}
  \qquad
  f(x) =
  \begin{dcases}
    \frac{1}{x} & x \neq 0 \\
    0           & x = 0
  \end{dcases}
\]

% Second column is text mode: no \text needed, math goes back in $...$
\[
  g(x) =
  \begin{dcases*}
    \frac{1}{x} & if $x \neq 0$ \\
    0           & otherwise
  \end{dcases*}
\]

% Without mathtools: \dfrac and a little extra row space
\[
  f(x) =
  \begin{cases}
    \dfrac{1}{x} & x \neq 0 \\[4pt]
    0            & x = 0
  \end{cases}
\]

Right brace: rcases

For a brace on the right-hand side, use rcases (and drcases, rcases*), also from mathtools:

\usepackage{mathtools}

\[
  \begin{rcases}
    x > 0 \\
    y > 0
  \end{rcases}
  \Rightarrow x + y > 0
\]

If you cannot load mathtools, the old-fashioned way is an array with an invisible right delimiter: \left\{ \begin{array}{ll} x^2 & x \ge 0 \\ -x^2 & x < 0 \end{array} \right.. The cases environment is cleaner and spaces the columns properly.

Matrices

LaTeX provides several matrix environments through the amsmath package. Here is a brief overview; for a deep dive see our dedicated Matrices in LaTeX guide.

Parenthesised Matrix (pmatrix)

\[
  \begin{pmatrix}
    1 & 2 \\
    3 & 4
  \end{pmatrix}
\]

Bracketed Matrix (bmatrix)

\[
  \begin{bmatrix}
    a & b \\
    c & d
  \end{bmatrix}
\]

Other variants include Bmatrix (curly braces),vmatrix (vertical bars for determinants), andVmatrix (double vertical bars for norms).

Spacing in Math Mode

LaTeX handles most mathematical spacing automatically, but sometimes you need manual adjustments. Here are the spacing commands available in math mode, from thinnest to widest:

CommandWidthDescription
\!-3/18 emNegative thin space (pulls elements closer)
\,3/18 emThin space
\:4/18 emMedium space
\;5/18 emThick space
\quad1 emQuad space
\qquad2 emDouble quad space
\[
  \int_0^1 f(x) \, dx            % thin space before dx
  \qquad
  \sqrt{2} \, x                   % thin space after root
  \qquad
  \iint\limits_D f(x,y) \, dA    % double integral
\]

The negative thin space \! is handy for tightening things like double integrals:

\[
  \int \!\!\! \int_D f \, dA
\]

Text Inside Math

Sometimes you need to include words or phrases within a mathematical expression. LaTeX provides several commands for this purpose.

\text{} (recommended)

From the amsmath package, \text renders its argument in the surrounding text font and respects the current size. This is the preferred approach.

\[
  f(x) = x^2 \quad \text{for all } x \in \mathbb{R}
\]

\mathrm{}

Produces upright (Roman) text but stays in math mode. Useful for multi-letter operator names or unit labels.

\[
  \mathrm{pH} = -\log[\mathrm{H}^+]
\]

\mbox{}

An older TeX command that puts text in an unbreakable horizontal box.\text is generally preferred in modern documents, but\mbox works without loading amsmath.

\[
  x = y \mbox{ if and only if } y = x
\]

Common Math Constructs

Here is a quick-reference table of frequently used LaTeX math commands:

CommandDescription
\frac{a}{b}Fraction a/b
\sqrt{x}Square root of x
\sqrt[n]{x}Nth root of x
x^{n}Superscript (exponent)
x_{i}Subscript
\sum_{i=1}^{n}Summation
\int_{a}^{b}Definite integral
\lim_{x \to 0}Limit
\begin{cases}Piecewise function
\inftyInfinity symbol
\partialPartial derivative symbol
\nablaNabla (gradient) operator
\cdotCentred dot (multiplication)
\timesCross product
\leq, \geqLess/greater than or equal
\neqNot equal
\approxApproximately equal
\equivIdentical / congruent
\in, \notinElement of / not element of
\subset, \supsetSubset / superset
\cup, \capUnion / intersection
\mathbb{R}Blackboard bold (e.g. real numbers)
\overline{x}Overline (mean, conjugate)
\hat{x}Hat accent (estimator)
\vec{v}Vector arrow
\dot{x}, \ddot{x}Time derivatives (Newton notation)

The amsmath Package

The amsmath package, developed by the American Mathematical Society, is the single most important package for mathematical typesetting in LaTeX. If you write any non-trivial mathematics, you should include it in every document.

\usepackage{amsmath}

Here is what amsmath provides:

  • Alignment environments – align, gather, multline, split, flalign, alignat
  • Matrix environments – pmatrix, bmatrix, vmatrix, Bmatrix, Vmatrix
  • The cases environment – for piecewise-defined functions
  • Display-style fractions – \dfrac, \tfrac, \cfrac
  • \text{} command – for inserting text inside math mode
  • \eqref{} – for referencing equations with automatic parentheses
  • \operatorname{} – for defining custom operator names (e.g. \operatorname{argmax})
  • \tag{} – for custom equation labels
  • Root positioning – \leftroot and \uproot
  • Improved spacing – better default spacing around operators and relations

You can also load the companion packages amssymb (extra symbols like\mathbb, \mathfrak), amsthm (theorem environments) and mathtools, which extends amsmath with dcases, rcases, psmallmatrix and many fixes:

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathtools}   % loads amsmath itself

Common Errors

Most math errors come from a $ that is missing, extra or in the wrong place. The message, the cause and the fix:

Message or symptomCauseFix
Missing $ insertedA math command (\frac, ^, _, \alpha) in text, or an unclosed $Wrap in $...$ or \[...\]; check every $ has a partner
Display math should end with $$A single $ inside a display opened with \[ or $$, often a stray $ pasted into an equationRemove the inner $; close \[ with \] and $$ with $$ (better: switch to \[...\])
Missing $ inserted inside equation or \[...\]A blank line inside the display ends the paragraph, and math cannot span paragraphsDelete the blank line, or put a % on it to keep the source readable
\tag not allowed here\tag inside $$...$$Use equation or \[...\]
Bad math environment delimiter\] without \[, or \[ inside $...$Match the delimiters; do not nest display math in inline math
Environment cases undefined / dcases undefinedamsmath (for cases) or mathtools (for dcases, rcases) not loadedAdd the package to the preamble
Missing \right. inserted / Extra \rightUnbalanced \left and \right, or a line break between them in alignPair them on the same line; use \right. for an invisible partner, or \bigl/\bigr
Double superscript / Double subscriptx^a^b or x_i_jGroup: x^{ab}, x_{ij}
Missing { insertedNothing valid after ^, _ or \frac; often a missing argumentSupply both arguments of \frac, brace the script
Extra alignment tab has been changed to \crToo many & in a cases or split row, any & in gather, or more columns than a matrix or array declaresOne & per row in cases and split; use align or alignat for several alignment columns
Misplaced alignment tab character && outside align/cases/matrix, e.g. in equationSwitch to align or split, or write \& for a literal ampersand
Package amsmath Error: \begin{split} won't work heresplit used outside a display environmentPut it inside equation or align
Undefined control sequence \text / \dfrac / \eqrefamsmath not loaded\usepackage{amsmath}
Words in math come out as italic letters run togetherPlain text typed inside $...$Wrap it in \text{...}
Extra space above a displayBlank line before \[Remove the blank line; a display continues the paragraph

Frequently Asked Questions

How do you write inline math in LaTeX?

Put the formula between single dollar signs, $a^2 + b^2 = c^2$, or between \( and \), as in \(a^2 + b^2 = c^2\). Both keep the math in line with the text at text size. No package is needed.

What is the difference between $...$ and \[...\]?

$...$ is inline math: the formula sits inside the sentence at a compact size. \[...\] is display math: the formula is centred on its own line at full size. Use equation instead of \[...\] when the display needs a number.

Should I use $$...$$ in LaTeX?

No. $$...$$ is plain TeX syntax. In LaTeX it ignores the fleqn class option and is not understood by amsmath, so \tag does not work inside it. Use \[...\] for an unnumbered display and equation for a numbered one.

What is the difference between equation and equation*?

equation prints a number next to the display and accepts a \label for \ref and \eqref. equation* (from amsmath) is the same display without a number, equivalent to \[...\]. Both hold a single line; use align for several lines.

How do I write text inside a LaTeX equation?

Load amsmath and wrap the words in \text{...}, as in $f(x) = 0 \text{ for all } x$. Put spaces inside the braces, because spaces in math mode are ignored. Without \text the letters are set as italic variables run together.

What does “Missing $ inserted” mean?

LaTeX met a math-only command or character (such as ^, _, \frac or \alpha) outside math mode, an opening $ was never closed, or a display contains a blank line. Wrap the expression in $...$ or \[...\], check that every $ has a partner, and remove blank lines inside displays.

Next Steps

Now that you've mastered the foundations of mathematical expressions, explore these related topics:

Free LaTeX Tools

Ready to start writing?

Try Octree – the AI-powered LaTeX editor that makes writing faster and easier.

Try Octree Free →