×
点此以英语 使用 ShareLaTeX

[edit] ShareLaTeX guides

[edit] LaTeX Basics

[edit] Mathematics

[edit] Figures and tables

[edit] References and Citations

[edit] Languages

[edit] Document structure

[edit] Formatting

[edit] Fonts

[edit] Presentations

[edit] Commands

[edit] Field specific

[edit] Class files

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.

[edit] 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

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

$$
\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.

% 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