# marginnote + pagenumbering = ⚡

Consider the following code (earlier, I considered it minimal, at least on my machine, but see the answer of @daleif)

\documentclass{svmono}
\usepackage[paperwidth=168mm,paperheight=240mm,height=210mm,width=144mm,includehead=true,includemp=true,showframe]{geometry}%%% That's what Springer sometimes wants
\usepackage{newtxtext}%%% They want times
\usepackage{marginnote}
\usepackage{todonotes}%%% For the draft version
\begin{document}
FOO
\todo[inline]{\footnotesize FOO}
\todo[inline]{\footnotesize FOO}
\todo[inline]{\footnotesize FOO}
\todo[inline]{\footnotesize FOO}
\todo[inline]{\footnotesize FOO}
\todo[inline]{\footnotesize FOO}
\todo[inline]{\footnotesize FOO}
\todo[inline]{\footnotesize FOO}
\todo[inline]{\footnotesize FOO}
\begin{itemize}
\item FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR
\item FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR
\begin{itemize}
\item FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR
\item FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR
\item FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR
\item FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR
\end{itemize}
\begin{enumerate}
\item FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR
\item FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR
\item FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR
\item FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR
\end{enumerate}
\item FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO BAR FOO
\item line
\item line
\item line
\item line
\item line
\item line
\item line
\item line
\item line
\item line
\item line
\end{itemize}
\pagenumbering{roman}
\newpage\strut
\vspace{122ex}
\begin{tabbing}
The last line of tabbing. The margin note is not at the right place:\marginnote{MARGIN NOTE}
\end{tabbing}
\end{document}


Here, svmono is Springer's book class available from https://www.springer.com/gp/authors-editors/book-authors-editors/manuscript-preparation/5636 in version 5.5. Marginnote has been tested in versions 1.3 and 1.4.

In the output produced by latex (yes, I re-run it MANY times) the last page looks wrong:

Particularly, the argument of \marginnote is NOT in the margin. You get the same overlap after compiling with pdflatex. The same issue occurs if you replace the tabbing environment by, say, $The last line of tabbing. The margin note is not at the right place:\marginnote{MARGIN NOTE}$. Any help? Any bugfix?

The author of maginnote has not been very helpful so far.

Concerning whether this bug occurs with article in place of svmono, see the answer of @daleif.

• Did you compile more than once? Marginnote takes several compilations before it is lead in the margins. The first compilation usually looks like this. – daleif Jul 20 '18 at 18:19
• Does it work with article instead of svmono? – daleif Jul 20 '18 at 20:46
• This does not happen with current release 1.4a. – Schweinebacke Jul 21 '18 at 14:13

To recap, the issue here is not related to svmono or geometry, the culprit is \pagenumbering and the twoside option (which svmono loads).

In marginnote there is a separate page counter added to the output routine. It supports twoside just fine, under the assumption that that the page layout goes right hand/odd page layout then a left hand/even page layout etc, but in this example

\begin{document}
text, sheet 1
\newpage
text, sheet 2
\pagenumbering{arabic}
\newpage
text, sheet 3
...


On sheet 2, \pagenumering{arabic} changes the page number display to numbers (which it already was), but more importantly resets the page counter to 1.

This means that in latex terms sheet 1 and sheet 2 will both be odd pages and will get an odd page layout.

So now we have odd, odd, even, odd, even, which is not what the marginnote algorithm is assuming

Reccomendation: make sure any use of \pagenumbering, either direct or indirect (for example through \frontmatter) is done on an odd page, aka insert a \cleardoublepage before if necessary.

From earlier:

Too long for a comment, it is not related to svmono, here is a much smaller MWE:

%\documentclass{svmono}
\documentclass[twoside]{article}
\usepackage[
paperwidth=168mm,
paperheight=240mm,
%height=210mm,
%width=144mm,
textwidth=117mm,
textheight=191mm,

\marginparwidth=3cm
\usepackage{marginnote}
\begin{document}
F

\newpage

F

\pagenumbering{arabic}
\newpage\strut
\vspace{122ex}
FFFFFFFFFFFFFFFFFFFFFFF%
FFFFFFFFFFFFFFFFF%
\marginnote{MARGIN NOTE}
\end{document}


My guess is that we are too close to a page break so the checking mechanism in marginnote gets the page wrong. If you place sheet 2 just over sheet 3, you'll see the the note is placed correctly but for the margin on the preceeding page.

Note that the effect goes way if you remove \pagenumbering so I'm guessing that also have something to do with it.

Oh, bugger, marginnote has its own counter that keeps track of the sheet we are on. It just counts along in the output routine. Note we are in twoside mode, marginnote can handle that, but because of the \pageenumbering we now have two consecutive right hand pages, and that confuses the placement algorithm.

Here is an even shorter MWE:

%\documentclass{svmono}
\documentclass[twoside]{article}
\usepackage[showframe]{geometry}
\usepackage{marginnote}
\marginparwidth=3cm
\begin{document}
F

\newpage

F

\pagenumbering{arabic}
\newpage

\noindent
\rule{\textwidth}{1pt}%
\marginnote{MARGIN NOTE}
\end{document}


My suggestion: don't use \pagenumbering directly, for a book you should use \frontmatter and \mainmatter instead.

If you use \pagenumberingthen make sure to combine it with \cleardoublepage (before it), to ensure that the new page "1" is on a right hand page.

• @user49915 it has nothing to do with svmono or geometry it is marginnote vs pagenumbering + twoside – daleif Jul 20 '18 at 21:44
• @user49915 yes, but we combine it with the cleardoublepage such that the new stuff starts on a right hand page. And normally in a book you'd use frontmatter and mainmatter not pagenumbering, svmono supports both – daleif Jul 20 '18 at 21:49
• @user49915 you see now why a full example is important. Hyperref was never mentioned. Then correct, pagenumbering is a good trick, I use it myself, but I'd still like to see the real life example where you have placed a margin note in relation you the skeleton you mentioned – daleif Jul 20 '18 at 22:00
• At least replace that alph line by cleardoublepage, I think that will help. Then the toc will be on sheet three and not sheet 2, and the marginnote algorithm will be back in order – daleif Jul 20 '18 at 22:06
• @user49915 I don't agree, there are conventions in document design. If users want things like that, then they will have to deal with things not behaving like they used to. – daleif Jul 20 '18 at 22:49