[Tex/LaTex] Aligning 3 images square in a box

graphicsminipage

I am trying to create a figure with 3 images: two on the left half which are on top of each other, and one on the right that spans the height of the left images. Here is what I have:

\documentclass[draft]{book}
\usepackage{graphicx}
\begin{document}
    \begin{figure}
        \begin{minipage}[c]{0.47\textwidth}
                \centering
                \includegraphics[width=\textwidth]{photos/image1}
                Caption
                \vfill % This does not produce the desired result
                \includegraphics[width=\textwidth]{photos/image2}
                Caption
        \end{minipage}
        \hfill
        \begin{minipage}[c]{0.47\textwidth}
            \centering
            \includegraphics[width=\textwidth]{photos/image3}
            Caption
        \end{minipage}
    \end{figure}
\end{document}

Here is what the result looks like:

enter image description here

The top of the first image on the left in not in line with the right's top, and likewise with the bottom image's border. I have \vfill in between the two images on the left, but I imagine it isn't functioning as the two minipages aren't the same height.

Is there a way to make the minipages equal height, or perhaps there's a better way to accomplish this all together?

Best Answer

Here's one option, using the floatrow and subfig packages; depending on the actual size of your images, you might need to adjust some lengths:

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{floatrow}
\usepackage{subfig}

\begin{document}

\begin{figure}
\ffigbox[7.8cm]{%
\begin{subfloatrow}
  \hsize0.7\hsize
  \vbox to 6.35cm{
  \ffigbox[\FBwidth]
    {\caption{small subfigure A}}
    {\includegraphics[width=3cm,height=3cm]{smallfigure1}}\vss
  \ffigbox[\FBwidth]
    {\caption{small subfigure B}}
    {\includegraphics[width=3cm,height=2cm]{smallfigure2}}
  }
\end{subfloatrow}\hspace*{\columnsep}
\begin{subfloatrow}
  \ffigbox[\FBwidth][]
    {\caption{A large subfigure}}
    {\includegraphics[width=3cm,height=6cm]{largepicture}}
\end{subfloatrow}
}{\caption{three subfigures}}
\end{figure}

\end{document}

enter image description here

The demo option for graphicx simply replaces actual figures with black rectangles; do not use that option in your actual document.

Boxing the larger image, one can automatically calculate the needed height (some small manual adjustment will still be needed for the \vbox):

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{floatrow}
\usepackage{subfig}

\newlength\imageht
\newlength\imagedp

\begin{document}

\newsavebox\Image
\savebox\Image{\includegraphics[width=4cm]{largefigure}}
\settoheight\imageht{\usebox{\Image}}
\settodepth\imagedp{\usebox{\Image}}
\addtolength\imageht{\imagedp}

\begin{figure}
\ffigbox[7.8cm]{%
\begin{subfloatrow}
  \hsize0.7\hsize
  \vbox to \dimexpr\imageht+10pt\relax{
  \ffigbox[\FBwidth]
    {\caption{small subfigure A}}
    {\includegraphics[width=3cm,height=1cm]{smallfigure1}}\vss
  \ffigbox[\FBwidth]
    {\caption{small subfigure B}}
    {\includegraphics[width=3cm,height=1cm]{smallfigure2}}
  }
\end{subfloatrow}\hspace*{\columnsep}
\begin{subfloatrow}
  \ffigbox[\FBwidth][]
    {\caption{A large subfigure}}
    {\usebox{\Image}}
\end{subfloatrow}
}{\caption{three subfigures}}
\end{figure}

\end{document}

enter image description here

Related Question