Size of subfigure fitting its content (tikzpicture)
4
2
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.1textwidth respectively 0.9textwidth , 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.1textwidth} centering begin{tikzpicture} node[draw] (pd1) {a}; end{tikzpicture} caption{} end{subfigure}% hfill begin{subfigure}[b]{0.9textwidth} 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 tikzpict...