I use pics to reuse more sophisticates images multiple times in a drawing. To easily connected them with lines/arrows I name the bounding box of each pic, so they get a bit a node-like behavior.
Now I realize that if I use an arrow in a pic the bounding box is not longer around the pic but also includes the 0/0 - point.
For a better understanding check my MWE (I am quite new to TikZ so any tips are welcomed); The dashed line is the bounding box. As you can see for a pic without arrows (red) and a scope (blue) it works as expected, but for the pic with an arrow (red) the bounding box is wrong.
\documentclass[]{standalone}
\usepackage{tikz}
\usepackage[mode=buildnew]{standalone}
\begin{document}
\begin{standaloneframe}
\begin{tikzpicture}[
withArrow/.pic = {
\begin{scope}[shift = {(-2,-2)}, local bounding box = withArrow] % the shift is for easier placing the pic.
\draw[thick] (0,2) -- (4,2) (2,0)--(2, 4);
\draw[thin, ->,] (1,1) -- (3,3);
\end{scope}
},
withoutArrow/.pic = {
\begin{scope}[shift = {(-2,-2)}, local bounding box = withoutArrow]
\draw[thick] (0,2) -- (4,2) (2,0)--(2, 4);
\end{scope}
}
]
% Mark 0/0 point just for orientation
\node[circle, draw = black] (Zero) {0/0};
% Pic without Arrow works as expected
\pic at(3,3) {withoutArrow};
% Bounding box
\draw [green, dashed] (withoutArrow.south west) rectangle (withoutArrow.north east);
% Pic with Arrow; bounding box is extended to incluce 0/0 point
\pic at(3,-3) {withArrow};
% Bounding box
\draw [red, dashed] (withArrow.south west) rectangle (withArrow.north east);
% Scope works also with arrow fine
\begin{scope}[scale = 1, shift = {(6,-2)}, local bounding box = scope]
\draw[thick] (0,2) -- (4,2) (2,0)--(2, 4);
\draw[thin, ->,] (1,1) -- (3,3);
\end{scope}
\draw [blue, dashed] (scope.south west) rectangle (scope.north east);
\end{tikzpicture}
\end{standaloneframe}
\end{document}





shiftbut still have the issue. But interestingly, if I put thepicafter thescope, the scope has now the box issue. I am really confused... but I can now work around the if I first have ascopewith an (invisible) arrow. – WitheShadow Jun 17 '20 at 13:35But if you then copy the last example, the second instance has a normal bounding box. This actually also works if you copy a
– WitheShadow Jun 17 '20 at 13:46pic