7

The Tufte-Latex class has an option to place the margin for even pages on the left-hand side and for uneven pages on the right-hand side:

\documentclass[twoside,symmetric]{tufte-book}

but unfortunately some sidenotes are still on the wrong side:

enter image description here

Is there any possibility to avoid this?

EDIT: The problem appears almost always for sidenotes in the first three sentences of a new page. Inserting

\newpage 

or

 \clearpage

by hand above the problematic footnotes solves the problem, but obviously this is a bad solution.

7
  • Margin notes at the top of the page sometimes end up on the wrong side during the initial run of LaTeX. Running it a second time typically corrects the problem. Does that work in your case?
    – godbyk
    Apr 1, 2015 at 17:49
  • @godbyk Thanks for your comment. Unfortunately running Latex several times does not solve the problem
    – jak
    Apr 1, 2015 at 19:47
  • A vaguely remember a package called marginfix which is supposed to improve the behaviour of \marginpar... May be worth a try.
    – cgnieder
    Apr 1, 2015 at 19:51
  • 1
    @clemens marginfix modifies the output routine, I think, and so it may not work with Tufte-LaTeX. You could try the mparhack package, though. (I haven't tested it with Tufte-LaTeX yet.)
    – godbyk
    Apr 1, 2015 at 19:54
  • @clemens unfortunately, as godbyk guessed, there are many errors when I try to run markinfix with the tufte class
    – jak
    Apr 1, 2015 at 20:16

1 Answer 1

11

Because LaTeX's output routine runs asynchronously with TeX's page builder, margin notes can appear on the wrong side of the page when they're near the top of the page.

As LaTeX places margin notes, it looks to see if it's currently on a recto or verso page and places the margin note accordingly. However, TeX may come along after the margin note has been placed and decide to move the margin note (along with a few regular lines of text) to the following page. When TeX moves the material to the next page, the margin note stays in the same position.

The mparhack package works around this problem by adding label to each margin note and recording which page it falls on. When you run LaTeX a second time, it looks at which page the margin note ended up on and adjusts its position accordingly.

To use this package, just load it in the preamble of your document:

\usepackage{mparhack}

and then run LaTeX a couple times (first to record the pages the margin notes landed on, and again to fix misplaced margin notes).

2
  • Nice ! This also corrects the same problem happenning with marginfigure and margintable . Mar 9, 2016 at 14:45
  • @godbyk it's been a minute, but I came across your answer today when I could not get a figure caption to fall on the correct margin side. I'm using R+bookdown to create an intermediate tex file. I posted it here: gist.github.com/ericpgreen/426d107ecd34e5025af03efb2b19e00d. I've loaded \usepackage{mparhack} and run a few times with no luck. Curious if you or anyone sees anything obvious.
    – Eric Green
    Aug 30, 2021 at 13:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .