TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Consider this expression:

enter image description here

How can I code this in LaTeX such that everything is aligned at the "=" sign such that the distance to the left and the right of the "=" sign at each line is the same as the distance to the other "=" which aren't in some separate column to which everything has to align to.

(Using for example eqnarray doesn't help, since in this case I can align everything at "=", but the distance to the left and the right is way off.)

share|improve this question
up vote 10 down vote accepted

You are perfectly correct in saying that eqnarray is not the right tool here. The amsmath package provides several environments for displayed equations with correct spacing. (Extra features are available from the mathtools package.) In your example align* is the relevant construct to use (remove the * if you want equation numbers):

Sample output




  x_1+x_2 &= (-p + i \sqrt{q-p^2}) + (-p - i \sqrt{q-p^2}) = - 2p,\\
  x_1\cdot x_2 &= (-p + i \sqrt{q-p^2}) \cdot (-p - i \sqrt{q-p^2})
  = (-p)^2 - (i \sqrt{q-p^2})^2 \\
  &= q.


Alignment points are specified by &, newlines by \\.

share|improve this answer
perfect! thanks. – user10324 Jun 21 '14 at 10:12
"eqnarray is no the right tool here" ... It's never the right tool. :) – Svend Tveskæg Jun 22 '14 at 11:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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