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.



\pgfkeys{/try1={\addArray, newSet}}it should be possible to add other values right? – atticus Jun 05 '20 at 17:55/.append codeto append code, but not in the way you are setting things up here. To give you an advice that will help you most I probably need some more information on how all this is going to be used. – Jun 05 '20 at 18:01alignenv to access the generated tiktz nodes. But for that one I'll make a new question ;) – atticus Jun 05 '20 at 18:41\pgfkeys{/try1={2-3/3-3/3}}command, but I'll have to wait to be able to ask it. – atticus Jun 05 '20 at 20:12