[Tex/LaTex] Wrong behaviour of wrapfigure environment when using “placement = outer”

koma-scriptwrapfigure

I'm trying to place some pictures inside my text using the wrapfig package of Donald Arseneau with KOMAscript of Markus Kohm. The intention is to place the pictures partly in the margin area at the outer side of a twosided document.

According to the package documentation I have to set the placement parameter value to the capital letter O to gain the outside edge–far from the binding, and the overhang parameter to a value of how much the figure should hang out into the margin.

That's what I have done in the attached minimum working example. As you can see in the attached picture, this works fine on odd pages, but the picture is misplaced on even pages.

Additional it seems that the overhang parameter — different from the manual's description — specifies the value how much the figure should hang into the text (not the margin).

Is it my fault, or a bug in the package?

\documentclass[twoside]{scrartcl}

\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{blindtext}

\begin{document}

\section{Hello, World!}
\Blindtext

\begin{wrapfigure}{O}{1cm}
    \includegraphics[width=3cm]{qr}
\end{wrapfigure}
\Blindtext

\blindtext

\begin{wrapfigure}{O}{1cm}
    \includegraphics[width=3cm]{qr}
\end{wrapfigure}
\Blindtext

\end{document}

enter image description here

Best Answer

I can make out that you have seen the manual, but still have a look at this:

enter image description here

Now in this:

\begin{wrapfigure}{O}{1cm}

you haven't specified the overhang but the width as 1cm and putting a picture of width=3cm.

Let us correct it:

\begin{wrapfigure}{O}[1cm]{3cm}

Here overhang is 1cm and total width is 3cm.

The code:

\documentclass[twoside]{scrartcl}

\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{blindtext}

\begin{document}

\section{Hello, World!}
\Blindtext

\begin{wrapfigure}{O}[1cm]{3cm}
    \includegraphics[width=3cm]{example-image-a}
\end{wrapfigure}
\Blindtext

\blindtext

\begin{wrapfigure}{O}[1cm]{3cm}
    \includegraphics[width=3cm]{example-image-b}
\end{wrapfigure}
\Blindtext

\end{document}

enter image description here