> 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/23-misplaced-alignment-tab-character.md).

# Misplaced alignment tab character &

This error appears when the alignment character '&' is used incorrectly. The alignment character *&* is used to align elements in specific environments, such as *matrix*, *align*, *table* etc.

## Common Causes of Error

**Not writing \\&:**

When you want to use an ampersand *&* as a text character in your writing, such as in a title, you must write it as `\&`. If you fail to do this, you will get an error as shown below

```latex
The company is named `Michael & Sons'
```

main.tex, line 5

Misplaced alignment tab character &.

l.5 The company is named \`Michael & Sons' I can't figure out why you would want to use a tab mark here. If you just want an ampersand, the remedy is simple: Just type \`I\\&' now. But if some right brace up above has ended a previous alignment prematurely, you're probably due for more error messages, and you might try typing \`S' now just to see what is salvageable. \[1

To correct this error, change `&` to `\&`.

**Matrix macro used instead of amsmath:matrix:**

In the basic LaTeX distribution, there is a macro called *matrix*. This is often used incorrectly when what you really want to use is the *environment* matrix supplied by the *amsmath* package. If you forget to load the amsmath package and simply write

```latex
$$
\begin{matrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{matrix}
$$
```

then a *misplaced alignment tab* error message will appear. This is because this is not the correct way to use the *matrix* macro supplied by the LaTeX distribution. In order to resolve this problem, simply load the *amsmath* package.

```latex
% In your preamble (before \begin{document})
\usepackage{amsmath}

% In your document

$$
\begin{matrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{matrix}
$$
```

![Amsmathmacro.PNG](/files/Zx7n8YozixoVJUZoP1AN)


---

# 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/23-misplaced-alignment-tab-character.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.
