1

This question already has an answer here:

I am using the amsmath package in latex to align three equations.

\begin{align*} 
&x_{1} - 3x_{2} + 4x_{3} = -4 \\
3&x_{1} - 7x_{2} + 7x_{3} = -8 \\
-4&x_{1} + 6x_{2} - x_{3} = 7  \\
\end{align*}

enter image description here

how do i get the output shown above to align each of the numbers in columns. I need all of the operands in the same spot and in my output the equal sign is way off.

thanks

marked as duplicate by Werner math-mode Feb 3 '16 at 22:44

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

The systeme package does this in a very pretty way:

\documentclass{article}
\usepackage{amsmath}
\usepackage{systeme}

\begin{document}

\[
\systeme{
   x_{1} - 3x_{2} + 4x_{3} = -4,
  3x_{1} - 7x_{2} + 7x_{3} = -8,
 -4x_{1} + 6x_{2} -  x_{3} = 7
}
\]

\end{document}

enter image description here

If you search on the site for systeme, you'll find several other examples.

For instance, in order to have the constant terms flush right, you can look at Is it possible to flushright the right-hand side with systeme without \hphantom?

\documentclass{article}
\usepackage{amsmath}
\usepackage{systeme}
\usepackage{regexpatch}

\makeatletter
\xpatchcmd{\SYS@makesyspreamble@i}
  {$##$\hfil\null}% left alignment
  {\hfil$##$\null}% right alignment
  {}{}
\makeatother

\begin{document}

\[
\systeme{
   x_{1} - 3x_{2} + 4x_{3} = -4,
  3x_{1} - 7x_{2} + 7x_{3} = -8,
 -4x_{1} + 6x_{2} -  x_{3} = 7
}
\]

\end{document}

enter image description here

  • thanks for the help but the 7 needs to be lined up with the other items in the column that have a negative sign. how could i do this? – user3095790 Feb 3 '16 at 22:37
  • @user3095790: Use \phantom{-}7. – Werner Feb 3 '16 at 22:42
  • @user3095790 As I said, looking for systeme in the site gives an answer. – egreg Feb 3 '16 at 22:43
  • is there any way to display it without the brackets in front of the equations? – user3095790 Feb 3 '16 at 22:47
  • @user3095790 If you never want the brace, add \sysdelim{.}{.} in the preamble; or you can do it locally by placing the same command between \[ (or \begin{equation}) and \systeme; in this case it will hold only for the next system. – egreg Feb 3 '16 at 22:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.