FormaTeX
FatalCommands & Packages

Environment align Undefined (Missing amsmath)

! LaTeX Error: Environment align undefined.

What this error means

The align environment (and related environments like gather, multline, align*) are provided by the amsmath package. Without loading it, LaTeX has no definition for these environments.

FormaTeX smart compile

FormaTeX smart compile automatically detects align, gather, multline, and other AMS environments and injects \usepackage{amsmath} into the preamble before compiling.

Common causes

  • \usepackage{amsmath} missing from the preamble
  • Using align, gather, multline, alignat, flalign, or aligned without amsmath
  • The preamble was accidentally edited and the amsmath line removed

How to fix it

Add \usepackage{amsmath} to your preamble. If you use any AMS math environments or commands (\text{}, \intertext{}, \tfrac{}, etc.), amsmath is required.

Code examples

Causes the error
\documentclass{article}
% Missing \usepackage{amsmath}
\begin{document}

\begin{align}
  a &= b + c \\
  d &= e - f
\end{align}

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

\begin{align}
  a &= b + c \\
  d &= e - f
\end{align}

\end{document}

Related errors

Test the fix live

Paste your LaTeX into the playground and compile instantly.

One quick thing

We track anonymous usage — page views, feature usage, compilation events — to understand what works and what doesn't. No ads, no personal data, no third-party sharing.

Cookie policy