I'm writing a book and I'd like to define a command to produce margin notes. I'm using marginpar to place the note, Tikz to add a bit of style and a parbox to make sure the width of the box is consistent across notes. I have reduced the problem to a minimal example that still reproduces the issue:


\usepackage[top=3cm,bottom=3cm, twoside, textwidth=12cm, outer=7cm, marginparsep=1cm, headsep=10pt,a4paper, marginparwidth=2cm]{geometry} % Page margins


\marginpar{\tikz \node[draw, fill=gray, fill opacity=0.2, text opacity=1, inner sep=10pt,   line width=2pt] {\parbox[l][][c]{4.0cm}{\small #1}}; }}


This produces a satisfactory box in the odd pageenter image description here

However the even page is really weird and I can't understand the reason for the placing. Therefore I can not get a nice symmetric result.

enter image description here

Any idea how to produce nice, symmetric and consistent margin notes?

  • Add showframe to the geometry options to understand your problem. – Ulrike Fischer Apr 3 '17 at 21:16

You need to make the marginpar space wide enough for your parbox and tikz decoration, add

\setlength\marginparwidth{\dimexpr 4cm+20pt+4pt}

to the preamble

|improve this answer|||||
  • 1
    Great, that fixed the issue. But I don't quite understand . How does that fixes the problem exactly? Could you develop your answer so that I (we) can diagnose future and similar problems? Thank you! – Onturenio Apr 3 '17 at 22:13
  • @Onturenio there is a specified width for marginpars but you ignored that and added a 4cm parbox, so it does not fit. On the right it just overhangs into thepage border but as long as it fits on the physical page, you don't notice. But on the left it overhands over the page text. – David Carlisle Apr 3 '17 at 22:17
  • @Onturenio you have marginparwidth=2cm as a geometry option, change it, in the way David said, there directly: ...marginparwidth=\dimexpr 4cm+20pt+4pt]{geometry} – CarLaTeX Apr 4 '17 at 2:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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