# Aligning system of equations with zero coefficients

How to type a system of equations of the following form aligning the same variables when they do have zero coefficients.

I looked at few posts including this but wasn't successful. Appreciate any help in getting this done. Thank you.

\documentclass{article}
\usepackage{systeme}

\begin{document}
\sysdelim..\systeme{x_2      +2x_3          +2x_4         -2x_5    =1,
x_1                +3x_3                   +4x_5    =5,
-x_1         +3x_2       +3x_3                   -10x_5    =4}
\end{document}


• Thank you @marmot. Can you tell me how to get rid of the curly braces to the left. – Eureka Jun 1 at 2:43
• @Hagridd Brackets removed. – marmot Jun 1 at 2:45

For the sake of variety, here's an implementation that uses Mico's answer from the post you originally linked only using array. Admittedly, it's not quite as elegant as the solution marmot provided. However, its output is exactly the same as what's produced by \systeme. Observe that both answers produce output that's more tightly spaced than what's shown in the screenshot you posted. The array-based solution is also somewhat more general than what's produced by \systeme, in the sense that it can handle fairly arbitrary variable names.

\documentclass{article}
\usepackage{array} % for "\newcolumntype" macro
\newcolumntype{C}{ >{{}}c<{{}} }

\usepackage{systeme}
\sysdelim..

\begin{document}
$\setlength\arraycolsep{0pt} \renewcommand{\arraystretch}{1.21} % optional \begin{array}{r *{5}{Cr}} & & x_2 &+& 2x_3 &+& 2x_4 &-& 2x_5 &=& 1 \\ x_1 & & &+& 3x_3 & & &+& 4x_5 &=& 5 \\ -x_1 &+& 3x_2 &+& 3x_3 & & &-& 10x_5 &=& 4 \end{array}$

%% for comparison, @marmot's answer which uses "\systeme"
$\systeme{ x_2 +2x_3 +2x_4 -2x_5 =1, x_1 +3x_3 +4x_5 =5, -x_1 +3x_2 +3x_3 -10x_5 =4}$
\end{document}

• +1 for the variety. – marmot Jun 1 at 4:12
• +1 for the variety. ;-) – Mico Jun 1 at 4:36