[Tex/LaTex] Alignment in math equations


How can I align my equations as in the image below?

enter image description here

I know

        x_1'(t) &= x_1(t)+2 x_2(t) \\
        x_2'(t) &= 3 x_1(t)

but it will only align the equal signs and not the variables.

Best Answer

You can use




  x_{1}'(t) &=  &x_{1}(t) &{}+{}& 2&x_{2}(t)\\
  x_{2}'(t) &= 3&x_{1}(t) &     &  &



Notice that I have added three alignment points in case you need to vertically align the second factor on the right-hand side too.

I hope it's clear how to extend this to more than three alignment points. (Fore n alignment points, 2n-1 &s are needed.)

P.S. Remember the use of {} to get the correct spacing around the +.


In case you don't need more than two alignment points, you can use the following:

  x_{1}'(t) &={}&  &x_{1}(t) + 2x_{2}(t)\\
  x_{2}'(t) &={}& 3&x_{1}(t)
Related Question