Adding to Leo Liu's answer: As the figures 3 and 4 are probably larger than the others, you also need to use the multirow
package to span several rows. The package has quite a bit of trouble with the vertical alignment, so you'll need to adjust the optional argument of the \multirow
commands by hand.
\documentclass{article}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{multirow}
\usepackage{array}
\begin{document}
\begin{figure}
\centering
\begin{tabular}{cccc}
\subfloat[A]{\includegraphics{logo}} &
\subfloat[B]{\includegraphics{logo}} &
\multirow{-3}[2.5]{*}{\subfloat[D]{\includegraphics[width=2cm,height=4cm]{logo}}} &
\multirow{-3}[-3]{*}{\subfloat[E]{\includegraphics[width=2cm,height=3cm]{logo}}} \\
\subfloat[E]{\includegraphics{logo}} &
\subfloat[F]{\includegraphics{logo}}\\
\subfloat[G]{\includegraphics{logo}}&
\subfloat[H]{\includegraphics{logo}} \\
\end{tabular}
\caption{Many figures}
\end{figure}
\end{document}
This is the image file used (save as logo.png
)
If you want to use a sledgehammer to crack a nut, you could also use TikZ
nodes and matrices. Herbert pointed out in the comments that this approach is overkill for the given problem. I'll leave it here to serve as an example of what not to do and perhaps as a template for more complex subfigure layout challenges which might arise and justify the use of this "heavy machinery".
\documentclass{article}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\captionsetup[subfloat]{farskip=0pt} % Remove the top glue from subfloats
\begin{figure}
\centering
\begin{tikzpicture}[every node/.style=inner sep=0pt]
\matrix [name=m,
cells={anchor=south},
column sep=0.8cm,row sep = 0.4cm]
{
\node (f1) {\subfloat[A]{\includegraphics{logo}} }; &
\node (f2) {\subfloat[B]{\includegraphics{logo}} }; \\
\setcounter{subfigure}{4}
\node (f5) {\subfloat[E]{\includegraphics{logo}} }; &
\node (f6) {\subfloat[F]{\includegraphics{logo}} }; \\
\node (f7) {\subfloat[G]{\includegraphics{logo}} }; &
\node (f8) {\subfloat[H]{\includegraphics[width=4cm]{logo}} }; \\
};
\setcounter{subfigure}{2}
\node (f3) [right=.8cm of m] {\subfloat[C]{\includegraphics[height=4cm,width=2cm]{logo}} };
\node (f4) [right=.8cm of f3] {\subfloat[D]{\includegraphics[height=2cm,width=2cm]{logo}} };
\end{tikzpicture}
\caption{Many figures}
\end{figure}
\end{document}