Long time reader, first time poster. I just can't seem to find a solution to this problem, so I defer to your expert advice! I initially tried to create a TiKzpicture inside of a node of a TiKzpicture, but then when I tried to draw edges between nodes within the inner TiKzpicture, I got the following error:
Undefined control sequence \path[->] (w0) edge[bend left=10] node[right] {$\R^{0}$} (v0);
(The error actually didn't fully display the line, no matter how I tried to coax TexStudio to tell me what the full error was, so I just copied the first offending line.)
I read this post (I don't have sufficient reputation to post links with appropriate formatting. Ugh!! How to avoid nesting of tikzpicture? ) One solution proposed was to create a lrbox which would contain the TiKzpicture, and then to use the command declared in the preamble of the document as follows:
\newsavebox\helloworld
...
\node [label={below:Hello World}] (hw) {\usebox\helloworld};
This actually solved the problem above, and the edges were successfully drawn between the desired nodes (e.g. (w0, v0) and (w1, v1). However, a new problem has arisen: I'm trying to draw an edge from a node within the TiKzpicture contained in the lrbox to a node in the "outer" TiKzpicture. From my understanding, the contents of the lrbox are rendered before the contents of the outer TiKzpicture; however, I'm not sure how else to approach this.
Here's from before I add the edge in, and then what happens after I add the edge:
Here's my full code:
\documentclass{article}
\usepackage{float, latexsym, tikz, amssymb, amsmath, amsthm, graphicx, caption}
\usetikzlibrary{shapes,arrows,positioning,fit,matrix,calc}
\newsavebox\disjUn
\newcommand{\R}{\mathcal{R}}
\newcommand{\F}{\mathfrak{F}}
\begin{document}
\tikzstyle{frame}=[draw,ellipse,minimum height=6cm,minimum width=2cm]
\tikzstyle{world} =[draw,circle,fill=black, inner sep=0pt, minimum size=3pt]
\begin{lrbox}{\disjUn}
\begin{tikzpicture}[node distance=3cm]
\node[frame] (F0){};
\node at ([xshift=-1em, yshift=-4em]F0.north) [world, label={70:$(w,0)$}] (w0){};
\node at ([yshift=3em]F0.south west) [world, label={-70:$(v,0)$}] (v0){};
\path[->] (w0) edge[bend left=10] node[right] {$\R^{0}$} (v0);
\node[frame, right of=F0] (F1){};
\node at ([xshift=-1em, yshift=-4em]F1.north) [world, label={70:$(w,1)$}] (w1){};
\node at ([yshift=3em]F1.south west) [world, label={-70:$(v,1)$}] (v1){};
\path[->] (w1) edge[bend left=10] node[right] {$\R^{1}$} (v1);
\end{tikzpicture}
\end{lrbox}
\begin{figure}[H]
\centering
\begin{tikzpicture}[remember picture, node distance=3cm, transform canvas={scale=0.9}]
\node[draw=white, label={below:$\F \oplus \F$}] (FF) {\usebox\disjUn};
\node[frame,right of=FF, xshift=3cm,label={below:$\F^{\prime}$}] (Fp){};
\node at ([yshift=-4em]Fp.north) [world, label={70:$\hat{w}$}] (w){};
\node at ([yshift=3em]Fp.south west) [world, label={-70:$\hat{v}$}] (v){};
\node at ([yshift=3em]Fp.north east) [world, label={70:$w^{\prime}$}] (wp){};
\path[->] (w) edge[bend left=10] node[right] {$\R^{\prime}$}(v);
\path[-] (wp.west) edge[bend right,draw=gray, dashed] node [below]{} (Fp.north);
\path[-] (wp.south east) edge[bend left,draw=gray, dashed] node [below]{} (Fp.north east);
\path[->] (w0) edge[bend right, dashed] node[above] {$g$}(w);
%\path[->] (w1) edge[bend right,dashed] node[above] {$g$}(wp);
\end{tikzpicture}
\end{figure}
\end{document}
Are there any alternate solutions where I can nicely position the worlds within ellipses and have edges between these structures? Thanks so much in advance!
EDIT: I would also like to note that I am using the \disjUn TiKzpicture in a lrbox as a component of two TiKzpictures; I liked the fact that I could edit the diagram in only one place, and have the changes reflected in both diagrams! However, the fact that I cannot seem to draw edges to nor from nodes within this environment is problematic :(
A friend of mine recommended using \begin{scope}[...] \end{scope} to contain the different structures, but there's still the problem of code re-use, and positioning the worlds (the black dots) relative to the ovals... Thanks again for reading! :)
EDIT2: Thanks to AJN, I discovered that I had originally used the
remember picture
Argument in the wrong TiKz picture; it is meant to be on the inner TiKz picture; I suppose that this is because we want the compiler to remember the node names for use in the parent TiKz picture.
frame
,world
etc do not seem to be defined. – AJN Mar 25 '16 at 4:44.pic
would provide or does nesting break some features? – AJN Mar 25 '16 at 12:38