Here is a piece of test code. The output in the log file is
outside test: initial
(../output/test.aux) ABD: EveryShipout initializing macros
Run number 1 of rule 'xelatex'
savedanchor test: changed
saveddimen test: changed
anchor test: initial
\documentclass[tikz]{standalone}
\pgfkeys{
test/.store in=\test,
test=initial,
}
\pgfdeclareshape{myshape}{
\inheritsavedanchors[from=rectangle]
\inheritanchorborder[from=rectangle]
\inheritanchor[from=rectangle]{center}
\savedanchor{\anyanchor}{
\typeout{savedanchor test: \test}
}
\saveddimen{\anydimen}{
\typeout{saveddimen test: \test}
}
\typeout{outside test: \test}
\anchor{any}{
\typeout{anchor test: \test}
}
}
\tikzset{
base/.code={
\tikzset{/.cd, #1}
\pgfkeysalso{myshape}
}
}
\begin{document}
\begin{tikzpicture}
\node[base={test=changed}] (a){};
\node at (a.any) {};
\end{tikzpicture}
\end{document}
How can I make all the output to be changed?
test, and set it initially to some value. Now in the path you set it to another color, and if you use it in the path, you get the updated value. This is a bit similar to setting the draw color, which is initially black, to red in a path. Then the things drawn in that path will be red. However, if you start a new path, and ask the node of the previous path which color it had, you will not be able to find out. Therefore I'd like to ask you to explain what you really want to achieve. – Nov 19 '19 at 02:06grid=(2, 3)to make it a2x3grid. Now, I'd like to declare nodes sitting on the grid points in a loop(e.g.for i in {1,2} for j in {1, 2, 3} declare anchor). But I can only get the initial value ofgrid, so I can't carry out a loop to do this thing. – ZhiyuanLck Nov 19 '19 at 02:15initial. Go back to the grid example, let initial value ofgridbegrid={(1,1)}meaning just a rectangle without grid lines. Then if I want to perform a loop declaration of grid anchors, number of iterations is always 1. – ZhiyuanLck Nov 19 '19 at 02:28