# marginfix makes KOMA's \marginline flush towards the outside, rather than the inside?

The marginfix package seems to do something funny to KOMA's \marginline command. Here is an MWE:

\documentclass[mpinclude=true]{scrbook}
\usepackage{lipsum}
\usepackage{marginfix}
\newcommand\mnote[1]{\marginpar{\ifthispageodd{\raggedright}{\raggedleft} #1}}
\begin{document}
\lipsum[1]
\lipsum[3-4]
\vspace{4\baselineskip}
\lipsum[5]
Notes here
\end{document}


Comment out \usepackage{marginfix} and things are flushed left on odd pages, right on even pages like I expected them to be. marginfix seems to reverse this behaviour (things are flushed away from the text block). Is this a bug?

The same thing happens in scrarctcl: marginfix makes things flush right instead of flush left.

What's weird is that if you define your own command to do more or less exactly what \marginline is supposed to do like so:

\newcommand\mnote[1]{\marginpar{\ifthispageodd{\raggedright}{\raggedleft} #1}}


Then things work as expected. What is going on?

Looking at the image closely, the marginfix version isn't even aligned!

In case this is just a package version conflict thing, here's a \listfiles:

 *File List*
scrbook.cls    2009/07/24 v3.04a KOMA-Script document class (book)
scrkbase.sty    2009/07/24 v3.04a KOMA-Script package (KOMA-Script-dependent basics and keyval usage)
scrbase.sty    2009/07/24 v3.04a KOMA-Script package (KOMA-Script-independent basics and keyval usage)
keyval.sty    1999/03/16 v1.13 key=value parser (DPC)
tocbasic.sty    2009/06/08 v3.03b KOMA-Script package (handling toc-files)
scrsize11pt.clo    2009/07/24 v3.04a KOMA-Script font size class option (11pt)
typearea.sty    2009/07/24 v3.04a KOMA-Script package (type area)
lipsum.sty    2005/01/26 v1.0 150 paragraphs of Lorem Ipsum dummy text
marginfix.sty    2010/08/28 v0.9.1 Fix Margin Paragraphs
***********

-

This looks like a bug in the marginfix package to me. (I've reported an issue.)

# Explanation

Several things are happening here at once. First, as stated in the documentation (and can be seen with \show\marginline):

\marginline=\long macro:
#1->\marginpar [\raggedleft {#1}]{\raggedright #1}.


so there is nothing strange with KOMA so to speak. The issue is that the marginfix package "switches" the meaning of the optional (for left margins) and regular (for right margins) arguments of \marginpar. This happens even with the standard article class as can be verified by adding \marginpar[left]{right}.

Your custom solution uses only the single argument form of \marginpar and so is not affected by this bug.

The lack of alignment you see when you look closely is because your \marginparwidth is not wide enough to contain your first word "Hereabouts":

Overfull \hbox (7.3223pt too wide) in paragraph at lines 7--7


If you increase the width by issuing \setlength{\marginparwidth}{1.5\marginparwidth} for example, then you will see that things are indeed aligned.

One other issue you will see if you look really closely is that the way marginfix fixes overflowing notes spoils the alignments of the text baseline and the baseline of the note. This is not a bug per se, but typographically undesirable nonetheless. (Image from the first note higher on the page.)

-