# Caption in margin not properly positionned

I'm having a peculiar problem: I set up my two-sided document's geometry and captions so that the captions of floats are displayed beside the floats in the margin par. This basically works, but for some reason evenly and unevenly numbered pages show different behaviour.

• Uneven page example:

• Even page example:

As you can see, for uneven pages the caption is not inside it's supposed margins while the figure is nicely centered and for even pages the situation is reversed.

Here is my MWE (I included all packages that I thought could contribute to this problem):

\documentclass[
draft=false,
paper=a4,
paper=portrait,
pagesize=auto,
twoside=true,
fontsize=10pt,
version=last,
parskip=half,
numbers=noenddot,
bibliography=totoc]{scrbook}

\usepackage[
includemp,
paper = a4paper,
top = 25.0mm,
bindingoffset = 5.0mm,
bottom = 32.0mm,
footskip = 15.0mm,
inner = 18.5mm,
outer = 16.5mm,
marginparwidth = 45.0mm,
marginparsep = 7.5mm]{geometry}

\usepackage{showframe}
\usepackage{blindtext}
\usepackage[hypcap=true]{caption}
\usepackage{floatrow}
\usepackage{graphicx}
\usepackage{float}

\floatsetup[figure]{
facing = yes,
margins = hangoutside,
capposition = beside,
capbesideposition = {top, outside},
floatwidth = \textwidth,
capbesidewidth = \marginparwidth,
}

\captionsetup[capbesidefigure]{
format = plain,
}

\begin{document}
%
\begin{figure}[h]
\begin{center}
\includegraphics{example-image-a}
\caption{\blindtext}
\end{center}
\end{figure}
\newpage
%
\begin{figure}[h]
\begin{center}
\centering\includegraphics{example-image-a}
\caption{\blindtext}
\end{center}
\end{figure}
\newpage
%
\end{document}


I'm using xelatex, but it's the same with pdflatex.i

I'm thankful for any suggestions how to solve this problem.

Best regards, Clemens

Looking carefully to the provided images I suspected that the problem may be that the distance separating float and caption is not well adjusted and should be equal to \marginparsep.

A quick search in the floatrow package manual allowed me to discover that this distance can be adapted by means of the capbesidesep.

To set capbesidesepto be equal to \marginparsep the steps are:

1. defining a new separator that can be named e.g. marginparsep using: \DeclareFloatSeparators{marginparsep}{\hskip\marginparsep}

2. adding the key capbesidesep = marginparsep, inside \floatsetup[...]{...} command

!

\documentclass[
draft=false,
paper=a4,
paper=portrait,
pagesize=auto,
twoside=true,
fontsize=10pt,
version=last,
parskip=half,
numbers=noenddot,
bibliography=totoc]{scrbook}

\usepackage[
includemp,
paper = a4paper,
top = 25.0mm,
bindingoffset = 5.0mm,
bottom = 32.0mm,
footskip = 15.0mm,
inner = 18.5mm,
outer = 16.5mm,
marginparwidth = 45.0mm,
marginparsep = 7.5mm]{geometry}

\usepackage{showframe,layout}
\usepackage{blindtext}
\usepackage[hypcap=true]{caption}
\usepackage{floatrow}
\usepackage{graphicx}
\usepackage{float}

\DeclareFloatSeparators{marginparsep}{\hskip\marginparsep}

\floatsetup[figure]{
facing = yes,
margins = hangoutside,
capposition = beside,
capbesideposition = {top, outside},
floatwidth = \textwidth,
capbesidewidth = \marginparwidth,
capbesidesep = marginparsep,
}

\captionsetup[capbesidefigure]
{
format = plain,
}

\begin{document}

%
\begin{figure}[h]
\begin{center}
\includegraphics{example-image-a}
\caption{\blindtext}
\end{center}
\end{figure}
\newpage
%
\begin{figure}[h]
\begin{center}
\centering\includegraphics{example-image-a}
\caption{\blindtext}
\end{center}
\end{figure}
\newpage
%
\end{document}


• @snem pleaed to know that your problem is solved! – Hafid Boukhoulda Jan 26 at 10:58