2
\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

enter image description here

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

enter image description here

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?

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

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.

In your particular example

 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:

enter image description here

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}
2
  • I don't understand. I think "&=" should align "="
    – user15964
    Apr 15 '15 at 5:25
  • 2
    @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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.