# aligning equations in latex problem [duplicate]

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*} 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 StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); 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.

## 1 Answer

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