# Adding space between subfigures of tikzpicture (for caption)

I'm trying to draw two figures next to each others using tikzpicture. It's working fine, but the caption of the sub-figures is looking weird.

I tried adding the \qquad's, but I'm still having the same problem.

Here's my code;

\documentclass{article}
\usepackage{tikz,subfigure}
\begin{document}
\begin{figure}[!hb]%
\centering
\subfigure[Caption for subfigure 1]{
\begin{tikzpicture}[every node/.style={circle,draw}]
\node{5};
\end{tikzpicture}
}
\subfigure[Caption for subfigure 2]{
\begin{tikzpicture}[every node/.style={circle,draw}]
\node{}
child{node{}}
child[missing];
\end{tikzpicture}
}
\caption{}%
\label{}%
\end{figure}

\end{document}


Here's the resulting image

-
It's a bounding box problem. Add \path (0,0) rectangle(3,3); to both tikzpictures to see the effect. So either adjust the bounding boxes within tikzpicture environments or use minipages or other artificial boxes. –  percusse Mar 18 '12 at 3:40
@percusse: Using \path (0,0) rectangle(3,3); solved my problem. Thank you –  Roronoa Zoro Mar 18 '12 at 3:46
Note that the subfigures are not centered with respect to the subcaptions. Because the quick fix starts from the origin and the nodes are also aligned towards the origin too. So give explicit coordinates to your nodes to avoid that. –  percusse Mar 18 '12 at 3:49
The centering can be obtained by \path (-2,0) rectangle (2,0); which also doesn't add to the picture's height. –  egreg Mar 18 '12 at 9:32

It's a bounding box problem. you can add a node with [minimum width=xxxcm]

\documentclass{article}
\usepackage{tikz,subfigure}
\begin{document}
\begin{figure}[!hb]%
\centering
\subfigure[Caption for subfigure 1]{
\begin{tikzpicture}
\begin{scope}[every node/.style={circle,draw}]
\node(a){5};
\end{scope}
\node[minimum width=3.5cm] at (a){};
\end{tikzpicture}
}
\subfigure[Caption for subfigure 2]{
\begin{tikzpicture}

\begin{scope}[every node/.style={circle,draw}]
\node(a){}
child{node{}}
child[missing];

\end{scope}
\node[minimum width=3.5cm] at (a){};
\end{tikzpicture}
}
\caption{}%
\label{}%
\end{figure}

\end{document}



-