I'm trying to place a sequence of images of different height in two columns.
So far I've found I can use the subfigure environment, which I can use in this way:
\documentclass{article}
\usepackage{caption,subcaption}
\usepackage{graphicx} % demo is just for the example
\begin{document}
\begin{figure}
\centering
\begin{subfigure}[b]{.4\textwidth}
\includegraphics[width=\textwidth]{./pic1}
\vspace{1mm}
\includegraphics[width=\textwidth]{./pic2}
\vspace{1mm}
\includegraphics[width=\textwidth]{./pic3}
\end{subfigure}
\hspace{-1mm}
\begin{subfigure}[b]{.4\textwidth}
\includegraphics[width=\textwidth]{./pic4}
\vspace{1mm}
\includegraphics[width=\textwidth]{./pic5}
\end{subfigure}
\caption{The full caption}
\end{figure}
\end{document}
This gives me a figure where the top of the two columns is not aligned, which is what I would want.
So I need to have this:
Also, the above code works in a separate .tex file but not when I insert it in my document where I want to have it in the end. I get
"Environment subfigure undefined."
I'm using subfloats for all other images there with the package
\usepackage[labelformat=simple]{subfig}
could the problem be that they clash? It would take too much work to move all the old figures to the same subfigure environment, they are all set now.
Alternatively, can the 2-column figure be solved with the subfloat environment?
Best Answer
I have used the
subcaption
package to getsubfigure
andsubcaption
. With the same optional arguments as forminipage
the height can be specified for thesubfigure
box. Here I define\subfigheight
so it can easily be changed. Just set to slightly more than the talest stack of pictures (I used\fbox
es around thesubfigure
s to see the heights. Then\vfill
fills the vertical gaps.