# horizontal and vertical image alignment with subfigure package

I have 5 images : A,B,C,D and E, all are different size. They need to be set up like this:

------- ----------- ------- -------
|     | |         | |     | |  D  |
|     | |         | |     | -------
|  A  | |     B   | |  C  |
|     | |         | |     | -------
|     | |         | |     | |  E  |
------- ----------- ------- -------


How do I set this up with the subcaption\subfigure package in latex? I have managed to get A,B,C working like this:

\centering
\begin{subfigure}[t]{0.246\textwidth}
\centering
\includegraphics[height=0.18\textheight]{tease5_a.jpg}
\end{subfigure}%
\centering
\begin{subfigure}[t]{0.18\textwidth}
\centering
\includegraphics[height=0.18\textheight]{tease5_b.jpg}
\end{subfigure}%
\centering
\begin{subfigure}[t]{0.18\textwidth}
\centering
\includegraphics[height=0.18\textheight]{tease5_c.jpg}
\end{subfigure}%


.. which is pretty much a constant height for all images, but different width allocations for each, as otherwise I have too much extra space or overlaps. But how do I set it up so that the last 2 images are aligned vertically like the image shows?

• It would be nice if you could add a complete minimal working example (MWE). E.g., do you really use subcaption and subfigure packages together?
– mafp
Jun 12 '13 at 9:35

You don't need subfig or subcaption. Use a minipage bottom aligned, but also specify its vertical size.

\documentclass{article}

\usepackage[demo]{graphicx} % demo is just for the example

\begin{document}
\begin{figure}
\centering
\includegraphics[height=0.18\textheight,width=.246\textwidth]{tease5_a.jpg}
\includegraphics[height=0.18\textheight,width=0.18\textwidth]{tease5_b.jpg}
\includegraphics[height=0.18\textheight,width=0.18\textwidth]{tease5_c.jpg}
\begin{minipage}[b][0.18\textheight][s]{0.18\textwidth}
\centering
\includegraphics[height=0.08\textheight,width=\textwidth]{tease5_d.jpg}

\vfill

\includegraphics[height=0.08\textheight,width=\textwidth]{tease5_e.jpg}
\end{minipage}
\caption{A caption}
\end{figure}
\end{document}


• Just found that solution..but actually does it really do the trick? To me it doesn't since I loose the subfig numbering scheme. Can anything be done about this? Nov 28 '14 at 20:18
• @goeck Subfigure numbering is not covered by this, but it could be added. Nov 28 '14 at 20:51
• I actually did this just. Will post it later. Nov 28 '14 at 23:11