# Why does & fail to align things properly, here?

\begin{align*}
f(x)  &= a x^2+b x +c   &   g(x)  &= d x^3 \\
f'(x) &= 2 a x +b       &   g'(x) &= 3 d x^2
\end{align*}


gives

the four equal signs are aligned

But

\begin{align*}
f(x)  &= a x^2+b x +c    g(x)  &= d x^3 \\
f'(x) &= 2 a x +b         g'(x) &= 3 d x^2
\end{align*}


gives

according to Wikibooks

& is used to indicate the point at which the lines should be aligned.

why the two equal signs on the right are not aligned?

• This is another place where the Wikibooks are wrong: & denotes “go to the next alignment cell”. Apr 15 '15 at 7:13

In align the first & provides the right/left alignment point for the first question. The next & can be thought of as either separating the subsequent equation, or you can think of the fact that each & provides a right/left alignment pair.

 f(x)  &= a x^2+b x +c    g(x)  &= d x^3


The first & ensures that the f(x) is right aligned and the a x^2... is left aligned and the g(x) is now _part of the quadratic expression. The second & now species a right alignment point (not left as desired) for the subsequent text d x^3. Putting an additional & skips past the right alignment point so that the next & will yield a left alignment as desired.

So the correct way to get the desired alignment is as follows:

## Code:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{align*}
f(x)  &= a x^2+b x +c   & g(x)  &= d x^3 \\
f'(x) &= 2 a x +b       &  g'(x) &= 3 d x^2
\end{align*}
\end{document}

• I don't understand. I think "&=" should align "=" Apr 15 '15 at 5:25
• @user15964: The & does not align a portion of the text, but rather aligns the text following to either right or left. As I tried to explain it right aligns the text the way you have it. Thus the d x^3 and 3 d x^2 are right aligned. Apr 15 '15 at 5:28