2

First can I note this previous similar question -- Marginnote with geometry package -- the answer to that mis-diagnoses the cause of the problem, but gives a correct solution for memoir users.

If I use marginnote (not in memoir this time), and change the geometry, marginals are mis-set in the changed geometry. Marginpar works fine. This looks like a bug to me. How can I get marginnote to work well with geometry.

\documentclass{article}
\usepackage{marginnote}

\usepackage{geometry}
\geometry{left=2.0cm,right=3.0cm,top=2.25cm,bottom=2.25cm,heightrounded,headheight=11pt,marginparwidth=2.0cm,marginparsep=0.2cm,a4paper}

\begin{document}

%page 1
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua.%
\marginnote{
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut}
%page 2 (marginpar works fine)
\newgeometry{right=5.0cm,marginparwidth=3.5cm,marginparsep=0.3cm}

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut%
\marginnote{
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut}
%page 3
\restoregeometry

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua.%
\marginnote{
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut}

\end{document}

enter image description here

1 Answer 1

6

You must tell marginnote the changed textwidth:

\documentclass{article}
\usepackage{marginnote}
\usepackage{lipsum}
\usepackage{geometry}
\geometry{left=2.0cm,right=3.0cm,top=2.25cm,bottom=2.25cm,heightrounded,headheight=11pt,marginparwidth=2.0cm,marginparsep=0.2cm,a4paper}

\begin{document}

%page 1
\lipsum[1] 
\marginnote{\lipsum*[1]}

\newgeometry{right=5.0cm,marginparwidth=3.5cm,marginparsep=0.3cm}
\edef\marginnotetextwidth{\the\textwidth}

\lipsum[1]
\marginnote{\lipsum*[1]}


\restoregeometry
\edef\marginnotetextwidth{\the\textwidth}

\lipsum[1]
\marginnote{\lipsum*[1]}

\end{document}
1
  • This solution works fine with the default right-hand margin notes, but not if one had issued \reversemarginpar (while in the original page geometry) to get left-hand margin notes. Some cursory testing suggests that simply issuing another \reversemarginpar command after the \edef\marginnotetextwidth{\the\textwidth} command may fix this, though I haven't rigorously tested this.
    – Psychonaut
    Commented Aug 11, 2020 at 12:13

You must log in to answer this question.

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