I'm trying to achieve that, in the text (here inside the nicematrix env) I can add elements to a pgf key (maybe something like an array or simple extending a string) and later on I'd like to iterate over these.
What I've got so far (not working :/ )
\documentclass[10pt, a4paper]{article}
\usepackage{nicematrix}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\pgfkeys{/try1/.code={\def\addArray{#1}}}
\begin{align*}
\begin{bNiceMatrix}[name=mymatrix]
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9 \\
\end{bNiceMatrix}
\end{align*}
\begin{tikzpicture}[remember picture,overlay]
\pgfkeys{/try1={1-3/2-3/2}}
\draw (0,0) node {\try1};
\foreach \x/\y/\z in {\try1}
\draw (mymatrix-\x) ++(.75em,0) -- ++(.75em,0) node [anchor=west]{\tiny \z} |- ($ (mymatrix-\y) + (0.75em,0) $);
\end{tikzpicture}
\end{document}
I already tried to set the value directly via /try1/.initial={...}
and adding via /try1/.add={...}{}
but nothing worked so far.
I definitely need help, since I'm not too familiar with pgfkeys and nothing I found while searching worked.
Any suggestions?
EDIT: For @schroedingers cat question: The goal is something like this (but with a new environment):
\begin{bNiceMatrix}[name=mymatrix]
1 & 2 & 3 \\
4 & 5 & 6 \\ \add[2]{1}
7 & 8 & 9 \\
\end{bNiceMatrix}
It should be something to write gaussian eliminations. My idea was that I'd collect all add/swap/mult commands by converting them to tikz commands and execute them in the end after closing the bNiceMatrix
environment.
The reason, why I want to collect them rather than just specify all conversions in one command, is that this way I can access an internal counter/macro of nicematrix to get the current row number (at least I should be able to). A problem I'll have to solve is also that for some reason I cannot access the tikz nodes created by pNiceMatrix
when being still inside the same align
environment.