I want to be able to refer to nodes inside a scope from outside the scope by specifying their scope and name as in TiKZ node name prefixes in scopes The solution proposed there renames the nodes so that it's not possible to refer to the nodes inside of the scope without knowing in which scope they're in.
The code below is what I'm trying to achieve, but I'm unable to figure out how to add an alias inside the name/.code argument. My attempt of pasting the alias/.code text from the tikz source didn't work and broke the naming as well.
\documentclass{article}
%\url{https://tex.stackexchange.com/q/128049/86}
\usepackage{tikz}
\begin{document}
\tikzstyle{vertex}=[circle,draw,fill=black!20]
\makeatletter
\tikzset{%
prefix node name/.code={%
\tikzset{%
name/.code={{\edef\tikz@fig@name{##1}}} %don't know how to create alias from ##1 (node name) to #1 ##1 (scope name node name)
}%
}%
}
\makeatother
\begin{tikzpicture}
% ---- Copy 1
\begin{scope}[yshift=-32pt,prefix node name=G1]
\node[vertex] (u) at (0, 0) {u};
\node[vertex] (v) at (1, 0) {v};
\draw (u) -- (v);
\end{scope}
% ---- Copy 2
\begin{scope}[yshift=32pt,prefix node name=G2]
\node[vertex] (u) at (0, 0) {u};
\node[vertex] (v) at (1, 0) {v};
\draw (u) -- (v);
\end{scope}
\draw (G1 u) -- (G2 v);
\end{tikzpicture}
\end{document}


picsinstead ofscopes? Everypiccan have its name asprefix for inner nodes. An example: http://tex.stackexchange.com/a/170686/1952 – Ignasi Oct 16 '14 at 17:54picsto the linked question: http://tex.stackexchange.com/a/207513/1952 – Ignasi Oct 16 '14 at 18:11