5

I'm desperately trying to get a workable setup of margin caption and subfloats. I use mcaption for margin caption which provides an environment which one wraps the inner content of the float in. However, it seems to mess up labels so that I can't refer to figures. The following example illustrates the problem:

\documentclass{scrartcl}
\usepackage{subcaption}
\usepackage{mcaption}
\begin{document}

\begin{figure}
\begin{margincap}
  \begin{subfigure}[b]{.5\linewidth}
    \centering\large A
    \caption{A subfigure}\label{fig:1a}
  \end{subfigure}%
  \begin{subfigure}[b]{.5\linewidth}
    \centering\large B
    \caption{Another subfigure}\label{fig:1b}
  \end{subfigure}
  \caption{A figure}\label{fig:1}
\end{margincap}
\end{figure}

\ref{fig:1b}
\end{document}

Here's a figure of of the output [?? is the unsuccessful \ref ]. illustration

I would appreciate any hints on how to get margin captions and some kind of sub-figures (e.g. subfig/subcaption)

Thanks,

Edit, here's an example where I can't get it to to the outer margin:

\documentclass[twoside]{scrartcl}
\usepackage{scrpage2}

\usepackage{subcaption}
\usepackage{floatrow}
\ohead{outer}
\ihead{inner}
\captionsetup[capbesidefigure]{format=plain}
\floatsetup[figure]{margins=hangoutside,capposition=beside,
capbesideposition={top,right},floatwidth=\textwidth,capbesidewidth=1\marginparwidth}
\pagestyle{scrheadings}
\begin{document}
\begin{figure}
\begin{subfigure}[b]{.5\linewidth}
\centering\large A
\caption{A subfigure}\label{fig:1a}
\end{subfigure}%
\begin{subfigure}[b]{.5\linewidth}
\centering\large B
\caption{Another subfigure}\label{fig:1b}
\end{subfigure}
\caption{A test figure}\label{fig:1}
\end{figure}
\newpage~\newpage
{
\begin{figure}
\begin{subfigure}[b]{.5\linewidth}
\centering\large A
\caption{A subfigure}\label{fig:1a}
\end{subfigure}%
\begin{subfigure}[b]{.5\linewidth}
\centering\large B
\caption{Another subfigure}\label{fig:1b}
\end{subfigure}
\caption{A test figure}\label{fig:1}
\end{figure}
}

\ref{fig:1b}

\end{document}
4

You can use the floatrow package instead of mcaption:

\documentclass{scrartcl}
\usepackage{subcaption}
\usepackage{floatrow}

\captionsetup[capbesidefigure]{format=plain,justification=RaggedRight,
font=small,labelsep=newline}

\begin{document}

{
\floatsetup[figure]{margins=hangleft,capposition=beside,
capbesideposition={top,right},floatwidth=\textwidth,capbesidewidth=1.5\marginparwidth}
\begin{figure}
  \begin{subfigure}[b]{.5\linewidth}
    \centering\large A
    \caption{A subfigure}\label{fig:1a}
  \end{subfigure}%
  \begin{subfigure}[b]{.5\linewidth}
    \centering\large B
    \caption{Another subfigure}\label{fig:1b}
  \end{subfigure}
  \caption{A test figure}\label{fig:1}
\end{figure}
}

\ref{fig:1b}

\end{document}

enter image description here

To obtain captions in the outer margin, you can use the options facing=yes, and capbesideposition={top,outside}:

\floatsetup[figure]{facing=yes,margins=hangoutside,capposition=beside,
capbesideposition={top,outside},floatwidth=\textwidth,capbesidewidth=1.5\marginparwidth}
\captionsetup[capbesidefigure]{format=plain,justification=RaggedRight,
font=small,labelsep=newline}
  • How do I get it to be in the outer margin? I've updated the first post with an example. – Rasmus Sep 5 '12 at 21:37
  • @Rasmus I updated my answer indicating the settings. – Gonzalo Medina Sep 5 '12 at 22:36
  • Thanks, for introducing me to this option. Indeed, floatrow is very nice now. It even seems to respect my komafont settings for labels. – Rasmus Sep 6 '12 at 13:11
  • @Rasmus yes, floatrow is a really nice powerful package; the documentation is somehow hard to read though. – Gonzalo Medina Sep 6 '12 at 13:20

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.