How can I set the width of a subfigure to fit its content, i. e. a tikzpicture.
In my MWE I do not want to specify 0.1\textwidth respectively 0.9\textwidth, but instead I want the whitespace to be distributed equally around both subfigures.
\documentclass{article}
\usepackage{showframe}
\usepackage{tikz}
\usepackage{subcaption}
\begin{document}
\begin{figure}[ht]
\hfill
\begin{subfigure}[b]{0.1\textwidth}
\centering
\begin{tikzpicture}
\node[draw] (pd1) {a};
\end{tikzpicture}
\caption{}
\end{subfigure}%
\hfill
\begin{subfigure}[b]{0.9\textwidth}
\centering
\begin{tikzpicture}
\node[draw] (b) at (0,0) {b};
\node[draw] (c) at (5,0) {c};
\draw (b) to (c);
\end{tikzpicture}
\caption{}
\end{subfigure}%
\hfill
\caption{}
\end{figure}
\end{document}
I found this answer How can I access the size of a tikzpicture's bounding box outside the tikzpicture? but didn't read it in detail until now. I was wondering if my aim could be achieved easier.
