Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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!

share|improve this question

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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