Two options:
The first (which I prefer) uses the subcaption
package to generate the subcaption in a bax in a node inside the tikzpicture
, which gives you a lot of flexibility (you can put the subcaption anywhere in the picture to make better use of empty areas, for example). This won't work if you need to use the subfigure
package or depend on \resizebox
to scale your whole picture, as this will scale the subcaption as well.
Creating the node to hold the subcaption can be wrapped in a command like
\newcommand{\alignedsublabel}[2]{%
\node at ($(current bounding box.south west)!(#1)!(current bounding box.south east)$) [anchor=base,text depth=0pt,yshift=-3ex] {\parbox{10em}{\subcaption[]{#2}}};%
}
Here's a simplified example of the setup in the question you linked to:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{caption,subcaption}
\usetikzlibrary{arrows,automata}
\newcommand{\alignedsublabel}[1]{%
\node at ($(current bounding box.south west)!(#1)!(current bounding box.south east)$) [anchor=base,text depth=0pt,yshift=-3ex] {\parbox{10em}{\subcaption[]{}}};%
}
\begin{document}
\begin{figure}[htbp]
\begin{tikzpicture}[node distance=2.0cm,semithick]
\node[state] (A) {1};
\node[state] (B) [below left of = A] {2};
\node[state] (C) [below right of = A] {3};
\node[state] (D) [below right of = C] {4};
\draw [gray,ultra thick] (current bounding box.north west) rectangle (current bounding box.south east);
\alignedsublabel{A.center}{}
\end{tikzpicture}
%
\hfill
\begin{tikzpicture}[node distance=2.0cm,semithick]
\node[state] (A) {1};
\node[state] (B) [below left of = A] {2};
\node[state] (C) [below right of = A] {3};
\node[state] (D) [below right of = C] {4};
\draw [gray,ultra thick] (current bounding box.north west) rectangle (current bounding box.south east);
\alignedsublabel{A.center}
\end{tikzpicture}
\caption{Several options}
\end{figure}
\end{document}
If you do depend on the \resizebox
stuff, you need to keep the label outside the tikzpicture
. In order to get the alignment right, the most accurate thing to do is to extend the bounding box of the tikzpicture
so it is symmetric around a specified center. This can be done by specifying a path
at the end of the tikzpicture
which can be calculated with the calc
library. The drawback is that this introduces additional empty space on the side of the picture:

\documentclass{article}
\usepackage{tikz}
\usepackage{subfigure}
\usepackage{array}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\usetikzlibrary{calc,automata}
\newcommand{\centeraround}[1]{
\path (#1) -- +($($(current bounding box.east)!(#1)!(current bounding box.west)$) - (current bounding box.east)$);
}
\begin{document}
\begin{figure}[htbp]
\begin{tabular}{C{.48\textwidth}C{.48\textwidth}}
\subfigure [] {
\resizebox{0.4\textwidth}{!}{%
\begin{tikzpicture}[node distance=2.0cm,semithick]
\node[state] (A) {1};
\node[state] (B) [below left of = A] {2};
\node[state] (C) [below right of = A] {3};
\node[state] (D) [below right of = C] {4};
\draw [gray,ultra thick] (current bounding box.north west) rectangle (current bounding box.south east);
\centeraround{A.center}
\end{tikzpicture}
}
} &
\subfigure [] {
\resizebox{0.4\textwidth}{!}{%
\begin{tikzpicture}[node distance=2.0cm,semithick]
\node[state] (A) {1};
\node[state] (B) [below left of = A] {2};
\node[state] (C) [below right of = A] {3};
\node[state] (D) [below right of = C] {4};
\draw [gray,ultra thick] (current bounding box.north west) rectangle (current bounding box.south east);
\centeraround{A.center}
\end{tikzpicture}
}
} \\
\end{tabular}
\caption{Several options}
\end{figure}
\end{document}
\node[draw=none] (E) [below left of = B] {\phantom{$\boldsymbol{2}$}};
. – Gonzalo Medina Jun 3 '11 at 19:54