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'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}
share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

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}
share|improve this answer
    
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
add comment

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.