I am a beginner at TikZ and LaTeX.
This is what I currently have:
I would like to label each of these rectangles (i.e. graphs) with a single letter, i.e. G.
This is the code for a single graph in this picture:
\node[outer] (L) {
\begin{tikzpicture}
\node [inner,label=below:1] (a) at (0,0) {1};
\node [inner] (ai) at (1,0) {1};
\node [inner,label=below:2] (aii) at (2,0) {1};
\draw[->] (a) edge (ai);
\draw[->] (ai) edge (aii);
\end{tikzpicture}
};
Specifically, this is the code for the top leftmost graph.
I would like to give it a label L. I read online that to give a caption (label) to a tikzpicture you have to put it inside the tikz figure. I've done it for the big graph, hence you can see "Figure 3: A double pushout." below the whole picture.
But when I put the contains of this node L inside a tikzfigure, i.e.
\node[outer] (L) {
\begin{figure}
\begin{tikzpicture}
\node [inner,label=below:1] (a) at (0,0) {1};
\node [inner] (ai) at (1,0) {1};
\node [inner,label=below:2] (aii) at (2,0) {1};
\draw[->] (a) edge (ai);
\draw[->] (ai) edge (aii);
\end{tikzpicture}
\end{figure}
};
It throws an error.
! LaTeX Error: Not in outer par mode.
Also, it's really a lot "figures", which seems unnecessary for me?
I also tried this solution (which works for small nodes), so instead
\node[outer] (L) {
I wrote
\node[outer, label=above:L] (L) {
But it throws this error:
! Undefined control sequence.
<argument> pgf@sh@ns@\tikzlastnode
l.15 \draw[->] (a) edge (ai)
My code may seem silly to you, experts. So feel free to point out any mistakes! I have a feeling I'm too "wordy" for what I'm trying to achieve.
For completeness, I will say that the big tikzpicture has the following settings:
\begin{figure}[htb!]
\centering
\begin{tikzpicture}[remember picture,
inner/.style={circle,draw,inner sep=4},
outer/.style={draw,inner sep=4, outer sep=2} % deleted thick here after draw
Thanks for help everyone!
Best Answer
Another alternative, moving the
draw
out of {external label}.Code