# How to align margin notes in even pages

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:

\documentclass[11pt,fleqn]{book}

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

\usepackage{lipsum}
\usepackage{tikz}

\newcommand\note[1]{
\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}}; }}

\begin{document}
\note{\lipsum[1]}
\lipsum[1-7]
\note{\lipsum[1]}
\end{document}


This produces a satisfactory box in the odd page

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.

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

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

• @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