# Layout issues when using subcaption together with sidecap

I am using the sidecap package for side captions. I also want to have subfigures (for example, three or four subfigures labeled with a), b), c) and d), respectively).

When not using the SCfigure environment, this is what I get (the figures are aligned correctly, but the caption is obviously not at the side):

\documentclass[a4paper,twoside,11pt,openright]{scrbook}
\usepackage{graphicx}
\DeclareGraphicsExtensions{.pdf,.png,.jpg}
\graphicspath{{./images/}}
\usepackage[wide]{sidecap}                                                      % custom captions on the side
\sidecaptionvpos{figure}{t}                                                     % captions should be on top
\sidecaptionvpos{table}{t}
\usepackage[font=footnotesize,
format=plain,
labelfont={bf,sf},
nooneline,
textfont={it}]{caption}

\usepackage{subcaption}
\usepackage[twoside]{geometry}
\geometry{a4paper,
left=24.8mm,
top=27.4mm,
textwidth=135mm,
marginparsep=8.2mm,
marginparwidth=28mm
}

\begin{document}
\begin{figure}
\subcaptionbox{\label{fig:01:054a}}
{\includegraphics[width=0.5\textwidth]{a}}
\subcaptionbox{\label{fig:01:054b}}
{\includegraphics[width=0.5\textwidth]{b}}
\subcaptionbox{\label{fig:01:054c}}
{\includegraphics[width=0.5\textwidth]{c}}
\caption{A test figure}\label{fig:01:054}
\end{figure}

\end{document}


When using SCfigure but with only two subfigures, the result is satisfying, correctly displaying the side caption:

\begin{SCfigure}
\subcaptionbox{\label{fig:01:054a}}
{\includegraphics[width=0.5\textwidth]{a}}
\subcaptionbox{\label{fig:01:054b}}
{\includegraphics[width=0.5\textwidth]{b}}
%  \subcaptionbox{\label{fig:01:054c}}
%          {\includegraphics[width=0.5\textwidth]{c}}
\caption{A test figure}\label{fig:01:054}
\end{SCfigure}


When I uncomment the last \subcaptionbox, this is what I get:

What do I have to do in order to display three or more figures of width=0.5\textwidth correctly like in the figure environment? Can't be that I'm the only one who's using side captions in conjunction with subfigures....

Edit: In this German forum thread, the author of the subcaption package claims that it is compatible with sidecap.

-
Although I don't think an MWE will change anything here because the package maintainer or another person is likely to know the answer without needing an MWE, I added one... – wnstnsmth Aug 5 '13 at 12:10
@wnstnsmth Re: another person is likely to know the answer without needing an MWE - Quite the opposite is often true. Also some people decide not to help simply because an MWE is missing. So: thanks for posting one! – clemens Aug 5 '13 at 12:14
Alright.. I hope it works with the information provided. – wnstnsmth Aug 5 '13 at 12:18

I would suggest you the more powerful and flexible floatrow package (in fact, the author of caption also suggest this package as an alternative to sidecap).

I commented out a spurious blank space after the first \subcaptionbox and added a line changing command \\ after the second one; I also added a "fake" four image (a rule of zero height and 0.5\textwidth width) to have the third image flushed left instead of centered:

\documentclass[a4paper,twoside,11pt,openright]{scrbook}
\usepackage{graphicx}
\DeclareGraphicsExtensions{.pdf,.png,.jpg}
\graphicspath{{./images/}}
\usepackage{floatrow}

\usepackage[font=footnotesize,
format=plain,
labelfont={bf,sf},
nooneline,
textfont={it}]{caption}

\usepackage{subcaption}
\usepackage[twoside]{geometry}
\geometry{a4paper,
left=24.8mm,
top=27.4mm,
textwidth=135mm,
marginparsep=8.2mm,
marginparwidth=28mm
}

\begin{document}

\thisfloatsetup{margins=hangright,capposition=beside,
capbesideposition={top,right},floatwidth=\textwidth}
\begin{figure}
\subcaptionbox{\label{fig:01:054a}}
{\includegraphics[width=0.5\textwidth]{example-image-a}}%
\subcaptionbox{\label{fig:01:054b}}
{\includegraphics[width=0.5\textwidth]{example-image-b}}\\
\subcaptionbox{\label{fig:01:054c}}
{\includegraphics[width=0.5\textwidth]{example-image-c}}\rule{.5\textwidth}{0pt}
\caption{A test figure}\label{fig:01:054}
\end{figure}

\end{document}


-
Doesn't really work here. All images get displayed underneath each other (not only where I inserted a "\\"), and because of that, the whole figure gets pushed to a new left page where the side caption actually should be left, not right (thus I should adjust \thisfloatsetup, I guess, but this doesn't change the stacking of the images). imgur.com/ENzOW4Z Also, the obvious disadvantage with this approach is that I always need to adjust these \thisfloatsetup parameters depending on whether the figure is displayed on a left or right page. Mhhh... – wnstnsmth Aug 5 '13 at 14:14
I found out that when not using \thisfloatsetup (i.e. commenting it out), the images are still stacked on top of each other (also when only using two images). Only when I don't load the floatrow package do I get two images on one line. So weird. – wnstnsmth Aug 5 '13 at 14:23
@wnstnsmth For the first problem: please notice the % character suppressing the spurious blank space at the end of the first \subcaptionbox in my code. You are not using this and that will cause the undesired effect mentioned. – Gonzalo Medina Aug 5 '13 at 14:36
@wnstnsmth For the other remark, please read the package documentation; floatrow is really powerful. You can specify capbesideposition=inside, or capbesideposition=outside for example, to avoid manual specifications for each float. – Gonzalo Medina Aug 5 '13 at 14:38
Regarding the first problem, now I know what % does, thanks. It works now. Regarding the second problem, margins=hangoutside and capbesideposition={top,inside} did the trick. Now I have only one concern left. When using the SCfigure environment, labels are like so: "Figure 1.2: Lorem ipsum", but when using figure, the numbering contains a final point, like so: "Figure 1.2.: Lorem ipsum". I want the latter to be the same as the first (because I will be using figure only for multi-figure panels). Thanks a lot. – wnstnsmth Aug 5 '13 at 15:05