LaTeX error · Environments, lists and tables
LaTeX Error: Environment align undefined.
Quick answer
LaTeX found \begin{align} (or another name) but no package has defined an environment with that name. Either the package that provides it is not loaded (amsmath for align, tikz for tikzpicture, listings for lstlisting) or the name is misspelled. Add the right \usepackage to the preamble or correct the spelling, and the error goes away.
The error in the log
This is how the message appears in the .log file (and in the compile output). The line starting with l. is the line number where TeX noticed the problem; the real mistake is there or just before it.
! LaTeX Error: Environment align undefined.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.3 \begin{align}Why it happens
- The package that defines the environment is not loaded:
align,gather,multlineandalign*needamsmath;tikzpictureneedstikz;lstlistingneedslistings;subfigureneedssubcaption. - A typo in the name, such as
\begin{itemise},\begin{equation*}without amsmath, or\begin{figur}. - The environment is defined by a document class you are not using, for example
frameoutside Beamer orabstractin a class that has none. - A custom environment is used before its
\newenvironmentdefinition, or the definition sits in a file that is not\input.
How to fix it
Read the name in the message, then find out where it comes from. The usual suspects are amsmath (align, gather, multline, the starred math environments, pmatrix and bmatrix), tikz, listings, subcaption, algorithm and algorithmic.
Load that package in the preamble, before \begin{document}. If the name is your own, make sure \newenvironment comes before the first use.
Broken: reproduces the error
\documentclass{article}
\begin{document}
\begin{align}
a &= b + c
\end{align}
\end{document}Try this in Octree — free LaTeX editor with AI, compiles in your browser
Fixed: compiles cleanly
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
a &= b + c
\end{align}
\end{document}Related errors
- Undefined control sequence – A command LaTeX does not know: misspelled, or its package is not loaded.
- File not found – A package or class named in
\usepackageor\documentclassis misspelled or not installed. - \begin{x} ended by \end{y} – An
\enddoes not match the most recent open\begin: a typo or an environment left open. - All LaTeX errors and warnings – The full list, grouped by cause
Frequently Asked Questions
Which package do I need for the align environment?
amsmath. Add \usepackage{amsmath} to the preamble. It also provides align*, gather, multline, split, cases and the matrix environments.
Why is equation* undefined when equation works?
Plain LaTeX defines equation but not the starred version. equation* comes from amsmath, so loading amsmath fixes it. Without amsmath you can use \[ ... \] for an unnumbered display.
How do I fix "Environment tikzpicture undefined"?
Load TikZ with \usepackage{tikz}. If you already do, check that the line is not commented out and that it comes before \begin{document}.
Can an undefined environment be a spelling mistake?
Yes. LaTeX matches names exactly and is case-sensitive, so \begin{Itemize} or \begin{enumarate} give the same error. Compare the name in the message with the documentation.
Paste your document into Octree — compile errors get a Fix with AI button
When a compile fails, Octree shows the error next to the line that caused it and offers a one-click fix that you can review before applying. Free, nothing to install.
Fix it in Octree →