I am trying to write a few systems of equations, and I want the terms to be nicely spaced as below
2x + y + 3z = 10 \\
x + y + z = 6 \\
x + 3y + 2z = 13
Now, using some very ugly code, I was able to produce the results above.
\documentclass[10pt,a4paper]{article}
\usepackage{mathtools}
\usepackage{amsmath}
\begin{document}
\begin{align*}
\begin{bmatrix}
\begin{tabular}{r c r c r c r }
$2x$ & $+$ & $ y$ & $+$ & $3z$ & $=$ & $10$ \\
$ x$ & $+$ & $ y$ & $+$ & $ z$ & $=$ & $ 6$ \\
$ x$ & $+$ & $3y$ & $+$ & $2z$ & $=$ & $13$
\end{tabular}
\end{bmatrix}
\end{align*}
\section{Another system of equations, now without the brackets}
\begin{table}[!htpb]
\centering
\begin{tabular}{r c r c r c r }
$2x$ & $+$ & $ y$ & $+$ & $3z$ & $=$ & $10$ \\
$ x$ & $+$ & $ y$ & $+$ & $ z$ & $=$ & $ 6$ \\
$ x$ & $+$ & $3y$ & $+$ & $2z$ & $=$ & $13$
\end{tabular}
\end{table}
\end{document}
I would very much want a more automatic way to do this, and a simple method for controlling the spacing between elements. I have looked at earlier posts like
Multicol layout for systems of (linear) equations
It seems that I am looking for a simple version of this one. I have no need to use side-by-side equations, nor have numbers in front of them.
Using ideas from the post above, I guess the result is done by redefining commands such as - and + inside of the table? I tried to do something like this, but the code looked rather complex =(
To sum it up: Is there a way to define a simple System of Equations enviroment, with proper alignment and a optional command for defining the spacing?









{}at the beginning of each operator unnecessary, since left-aligned columns implicitly begin with a{}? – LSpice Jan 15 '23 at 19:08{}and then compare with a regular equationx+3y+2z=13. With all the{}, the spacing looks the same. Without it, it's very tight. – Stefan Kottwitz Jan 15 '23 at 20:20{}s does not work. In my comment, I should have been more explicit that I meant only the{}before, not after. Having just run it, I think that, inside\begin{alignat*}4…\end{alignat*},x &+{}& 3y &+{}& 2z &={}& 13andx &{}+{}& 3y &{}+{}& 2z &{}={}& 13space identically (and, as you say, differently fromx &+& 3y &+& 2z &=& 13). – LSpice Jan 15 '23 at 20:28+{}is sufficient. Then in case of right aligned columns, not any more.{}+{}may be a bit safer in general and looks symmetric. :-) In any case, thank you for your observation! – Stefan Kottwitz Jan 15 '23 at 21:21