# [Tex/LaTex] Alignment in math equations

alignequations

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

\begin{equation}
\begin{split}
x_1'(t) &= x_1(t)+2 x_2(t) \\
x_2'(t) &= 3 x_1(t)
\end{split}
\end{equation}


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

You can use

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{alignat*}{3}
x_{1}'(t) &=  &x_{1}(t) &{}+{}& 2&x_{2}(t)\\
x_{2}'(t) &= 3&x_{1}(t) &     &  &
\end{alignat*}

\end{document} 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 +.

Update

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

\begin{alignat*}{2}
x_{1}'(t) &={}&  &x_{1}(t) + 2x_{2}(t)\\
x_{2}'(t) &={}& 3&x_{1}(t)
\end{alignat*}