5

I have 5 images to place (using the subfigure environment), I would like to place them either in two columns (one with 3 images, the other with 2), or in two lines (idem) and use the empty place that a 6th image would have taken to put the caption. How can I do that?

Thanks!

6

You can use subfigure for the subfigures and a minipage for the caption:

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

\begin{document}

\begin{figure}
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{test subfigure}
\end{subfigure}\hfill
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{test subfigure}
\end{subfigure}\hfill
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{test subfigure}
\end{subfigure}\par
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{test subfigure}
\end{subfigure}\hfill
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{test subfigure}
\end{subfigure}\hfill
\begin{minipage}{.3\textwidth}
\caption{a figure with six subfigures and a caption placed beside one of the subfigures}
\end{minipage}
\end{figure}

\end{document}

enter image description here

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

\begin{document}

\begin{figure}
\centering
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{test subfigure}
\end{subfigure}\quad
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{test subfigure}
\end{subfigure}\par
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{test subfigure}
\end{subfigure}\quad
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{test subfigure}
\end{subfigure}\par
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{test subfigure}
\end{subfigure}\quad
\begin{minipage}{.3\textwidth}
\caption{a figure with six subfigures and a caption placed beside one of the subfigures}
\end{minipage}
\end{figure}

\end{document}

enter image description here

Use the optional argument for the environments to get the desired alignment, if required.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.