[Tex/LaTex] captionsetup for margin caption

captionsmarginpar

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:

enter image description here

Best Answer

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}}