[Tex/LaTex] Placing TikZ drawings in a minipage side by side

captionshorizontal alignmentminipagetikz-pgf

I've some problems with aligning some drawings I made with TikZ:
I want these two TikZ pictured below to be displayed side by side with the two captions being on the same horizontal level. Unfortunately, right now the caption of the second drawing appears well below the first caption because the second drawing is a bit larger. How can I add some blank space above the first drawing so that the two captions are vertically aligned?

\documentclass{article}
\usepackage{tikz}
\usepackage{caption}
\begin{document}
\begin{minipage}{0.6\textwidth}
\begin{center}
\begin{tikzpicture}
[level distance=20mm,
every node/.style={fill=blue!75,circle, draw, inner sep=2pt},
level 1/.style={sibling distance=40mm,nodes={fill=blue!60}},
level 2/.style={sibling distance=20mm,nodes={fill=blue!45}},
level 3/.style={sibling distance=10mm,nodes={fill=blue!35}}]
\node {5}
      child {node {2}}
      child {node {9}};
\end{tikzpicture}
\captionsetup{font=footnotesize}
\captionof{figure}{Caption 1}
\end{center}
\end{minipage}
\begin{minipage}{0.6\textwidth}
\begin{center}
\begin{tikzpicture}
[level distance=20mm,
every node/.style={fill=blue!75,circle, draw, inner sep=2pt},
level 1/.style={sibling distance=40mm,nodes={fill=blue!60}},
level 2/.style={sibling distance=20mm,nodes={fill=blue!45}},
level 3/.style={sibling distance=10mm,nodes={fill=blue!35}}]
\node {1}
      child {node {5}
         child {node {1}}
         child[missing]
      }
      child {node {8}};
\end{tikzpicture}
\captionsetup{font=footnotesize}
\captionof{figure}{Caption 2}
\end{center}
\end{minipage}

\end{document}

Best Answer

This is exactly what the \subcaptionbox command (from the subcaption package) was designed for:

\documentclass{article}
\usepackage{tikz}
\usepackage{caption}
\usepackage{subcaption}

\begin{document}

\begin{figure}
\captionsetup[subfigure]{font=footnotesize}
\centering
\subcaptionbox{Caption for first subfigure}[.5\textwidth]{%
\begin{tikzpicture}
[level distance=20mm,
every node/.style={fill=blue!75,circle, draw, inner sep=2pt},
level 1/.style={sibling distance=40mm,nodes={fill=blue!60}},
level 2/.style={sibling distance=20mm,nodes={fill=blue!45}},
level 3/.style={sibling distance=10mm,nodes={fill=blue!35}}]
\node {5}
      child {node {2}}
      child {node {9}};
\end{tikzpicture}}%
\subcaptionbox{Caption for the seconf figure. This will span several lines for the example; in fact, it will span three lines}[.5\textwidth]{\begin{tikzpicture}
[level distance=20mm,
every node/.style={fill=blue!75,circle, draw, inner sep=2pt},
level 1/.style={sibling distance=40mm,nodes={fill=blue!60}},
level 2/.style={sibling distance=20mm,nodes={fill=blue!45}},
level 3/.style={sibling distance=10mm,nodes={fill=blue!35}}]
\node {1}
      child {node {5}
         child {node {1}}
         child[missing]
      }
      child {node {8}};
\end{tikzpicture}}
\end{figure}

\end{document}

enter image description here