I need to typeset column vectors containing two parameters (variables) and an absolute value. All coefficients can be either integer or decimal numbers. I would like to achieve that all components are nicely aligned (numbers at decimal point if any, variables and operators).
The MWE
\documentclass{article}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{siunitx}
\begin{document}
\section{Not aligned}
\subsection{Integer coefficients}
\begin{math}
\begin{pmatrix}
2 - 2 \, s + t \\
28 - 3 \, t \\
-14 - 3 \, s + 4 \, t
\end{pmatrix}
\end{math}
\subsection{Decimal coefficients}
\begin{math}
\begin{pmatrix}
2 - \num{2,3} \, s + t \\
28 - \num{3,1} \, t \\
\num{-14,75} - 3 \, s + 4 \, t
\end{pmatrix}
\end{math}
\section{Manually aligned}
\subsection{Integer coefficients}
\begin{math}
\left(
\begin{array}{rcrcr}
2 & - & 2 \, s & + & t \\
28 & & & - & 3 \, t \\
-14 & - & 3 \, s & + & 4 \, t
\end{array}
\right)
\end{math}
\subsection{Decimal coefficients}
\begin{math}
\left(
\begin{array}{rcrcr}
2 & - & \num{2,3} \, s & + & t \\
28 & & & - & \num{3,1} \, t \\
\num{-14,75} & - & 3 \, s & + & 4 \, t
\end{array}
\right)
\end{math}
\end{document}
produces the following result.
In both examples in section 2, the spacing before and after the operator is far too much. In section 2.2, the numbers are not aligned at their decimal points.
(1) How can I fix these issues?
(2) Is there any package that does the job automatically without the need to manually place &
characters?
\setlength\arraycolsep{<desired distance>}
, for example\setlength\arraycolsep{1 pt}
.