# Space in array system equations

I need to make some system equations but when I place them on one row I have this problem. Space between | and x. How to remove it?

\begin{document}
Example 1:
\\
$\left| \begin{array}{@{}*{4}{c@{\,}}l} 2x+3y-\cancel{z}=4 \\ 3x+2y+2=6 \end{array}\right.$
\textrightarrow
$\; 5x+5y=10$ \textrightarrow
$\; x+y=2;$
$\;$ % Space
$\left| \begin{array}{@{}*{4}{c@{\,}}l} x-y+2z=2 \\ 3x+2y-z=4 | .2 \end{array}\right.$
\textrightarrow
\end{document}


It is quite simple to type it with the systeme package:

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

\begin{document}

$\sysdelim | . \systeme{2x + 3y-\cancel z = 4,3x + 2y + z = 6} \longrightarrow 5x + 5y = 10 \longrightarrow x + y = 20 \longrightarrow \systeme{x-y + 2z = 2, 3x + 2y - z = 4|. 2}$%

\end{document}


Rather than eliminating the space, I propose working instead to align columns in the systems of equations. Also, by making it one big math expression, the spacing also takes on a more natural appearance.

\documentclass{article}
\usepackage{array,amsmath,cancel,tabstackengine}
\setstacktabulargap{0pt}
\TABstackMath
\begin{document}
\noindent Example 1:
\\
$\left| \tabularCenterstack{rrrl}{ 2x+&3y-&\cancel{z}=&4 \\ 3x+&2y+&\cancel{z}=&6 }\right. \rightarrow 5x+5y=10 \rightarrow x+y=2; \left| \tabularCenterstack{rrrl}{ x-&y+&2z=&2 \\ 3x+&2y-&z=&4 | .2 }\right. \rightarrow$
\end{document}


You can better exploit array:

\documentclass{article}
\usepackage{amsmath,array,cancel}

\newenvironment{system}[1]
{%
\left|\setlength{\arraycolsep}{0pt}
\begin{array}{ @{} *{\numexpr2*#1\relax}{ >{{}} r <{{}} } l @{} }%
}
{\end{array}\right.}

\begin{document}

$\begin{system}{3} 2x &+& 3y &-& \cancel{z} &=& 4 \\ 3x &+& 2y &+& \cancel{z} &=& 6 \end{system} \rightarrow 5x+5y=10 \rightarrow x+y=2 \rightarrow \begin{system}{3} x &-& y &+& 2z &=& 2 \\ 3x &+& 2y &-& z &=&4 \mid .2 \end{system}$

\end{document}


This way the unknowns are perfectly aligned to each other. The argument to system specifies the number of unknowns.

I suggest you load the mathtools package and use its matrix* environment instead of the second array, along with three well-placed \phantom instructions. I would also replace .2 with \cdot2.

\documentclass{article}
\usepackage{cancel,mathtools}

\begin{document}
\noindent
Example 1:
\begin{align*}
\renewcommand\arraystretch{1.333}
&\left\vert\begin{matrix}
2x+3y-\cancel{z}=4 \\
3x+2y+\cancel{z}=6
\end{matrix}\right.
\wideto
5x+5y=10
\wideto
x+y=2
; \\
&\left\vert\begin{matrix*}[l]
\phantom{3}x-\phantom{2}y+2z=2 \\
3x+2y-\phantom{2}z=4 \;| \cdot2, {}+{}
\end{matrix*}\right.
\wideto
7x+3y=10
\wideto
x+\tfrac{3}{7}y=\tfrac{10}{7};
\end{align*}
\end{document}