LaTeX Error: Environment <name> undefined
\begin{…} names an environment no loaded package defines: load the package (amsmath for align), fix the spelling, or define it with \newtheorem.
Help centre › LaTeX errors › Commands and packages · Error: the build stops or the output is wrong
What the log says
! LaTeX Error: Environment align undefined.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.5 \begin{align}What it means
LaTeX met \begin{name} and has no definition for an environment of that name. Either the package that provides it is not loaded, the name is misspelled, or the environment is one you are expected to define yourself (theorem-like environments). LaTeX usually continues, but the contents are typeset wrongly and more errors follow, so fix this one first.
Causes and fixes
Most common first. Each example is a complete document; the first fails with this message, the second is the same document fixed.
1. The package that defines the environment is not loaded
Many common environments are not part of LaTeX itself: align, gather, multline, cases, bmatrix and pmatrix come from amsmath; proof from amsthm; tabularx from tabularx; longtable from longtable; multicols from multicol; algorithm from algorithm; algorithmic from algpseudocode; subfigure and subtable from subcaption; tikzpicture from tikz. Add the \usepackage line to the preamble.
\documentclass{article}
\begin{document}
The model is
\begin{align}
y &= ax + b
\end{align}
\end{document}\documentclass{article}
\usepackage{amsmath}
\begin{document}
The model is
\begin{align}
y &= ax + b
\end{align}
\end{document}2. A theorem-like environment was never declared
theorem, lemma, definition and corollary do not exist until you declare them with \newtheorem in the preamble (some journal classes declare them for you; the standard classes do not).
\documentclass{article}
\begin{document}
\begin{theorem}
Every bounded monotone sequence converges.
\end{theorem}
\end{document}\documentclass{article}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem}
Every bounded monotone sequence converges.
\end{theorem}
\end{document}3. The environment name is misspelled
Look at the name in the message: itemise for itemize, equation* without amsmath, figures for figure, Table for table (names are case sensitive). Correct both the \begin and the \end.
\documentclass{article}
\begin{document}
\begin{itemise}
\item First point
\end{itemise}
\end{document}\documentclass{article}
\begin{document}
\begin{itemize}
\item First point
\end{itemize}
\end{document}4. The environment belongs to another document class
Text moved between templates brings environments with it: abstract exists in article and report but not in book; IEEEkeywords only in the IEEE class; keywords and highlights only in some journal classes. Use what the current class provides, or define a small replacement with \newenvironment.
In Manulyx
The editor shows the error beside the \begin line, and for the common environments it names the package to load and the exact \usepackage line to add.
Write in Manulyx for free · Journal templates
More in commands and packages
- Undefined control sequence.LaTeX met a command it does not know: usually a typo, or a command whose package is not loaded. The log's l. line ends with the culprit.
- Missing number, treated as zero.A command that needs a number or length (\vspace, \setcounter, a width) got a word or nothing. Give it a value such as 1em or 3.
- LaTeX Error: Command \<name> already defined.\newcommand or a package tried to define a name that already exists. Pick another name, use \renewcommand, or drop the clashing package.
- Illegal parameter number in definition of \<name>.A # in a definition does not refer to a declared argument: #1 without [1], #1 in an environment's end code, or a # in a URL. Fix the count or escape it.
- Use of \<name> doesn't match its definition.A command with a special argument syntax, such as \put(x,y) or a \def with delimiters, was called without that syntax. Follow its exact form.
- LaTeX Error: Option clash for package <name>A package is loaded twice with different options, often because the class or another package loaded it first. Load it once, with all options.
Every example on this page was compiled with pdfLaTeX to check that it fails and is fixed as described. All LaTeX errors