# Aligning 3 images square in a box

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:

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?

• Are they subfigures of one figure or are they three independent figures? – Gonzalo Medina May 15 '13 at 0:32

## 1 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}


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}


• Is it possible to have the height calculated based off of the height of the right image with a certain width instead of putting in exact lengths? – user30738 May 15 '13 at 1:06
• Sure. You can box the image and measure its height; see my updated answer. – Gonzalo Medina May 15 '13 at 1:21