How to get the height of a minipage to set the height of another one?
Measure the left box and force the right minipage to have the same height.
\documentclass{article}
\usepackage{graphicx}
\usepackage{subfig}
\newsavebox{\dontpanicbox}
\newlength{\dontpanicht}
\begin{document}
\begin{figure}[!htp]
\centering
\sbox{\dontpanicbox}{%
\begin{minipage}[b]{0.6\linewidth}
\subfloat[]{\includegraphics[width=1.0\linewidth]{example-image-a}}
\subfloat[]{\includegraphics[width=1.0\linewidth]{example-image-b}}
\end{minipage}%
}
\setlength{\dontpanicht}{\ht\dontpanicbox}
\usebox{\dontpanicbox}\hfill
\begin{minipage}[b][\dontpanicht][s]{0.3\linewidth}
\subfloat[]{\includegraphics[width=1.0\linewidth]{example-image-c}}
\vfill
\subfloat[]{\includegraphics[width=1.0\linewidth]{example-image-c}}
\vfill
\subfloat[]{\includegraphics[width=1.0\linewidth]{example-image-c}}
\end{minipage}
\end{figure}
\end{document}
“Much simpler” with \valign
.
\documentclass{article}
\usepackage{graphicx}
\usepackage{subfig}
\begin{document}
\begin{figure}[!htp]
\centering
\valign{#\cr
\hsize=0.6\textwidth
\subfloat[]{\includegraphics[width=\hsize]{example-image-a}}\vfill
\subfloat[]{\includegraphics[width=\hsize]{example-image-b}}\cr
\noalign{\hfill}
\hsize=0.3\textwidth
\subfloat[]{\includegraphics[width=\hsize]{example-image-c}}\vfill
\subfloat[]{\includegraphics[width=\hsize]{example-image-c}}\vfill
\subfloat[]{\includegraphics[width=\hsize]{example-image-c}}\cr
}
\end{figure}
\end{document}
Where's the advantage? In that you don't need to know which column is higher. For instance, if the proportions are set to 0.55 and 0.35 instead of 0.6 and 0.3, the right column would become higher, but the same code as above, with just the change in the two parameters
\valign{#\cr
\hsize=0.55\textwidth
\subfloat[]{\includegraphics[width=\hsize]{example-image-a}}\vfill
\subfloat[]{\includegraphics[width=\hsize]{example-image-b}}\cr
\noalign{\hfill}
\hsize=0.35\textwidth
\subfloat[]{\includegraphics[width=\hsize]{example-image-c}}\vfill
\subfloat[]{\includegraphics[width=\hsize]{example-image-c}}\vfill
\subfloat[]{\includegraphics[width=\hsize]{example-image-c}}\cr
}
would produce
like this?
instead of minipage
i suggest to use `tabular* environment:
\documentclass[twocolumn]{article}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{array, hhline}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\begin{figure*}
\centering
\setkeys{Gin}{width=\linewidth}
\begin{tabular*}{\linewidth}{|m{\dimexpr0.6\linewidth-2\tabcolsep-1.5\arrayrulewidth}|
p{\dimexpr0.1\linewidth-2\tabcolsep}
|m{\dimexpr0.3\linewidth-2\tabcolsep-1.5\arrayrulewidth}|
}
\hhline{|-|~|-|}
\subfloat[]{\includegraphics{example-image-a}}
\bigskip
\subfloat[]{\includegraphics{example-image-b}}
\medskip
&&
\subfloat[]{\includegraphics{example-image-duck}}
\vspace{4ex} % <-- determined experimentaly, depends of images heights
\subfloat[]{\includegraphics{example-image-duck}}
\vspace{4ex} % <-- determined experimentaly, depends of images heights
\subfloat[]{\includegraphics{example-image-duck}} \\
\hhline{|-|~|-|}
\end{tabular*}
\end{figure*}
\end{document}
This uses a savebox to measure the height. One could also use \settoheight
, but I suspect that it uses a savebox internally.
BTW, the [s] option stands for stretch. Of course, with \vfill
one would get the same results using [t]. [b] or [c]. OTOH, the \vfill
in the first minipage does nothing.
\documentclass{article}
\usepackage{graphicx}
\usepackage{subfig}
\begin{document}
\begin{figure*}[!t]
\sbox0{\begin{minipage}[b]{0.6\linewidth}% measure height
\subfloat[]{\includegraphics[width=1.0\linewidth]{example-image-a}}
\vfill
\subfloat[]{\includegraphics[width=1.0\linewidth]{example-image-b}}
\end{minipage}}%
\fbox{\usebox0}%
\hfill
\fbox{\begin{minipage}[b][\ht0][s]{0.3\linewidth}
\subfloat[]{\includegraphics[width=1.0\linewidth]{example-image-c}}
\vfill
\subfloat[]{\includegraphics[width=1.0\linewidth]{example-image-c}}
\vfill
\subfloat[]{\includegraphics[width=1.0\linewidth]{example-image-c}}
\end{minipage}}
\end{figure*}
\end{document}