I have some trees drawn with tikz and I'd like to have some text associated with them. I can use \caption
within figure
, but not tikzpicture
.
UPDATE:
Thanks for your advice. figure
seems to put my first picture at the bottom of the page, and the second one on the second page. I would like these to be close to the paragraph like the tikzpicture
was. Any ideas?
\par
Suppose we enter keys into a red-black tree in this order: 33, 47, 51, 50.
\begin{figure}
\begin{tikzpicture}
\node [blacknd] {33}
child{ node [extnd] {}}
child{ node [extnd] {}
}
; \end{tikzpicture}
\caption{We start by adding 33 to an empty tree}
\end{figure}
\begin{figure}
\begin{tikzpicture}
\node [blacknd] {33}
child{ node [extnd] {} }
child{ node [rednd] {47}
child{ node [extnd] {} }
child{ node [extnd] {} }
}
; \end{tikzpicture}
\caption{Then we add node 47. There are no imbalances to fix, since the new node's parent is black.}
\end{figure}
UPDATE: I figured it out from the excellent page here: http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions#Figures
What I was looking for is the 'h' placement specifier.