> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/latex/latex-errors/14-latex-error-environment-xxx-undefined.md).

# LaTeX Error: Environment XXX undefined

If you try to use an environment which LaTeX does not recognize, you will generate an error message like the one below:

main.tex, line 5

LaTeX Error: Environment equation\* undefined.

See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ... l.5 \begin{equation\*} Your command was ignored. Type I to replace it with another command, or to continue without it.

## Common Causes

**You have forgotten to load a package**

A common cause of this error is when you are trying to use an environment which is part of a specific package, but you have forgotten to load the package in your preamble. An example of this is the **`align`** environment. The **`align`** environment comes as part of the **`amsmath`** package. Therefore, whenever you use the **`align`** environment, you must include **`\usepackage{amsmath}`** in your preamble as shown below:

```latex
% In your preamble

\usepackage{amsmath}

% In your main .tex file

\begin{align}
2x + 3y &= 7\\
5x - 2y &= 2
\end{align}
```

![Align.PNG](/files/opZrC9Rq0estvCgHejQQ)

If you do not include **`\usepackage{amsmath}`** in your preamble, you will generate an error message.

**You have spelled the environment incorrectly:**

Another common example of this error is when an environment is spelled correctly. An example of this mistake is shown below:

```latex
\begin{lisQ}
    \item This is a list item
    \item This is another list item
\end{lisQ}
```

An error will appear here, as the **`list`** environment was mistakenly written as **`lisQ`**. To fix this, simply check your spelling whenever calling a particular environment.

**Environment does not exist**

One other way in which this error can appear is if you attempt to use an environment which does not exist. To learn more about the allowed environments in LaTeX, as well as how to create your own, check out our [documentation](/latex/commands/02-environments.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/latex/latex-errors/14-latex-error-environment-xxx-undefined.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
