11

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

1
  • 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.
    – user2574
    Dec 9, 2011 at 17:07

2 Answers 2

9

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}}
1
  • What about \preto\margincap{\captionsetup{options=margincap}} ? This way \captionsetup[margincap]{...} will have the desired effect.
    – user2574
    Dec 9, 2011 at 17:10
7

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:

enter image description here

\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}
2
  • Sure, but I do not want this setting to be applied to all captions. Dec 9, 2011 at 16:26
  • Wellll...... this request wasn't included in the question.
    – Werner
    Dec 9, 2011 at 17:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .