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!

1 Answer 1

6

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

\documentclass{article}
\usepackage{graphicx, 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, 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.

1
  • I find the caption title stays in the lower part of the image in reference to image (e). IT does not go up. Any solution, please.
    – relinquere
    Commented Jun 22, 2022 at 8:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .