Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you align a system of equations?

Tags:

latex

mathjax

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.

like image 597
user875234 Avatar asked Jan 13 '18 14:01

user875234


People also ask

How do we align an equation?

Inside the equation environment, use the split environment to split the equations into smaller pieces, these smaller pieces will be aligned accordingly. The double backslash works as a newline character. Use the ampersand character & , to set the points where the equations are vertically aligned.

What are the 3 ways to solve systems of equations?

There are three ways to solve systems of linear equations in two variables: graphing. substitution method. elimination method.


1 Answers

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}
like image 101
Andrew Swann Avatar answered Sep 19 '22 10:09

Andrew Swann