# captionsetup for margin caption

I am using the caption package to set up the layout of my captions. However for margin captions using mcaption package the \captionsetup does not seem to have the expected effect.

\documentclass{scrbook}
\usepackage{graphicx}
\usepackage{caption}[2011/08/06]
\usepackage{mcaption}
\usepackage{float}
\usepackage{ragged2e}
\captionsetup{format=plain}
\captionsetup[margincap]{name=Fig.,
indention=0pt,justification=RaggedRight}
\begin{document}

Pellentesque mollis nunc sed mauris tempor molestie. Aliquam adipiscing nisi

\begin{figure}[H]
\begin{margincap}
\centering
\includegraphics[width=0.4\textwidth]{images/TestBild}
\caption[short caption text]{long caption text with some more
text and a bit more text and a little more text to fill space.}
\label{fig:picmargincap}
\end{margincap}
\end{figure}

Pellentesque mollis nunc sed mauris tempor molestie. Aliquam adipiscing nisi
\end{document}


The 'Figure' should be abbrevitated to 'Fig.' but it is not:

-
You can even say \captionsetup[sesame street]{...} but this will only save the sesame street options for later use. As long as no-one is calling \caption@setoptions{sesame street} or \captionsetup{options=sesame street} this will have no effect. So if you would like to get this work I would drop a mail to the mcaption package maintainer, asking for inserting something like \@ifundefined{caption@setoptions}{}{\caption@setoptions{margincap}} into his package. –  Axel Sommerfeldt Dec 9 '11 at 17:07

margincap is not a floating environment:

\begin{figure}
\captionsetup{name=Fig.,
indention=0pt,justification=RaggedRight}
\begin{margincap}
\centering
\includegraphics[width=0.4\textwidth]{images/TestBild}
\caption[short caption text]{long caption text with some more
text and a bit more text and a little more text to fill space.}
\label{fig:picmargincap}
\end{margincap}
\end{figure}


With

\usepackage{mcaption}
\usepackage{etoolbox}
\preto\margincap{\captionsetup{name=Fig.,%
indention=0pt,justification=RaggedRight}}


you can avoid setting the modification in the figure environment.

Following Axel Sommerfeldt's suggestion, one can better define a new option:

\usepackage{caption}
\usepackage{mcaption}
\usepackage{etoolbox}
\preto\margincap{\captionsetup{options=margincap}}

\captionsetup[margincap]{name=Fig.,%
indention=0pt,justification=RaggedRight}}

-
What about \preto\margincap{\captionsetup{options=margincap}} ? This way \captionsetup[margincap]{...} will have the desired effect. –  Axel Sommerfeldt Dec 9 '11 at 17:10

mcaption's margincap uses the same counter as the traditional figure environments, namely figure. From the package documentation (p 1, section 2 Usage):

Caption text and the label are taken from \caption and \label commands within the environment.

As such, the following produces the desired result:

\documentclass{scrbook}
\usepackage[demo]{graphicx}
\usepackage{caption}[2011/08/06]
\usepackage{mcaption}
\usepackage{float}
\usepackage{ragged2e}
\captionsetup{format=plain}
\captionsetup[figure]{name=Fig.,
indention=0pt,justification=RaggedRight}
\begin{document}

Pellentesque mollis nunc sed mauris tempor molestie. Aliquam adipiscing nisi

\begin{figure}[H]
\begin{margincap}
\centering
\includegraphics[width=0.4\textwidth]{images/TestBild}
\caption[short caption text]{long caption text with some more
text and a bit more text and a little more text to fill space.}
\label{fig:picmargincap}
\end{margincap}
\end{figure}

Pellentesque mollis nunc sed mauris tempor molestie. Aliquam adipiscing nisi
\end{document}

-
Sure, but I do not want this setting to be applied to all captions. –  Matthias Pospiech Dec 9 '11 at 16:26
Wellll...... this request wasn't included in the question. –  Werner Dec 9 '11 at 17:09