TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

\newcommand\mnote[1]{\marginpar{\ifthispageodd{\raggedright}{\raggedleft} #1}}
\marginline{Hereabouts is some text}
\mnote{Hereabouts is some text}
Notes here
\marginline{Hereabouts is some text}
\mnote{Hereabouts is some text}

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?

marginfix notes aligned wrong

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)
scrlfile.sty    2009/03/25 v3.03 KOMA-Script package (loading files)
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
share|improve this question
up vote 2 down vote accepted

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


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.)

Mismatch of text and note baseline with marginfix package

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.