# LaTeX advanced use of subcaption package

I am trying to create a figure with subfigures aligned both horizontally and vertically in the same figure to explain this better i attached a primitive drawing.

The labels are not of importance in which order they come i just cant seem to figure out how to place the (f) and (g) images on top of (d) and (e) in the same

\begin{figure}

...

\end{figure}

-

## migrated from stackoverflow.comNov 6 '12 at 19:12

This question came from our site for professional and enthusiast programmers.

Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Nov 6 '12 at 19:14
Related/duplicate: Special arrangement of subfigures; Placing Subfigures vertically –  Werner Nov 6 '12 at 19:34

One way to do this is to box each column up in a minipage, and provide a minipage for each subimage in the last column. You can then include the \subcaption inside each of the minipages. Here is an example following your layout, but just using text instead of the images:

\documentclass{article}
\usepackage{subcaption}
\begin{document}
\begin{figure}[htp]
\centering
\begin{minipage}[t]{0.15\linewidth}
\centering \large A

\vspace{2cm}

\large AA
\subcaption{Subfigure A}
\end{minipage}
\begin{minipage}[t]{0.15\linewidth}
\centering \large B

\vspace{2cm}

\large BB
\subcaption{Subfigure B}
\end{minipage}
\begin{minipage}[t]{0.15\linewidth}
\centering \large C

\vspace{2cm}

\large CC
\subcaption{Subfigure C}
\end{minipage}
\begin{minipage}[t]{0.15\linewidth}
\centering
\begin{minipage}[t]{0.5\linewidth}
\centering F
\subcaption{Subfigure F}
\end{minipage}
\begin{minipage}[b]{0.5\linewidth}
\centering D \subcaption{Subfigure D}
\end{minipage}
\end{minipage}
\begin{minipage}[t]{0.15\linewidth}
\centering
\begin{minipage}[t]{0.5\linewidth}
\centering G
\subcaption{Subfigure G}
\end{minipage}
\begin{minipage}[b]{0.5\linewidth}
\centering E \subcaption{Subfigure E}
\end{minipage}
\end{minipage}
\caption{Whole figure caption}
\label{fig:cap}
\end{figure}
\end{document}


-