Search code examples
latexmathjax

How do you align a system of equations?


I want these equations to line up so that all variables and operators go straight down. I've tried a few different techniques but haven't been able to get it to work.

enter image description here

Nope:

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

fiddle.


Solution

  • 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*