I am repeating an example shown previously in One figure having two columns of subfigures: the left column has one image and the right one has two images , but with the use of subcaption package.
Finally, I got one failed version and one successful version. My question is, why do I fail for the first version (getting the wrong height of minipage with subfigure environment inside)?
% The failed version
\documentclass{article}
\usepackage{subcaption}
\usepackage[demo]{graphicx}
\newsavebox{\measurebox}
\begin{document}
\begin{figure}
\centering
\sbox{\measurebox}{%
\begin{minipage}[b]{.33\textwidth}
\begin{subfigure}{\textwidth}
{\includegraphics[width=\textwidth,height=5cm]{figA}\caption{caption A}}
\end{subfigure}
\end{minipage}}
\fbox{\usebox{\measurebox}}\qquad
\fbox{%
\begin{minipage}[b][\ht\measurebox][s]{.33\textwidth}
\centering
\begin{subfigure}{\textwidth}
\includegraphics[width=\textwidth,height=2cm]{figB}\caption{caption B}
\end{subfigure}
\vfill
\begin{subfigure}{\textwidth}
\includegraphics[width=\textwidth,height=2cm]{figC}\caption{caption C}
\end{subfigure}
\end{minipage}%
}
\caption{my caption}
\end{figure}
\end{document}
% The successful version
\documentclass{article}
\usepackage{subcaption}
\usepackage[demo]{graphicx}
\newsavebox{\measurebox}
\begin{document}
\begin{figure}
\centering
\sbox{\measurebox}{%
\begin{minipage}[b]{.33\textwidth}
\includegraphics[width=\textwidth,height=5cm]{figA}\subcaption{caption A}
\end{minipage}}
\fbox{\usebox{\measurebox}}\qquad
\fbox{%
\begin{minipage}[b][\ht\measurebox][s]{.33\textwidth}
\centering
\includegraphics[width=\textwidth,height=2cm]{figB}\subcaption{caption B}
\vfill
\includegraphics[width=\textwidth,height=2cm]{figC}\subcaption{caption C}
\end{minipage}%
}
\caption{my caption}
\end{figure}
\end{document}


\dimexpr \ht\measurebox+\dp\measurebox. – John Kormylo Oct 29 '19 at 03:20\dimexpr \ht\measurebox+\dp\measurebox, it has the same effect of having159pt. So does that mean we cannot capture the height of a minipage if there is an inner minipage within it? – Dau Zi Oct 29 '19 at 16:00