Once again I need help with my gaussenv
macro. This time, since the names of the pictures drawn by nicematrix
have to be different. Therefore, I thought I'd create a numeric pgfkey which holds some kind of index of the current matrix.
And this is with which I came up:
\documentclass{article}
\usepackage{nicematrix}
\usepackage{tikz}
\usetikzlibrary{calc}
\pgfkeys{
/tikz/gaussenv/.cd,
niceMatrixName/.initial=1,
}
\begin{document}
\pgfkeysvalueof{/tikz/gaussenv/niceMatrixName}matrix
\begin{align*}
\begin{pNiceMatrix}[name={\pgfkeysvalueof{/tikz/gaussenv/niceMatrixName} matrix}]
1 & 1 & 1 & 1 \\
2 & 2 & 2 & 2 \\
3 & 3 & 3 & 3 \\
\end{pNiceMatrix}
\end{align*}
\begin{tikzpicture}[remember picture,overlay]
\draw (1 matrix-1-1) -- (1 matrix-2-2);
\end{tikzpicture}
\end{document}
But sadly when compiling tikz does not know the nodes 1 matrix-1-1
or 1 matrix-2-2
, but if I use \begin{pNiceMatrix}[name={1 matrix}]
as environment declaration, if works.
I guess it has something to do with expanding, but I don't know how to solve this and even if it is really because of expanding.
Can someone help me?
nicematrix
nortikz
.name
is not expanded and that's why you can't do that.\NiceMatrixLastEnv
because of my version ofnicematrix
)\NiceMatrixLastEnv
for your version ofnicematrix
. I don't want to put it on this site because it uses internals of the package (LaTeX3 says these internals should be used only in the package). Send me an email: [email protected]