How do you align a system of equations?

Simply adding & before each line results in the desired output.

\begin{align*}
  &x+y+z=1 \\ 
  &x+y+z=\frac{5}{2} \\ 
  &x+y+z=5
\end{align*}

There is a package systeme for systems of linear equations with automatic alignment of the variables and values - it even detects the variables for you.

In the standard set-up use you would just write

\begin{equation*}
  \systeme{
  x+y+z = 1,
  x+y+z = \frac{5}{2},
  x+y+z = 5
  }
\end{equation*}

Sample output

or

\begin{equation*}
  \systeme{
  3x +7z = 20,
  y - 17z = -3,
  24x + 15y = 7
  }
\end{equation*}

Second general example

which may or may not suit your taste. The bracket can removed by specifying empty delimiters by preceding the \systeme command with

\sysdelim..

(. is an empty place holder, \sysdelim needs two as it specifies a left and a right delimiter). To make the fraction bigger you can use \dfrac from the amsmath package (which you are already loading), but then you have to help with the line spacing:

Second sample

\documentclass{article}

\usepackage{amsmath,systeme}

\begin{document}

\begin{equation*}
  \systeme{
  x+y+z = 1,
  x+y+z = \frac{5}{2},
  x+y+z = 5
  }
\end{equation*}

No delimeter, displaystyle fraction and line spacing
\begin{equation*}
  \sysdelim..\systeme{
  x+y+z = 1,
  x+y+z = \dfrac{5}{2}\rule[-3ex]{0pt}{7ex},
  x+y+z = 5
  }
\end{equation*}

\end{document}

Alternatively extra spacing can be added between all lines via the command \syslineskipcoeff which is a scaling factor:

Third sample

\documentclass{article}

\usepackage{amsmath,systeme}

\begin{document}

No delimeter, displaystyle fraction and line spacing
\begin{equation*}
  \sysdelim..\syslineskipcoeff{2}\systeme{
  x+y+z = 1,
  x+y+z = \dfrac{5}{2},
  x+y+z = 5
  }
\end{equation*}

\end{document}

Use &= to signify to align with the equals:

\begin{align*}
  x+y+z &= \,1 \\ 
  x+y+z &= \frac{5}{2} \\ 
  x+y+z &= \,5
\end{align*}

aligned and spaced over a tiny bit

You can use these in math mode:

\; - a thick space
\: - a medium space
\, - a thin space     <-- used this here in front of the simple numbers
\! - a negative thin space

Source: http://www.emerson.emory.edu/services/latex/latex_119.html

You can reread about align* environment f.e. here: https://en.wikibooks.org/wiki/LaTeX/Advanced_Mathematics#align_and_align*

Tags:

Latex

Mathjax