# Arrange images as tables or subfigure or some other layout

How to layout images like the attached picture? Should I arrange them as tables or subfigure or some other layout? Thanks.

This is my latex code:

\begin{figure}
\centering
\subfloat[]{\includegraphics[width=\dimexpr(\textwidth-15pt+3pt*2)/2\relax]{fish}}%
\hfill
\subfloat[]{\vbox{\offinterlineskip\halign{#\hskip3pt&#\cr
\includegraphics[width=\dimexpr(\textwidth-15pt-3pt*2)/4\relax]{fish}&
\includegraphics[width=\dimexpr(\textwidth-15pt-3pt*2)/4\relax]{fish}\cr
\noalign{\vskip3pt}
\includegraphics[width=\dimexpr(\textwidth-15pt-3pt*2)/4\relax]{fish}&
\includegraphics[width=\dimexpr(\textwidth-15pt-3pt*2)/4\relax]{fish}\cr
}}}

\subfloat[]{\vbox{\offinterlineskip\halign{#\hskip3pt&#\cr
\includegraphics[width=\dimexpr(\textwidth-15pt-3pt*2)/4\relax]{fish}\cr
\noalign{\vskip3pt}
\includegraphics[width=\dimexpr(\textwidth-15pt-3pt*2)/4\relax]{fish}\cr
}}}

\subfloat[]{\vbox{\offinterlineskip\halign{#\hskip3pt&#\cr
\includegraphics[width=\dimexpr(\textwidth-15pt-3pt*2)/4\relax]{fish}\cr
\noalign{\vskip3pt}
\includegraphics[width=\dimexpr(\textwidth-15pt-3pt*2)/4\relax]{fish}\cr
}}}

\caption{Test images}
\end{figure}


The result is:

How to put "(d)" to the right of "(c)"?

Update: Thank Johannes_B, subcaption is the easiest way to meet my requirement. My code is:

 \begin{figure}
\begin{subfigure}[b]{.237\textwidth}
\centering
\includegraphics[width=\textwidth]{image_a}
\caption{Our}\label{fig:1a}
\end{subfigure}
\hfill
\begin{subfigure}[b]{.237\textwidth}
\centering
\includegraphics[width=\textwidth]{image_b}
\end{subfigure}
\hfill
\begin{subfigure}[b]{.15\textwidth}
\centering
\includegraphics[width=\textwidth]{image_c_1}
\includegraphics[width=\textwidth]{image_c_2}
\caption{Another subfigure}\label{fig:1c}
\end{subfigure}
\hfill
\begin{subfigure}[b]{.15\textwidth}
\centering
\includegraphics[width=\textwidth]{image_d_1}
\includegraphics[width=\textwidth]{image_d_2}
\caption{Another subfigure}\label{fig:1c}
\end{subfigure}
\hfill
\begin{subfigure}[b]{.15\textwidth}
\centering
\includegraphics[width=\textwidth]{image_e_1}
\includegraphics[width=\textwidth]{image_e_2}
\caption{Another subfigure}\label{fig:1c}
\end{subfigure}
\hfill
\caption{A figure}\label{fig:1}
\end{figure}

• Welcome, package subcaption will do the job. – Johannes_B Jan 18 '16 at 8:56
• could you please give me some sample code ? – hercules Jan 18 '16 at 9:09
• subcaption package – Johannes_B Jan 18 '16 at 9:18
• thanks. how to make two pictures sharing one caption ? e.g. fig (c), (d), (e). – hercules Jan 19 '16 at 0:43
• Can you add that to the questioni above (edit), along with what you got so far? – Johannes_B Jan 19 '16 at 7:52

You almost do ... Unfortunately, I haven't so nice figures to include them in MWE below:

\documentclass{article}
\usepackage{graphicx}
\usepackage{caption,subcaption}

\begin{document}
\begin{figure}[ht]
\centering
\begin{subfigure}[b]{0.5\linewidth}
\centering
\includegraphics[width=0.95\textwidth]{example-image-a}
\caption{}\label{fig:fig1}
\end{subfigure}%
\begin{subfigure}[b]{0.5\linewidth}
\centering
\includegraphics[width=0.45\textwidth]{example-image-a}
\hfil
\includegraphics[width=0.45\textwidth]{example-image-b}\\[2mm]
\includegraphics[width=0.45\textwidth]{example-image-c}
\hfil
\includegraphics[width=0.45\textwidth]{example-image}
\caption{}\label{fig:fig2}
\end{subfigure}

\vspace{1ex}
\begin{subfigure}[b]{0.32\linewidth}
\centering
\includegraphics[width=0.48\textwidth]{example-image-a}
\includegraphics[width=0.48\textwidth]{example-image-b}
\caption{}\label{fig:fig3}
\end{subfigure}\hfill%
\begin{subfigure}[b]{0.32\linewidth}
\centering
\includegraphics[width=0.48\textwidth]{example-image-a}
\includegraphics[width=0.48\textwidth]{example-image-b}
\caption{}\label{fig:fig4}
\end{subfigure}\hfill%
\begin{subfigure}[b]{0.32\linewidth}
\centering
\includegraphics[width=0.48\textwidth]{example-image-a}
\includegraphics[width=0.48\textwidth]{example-image-b}
\caption{}\label{fig:fig5}
\end{subfigure}
\caption{Test images}
\end{figure}
\end{document}


Probably you need to make some manual tweaking of width and height of figures, that will appear as you like.

• Do you have an idea, how I could "automatically" calculate the [2mm], so that the upper and the lower edge of the left image are aligned with the upper and the lower edge of the right images? (In the upper row). Or also how the images in the lower row can be aligned at the left and right edge with the images in the upper row? – AnatraIlDuck Jan 22 '16 at 15:03
• This is not so complicated. One way is, that you in advance determines all widths of sub figures and images in it. Since you haven't give to us any information about page layout (\textwidth size) I wasn't able to test. Also with given relative measure you can tweak this (by trial). – Zarko Jan 22 '16 at 15:12