I am currently working on a new LaTeX layout for a scientific open-access journal. It is a twoside layout wich makes use of marginpars. The special feature is that the frontmatter has a different page layout than the mainmatter.

So I defined a new page layout for the frontmatter with \newgeometry. In the final layout some TeX files will be inserted here (imprint, foreword) as well as the TOC.

Then comes the mainmatter with the original page layout. But using \loadgeometry causes the \marginpar to be placed in the wrong position. I assume that the page break triggered by \loadgeometry causes LaTeX to miscalculate when calculating even and odd page numbers?

Do you have any ideas on how I can work around this problem?

For compiling, I am using LuaLaTeX.

Here is my minimal working example:

\documentclass[fontsize=11pt,paper=a4,twoside,mpinclude]{scrbook}
\usepackage{fontspec}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}

\usepackage{geometry}
%define standard geometry
\geometry{top = 20mm,left = 60mm,right = 25mm,bottom = 20mm,marginparwidth=32.5mm,headsep = \baselineskip}
\savegeometry{standard}

%%new geometry, frontmatter only
\newgeometry{top = 20mm,left = 30mm,right = 40mm,bottom = 20mm,nomarginpar,headsep=\baselineskip}

\usepackage{lipsum}

\begin{document}
\frontmatter
\lipsum[1-3]
\mainmatter
\lipsum[1-3]
\marginpar{\lipsum[1]}
\lipsum[1-3]
\end{document}

• The marginpar falls at page 1, so it's correctly placed on the right. – egreg Jul 30 '19 at 12:03

Welcome to TeX SX! The typographic norm is the have marginal notes in the outer margin (which is usually larger than the inner margin, for obvious reasons), and by default LaTeX follows this rule, no matter what the margin sizes are.
To change this behaviour, just add the switch \reversemarginpar at the beginning of the main matter.