# Center align caption on margin

I am trying to align figure caption on the outer margin with koma-script, but no matter what I tried the option centeredbeside does not work.

\documentclass[captions=centeredbeside]{scrbook}
\usepackage[demo]{graphicx}

\begin{document}
\begin{figure}
\centering
\includegraphics{figure1}
\begin{captionbeside}{Caption beside figure.}[o][0.3\textwidth]
\end{captionbeside}
\label{fig:death-miser}
\end{figure}
\end{document}


Besides, captions always appear on the right margin (not on the outer margin).

I have also tried:

\usepackage[outercaption,wide]{sidecap}
\sidecaptionvpos{figure}{c}


It works better, but the caption is still on the right margin, even if the page is even. I tried using mparhack to fix this but it did not work either.

There are two points that have to be done differently.

1. The \centering command can be dropped.
2. The figure itself has to go into the captionbeside environment.

With a bit more text to show the final alignment this then looks like the following.

\documentclass[
captions=centeredbeside
]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[demo]{graphicx}
\usepackage{blindtext}  % to be deleted in actual document

\begin{document}
\blindtext  % to be deleted in actual document

\begin{figure}[!ht]
\begin{captionbeside}{The quick brown fox jumps over the lazy dog.}[o][0.75\textwidth]
\includegraphics{figure1}
\end{captionbeside}
\label{fig:death-miser}
\end{figure}

\blindtext  % to be deleted in actual document
\end{document}


For the correct outer alignment of all captions you will probably need more than one compiler run as mentioned in the »KOMA-Script« user guide.

Update

As suggested in the comment the »floatrow« package does the job quite well. Note the starred figure* environment.

\documentclass[
captions=centeredbeside
]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[demo]{graphicx}

\usepackage{floatrow}
\floatsetup[widefigure]{
facing=yes,
margins=hangoutside,
capposition=beside,
capbesideposition={center,outside},
floatwidth=\textwidth
}

\usepackage{blindtext}  % to be deleted in actual document

\setcapindent{0pt}

\begin{document}
\blindtext  % to be deleted in actual document

\begin{figure*}[!ht]
\includegraphics{figure1}
\caption{The quick brown fox jumps over the lazy dog.}\label{fig:dummy-1}
\end{figure*}

\blindtext  % to be deleted in actual document

\clearpage
\blindtext  % to be deleted in actual document

\begin{figure*}[!ht]
\includegraphics{figure1}
\caption{The quick brown fox jumps over the lazy dog.}\label{fig:dummy-2}
\end{figure*}

\blindtext  % to be deleted in actual document
\end{document}


For details I suggest to take look at the package manual.

• It works fine, but I still cannot move the caption to the margin (like a marginpar). – Joseph Aug 31 '13 at 15:37
• For captions in the margins you should take a look at the »floatrow« package. But this would make the other mechanism obsolete. – Thorsten Donig Aug 31 '13 at 15:51
• I think for margin captions it is much easier to just use marginpar and captiononf than floatrow-- otherwise, your answer works perfectly for captions inside the text block. – Joseph Aug 31 '13 at 16:29
• @Joseph: Oh, I wouldn't say so. See the update. – Thorsten Donig Aug 31 '13 at 17:40