1

I'm struggling to put a series of five graphics side by side with the normal text. The figures are put as subfloat and placed inside a common figure environment to be able to give them a common caption.

I tried minipages so far, but they don't align side by side (old minipage problem), because one of them is inside the figure environment to be able to use subfloat. multicol seemed to be a solution, but didn't help at all.

Some ideas how to get the job done?

MnWE as follows:

\documentclass{scrreprt}
\usepackage{caption}

\begin{document}

\begin{figure}[hbt]
 \begin{minipage}[h]{0.28\textwidth}
    \centering
    \captionsetup{format=plain}
    \subfloat[]{\includegraphics{somegraphics}}
    \subfloat[]{\includegraphics{somegraphics}}
    \subfloat[]{\includegraphics{somegraphics}}
    \subfloat[]{\includegraphics{somegraphics}}
    \caption{some fancy caption}
 \end{minipage}%
\end{figure}%
 \begin{minipage}
  some text... \lorem
 \end{minipage}
\end{document}

Edit: The wrapfigure solution from Gonzalo worked well for me, but as the figures should span the whole page on the left side, you have to be careful not to make the wrapfigure environment too large. It easily extends to the next page without you even noticing it (because the visible part stays on one page). Try to set the height of the individual figures, so the whole environment fits one page.

  • The second minipage is missing the mandatory argument (the width). – Gonzalo Medina Oct 21 '15 at 13:54
  • How should the five subfigures be arranged? – Gonzalo Medina Oct 21 '15 at 13:56
  • I mean the problem with minipages not being displayed side by side, unless you put a % right after the other, so the first one is followed directly by the second one. The figure environment suppressed that and I didn't come up with another solution than minipage – Knigge46 Oct 21 '15 at 14:29
1

The description of the problem suggests that you want text to wrap around the subfigure arrangement; in this case, the wrapfigure environment from the wrapfig package could be used; in comments it was mentioned that the subfigures should appear one below the other:

\documentclass{scrreprt}
\usepackage{wrapfig}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{caption}
\usepackage{lipsum}

\begin{document}

\begin{wrapfigure}{l}{0.28\textwidth}
    \centering
    \captionsetup{format=plain}
    \subfloat[]{\includegraphics[width=3cm]{example-image-a}}\par
    \subfloat[]{\includegraphics[width=3cm]{example-image-a}}\par
    \subfloat[]{\includegraphics[width=3cm]{example-image-a}}\par
    \subfloat[]{\includegraphics[width=3cm]{example-image-a}}\par
    \subfloat[]{\includegraphics[width=3cm]{example-image-a}}
    \caption{some fancy caption}
\end{wrapfigure}
\lipsum[1-4]

\end{document}

enter image description here

Since you are loading the caption package, you could as well use the subcaption package instead of subfig and its subfigure enviornment or its \subcaptionbox command; an example using the latter:

\documentclass{scrreprt}
\usepackage{wrapfig}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{lipsum}

\begin{document}

\begin{wrapfigure}{l}{0.28\textwidth}
    \centering
    \captionsetup{format=plain}
    \subcaptionbox{}{\includegraphics[width=2cm]{example-image-a}}\par
    \subcaptionbox{}{\includegraphics[width=2cm]{example-image-a}}\par
    \subcaptionbox{}{\includegraphics[width=2cm]{example-image-a}}\par
    \subcaptionbox{}{\includegraphics[width=2cm]{example-image-a}}\par
    \subcaptionbox{}{\includegraphics[width=2cm]{example-image-a}}
    \caption{some fancy caption}
\end{wrapfigure}
\lipsum[1-2]

\end{document}
  • okay, that does look not too far away from what I actually want! I will give the wrapfigure approach a try. The figures should be arranged one below another... – Knigge46 Oct 21 '15 at 14:13
  • @Knigge46 Perhaps if you had explained from the beginning what you actually want, I could've helped to get there more efficiently .). Do you wnat the text to wrap around the figure arrangement? – Gonzalo Medina Oct 21 '15 at 14:14
  • 1
    @Knigge46 Please see my updated answer. – Gonzalo Medina Oct 21 '15 at 14:22
  • thank you so far, that does work for me. The arrangement of the figures doesn't play such a big role, I think... Next problem is: the figure seems to stretch over to the next page (although it physically doesn't!). what causes this behaviour? – Knigge46 Oct 21 '15 at 14:24
  • @Knigge46 there's a number of precautions to be taken into account when using wrapfigure (most importantly, not to use it near a page break); please refer to the package documentation to see them. You can also try \usepackage[verbose]{wrapfig} and reviewing the console output (or the .log file) to look for any clues about what's happening. – Gonzalo Medina Oct 21 '15 at 14:28

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.