I have the following:
\documentclass[10pt, a4paper]{article}
\usepackage{nicematrix}
\pgfkeys{
/tikz/gaussenv/.cd,
% column number
col/.initial=1,
colC/.initial=4,
}
\newenvironment{gaussMatrix}[1][]%
{
\pgfkeys{/tikz/gaussenv/.cd, #1}
\pgfkeys{/tikz/gaussenv/colC=\pgfmathparse{int(\pgfkeysvalueof{/tikz/gaussenv/col}-1)}\pgfmathresult}
%\pgfkeysvalueof{/tikz/gaussenv/colC}
\begin{pNiceArray}[name=mymatrix]{*{\pgfkeysvalueof{/tikz/gaussenv/colC}}{C}|C}
}%
{
\end{pNiceArray}
}
\begin{document}
\begin{align*}
\begin{gaussMatrix}[col=5,colC=4] %number of colums in total, number of columns left of the line
1 & 1 & 1 & 1 & 1 \\
2 & 2 & 2 & 2 & 2 \\
3 & 3 & 3 & 3 & 3 \\
4 & 4 & 4 & 4 & 4 \\
5 & 5 & 5 & 5 & 5 \\
\end{gaussMatrix}
\\
\end{align*}
\end{document}
But somehow nicematrix doesn't like the output of pgfkeys. Without the calculation somehow it works, but I'd like to remove it that the total number of columns -1 has to be specified (even though this is easy to calculate).
Does someone know why this does not work and maybe a way to fix it?

- Would you be so kind and explain why
- Thanks for helping me with the creation of that environment, if you're interested in looking with what I came up now, see https://gitlab.com/AtticusSullivan/gaussenv ;)
– atticus Jun 06 '20 at 17:36\pgfmathparsedidn't work?\pgfmathparse{int(\pgfkeysvalueof{/tikz/gaussenv/col}-1)}\pgfmathresultcan be used to typeset the number, but it is not a macro that expands to that number. (pgf keys are somewhat forgiving in this regard but not to this extent.) You may be interested in this related discussion. And thanks for the link! – Jun 06 '20 at 17:41