I think that the source of that deviation is from the fact that bidi
changes the value of \oddsidemargin
. Note that by default marginnote
should be touching the right border of the marginpar
part. Here is a quick patch that should solve your particular case
%!TEX TS-program = xelatex
\documentclass[oneside,leqno,fleqn]{book}
\usepackage{marginnote}
\usepackage{regexpatch}
\makeatletter
\xpatchcmd{\@mn@@@marginnote}{\else\kern\oddsidemargin}{%
\else
\@mn@if@RTL{%
\kern\dimexpr\mn@pagewidth-\marginnotetextwidth-\oddsidemargin-2in\relax
}{%
\kern\oddsidemargin
}%
}{}{}
\makeatother
\usepackage{geometry}
\geometry{%
left=70mm,
textwidth=130mm,
marginparsep=8.2mm,
marginparwidth=50mm,
showframe
}
\usepackage{polyglossia}
\setdefaultlanguage{hebrew}
\setotherlanguage{english}
\defaultfontfeatures{Scale = MatchUppercase , Ligatures =TeX}
\newfontfamily\englishfont{Latin Modern Roman}[Script=Latin,Language=English]
\newfontfamily\hebrewfont{David CLM}[Script=Hebrew]
\begin{document}
לורם איפסום דולור סיט אמט.
\marginnote{זו הערה שצריכה להופיע בשולי הדף}
\end{document}

With lualatex
you wont get this deviation
%!TEX TS-program = lualatex
\documentclass[oneside,leqno,fleqn]{book}
\usepackage{marginnote}
\usepackage{geometry}
\geometry{%
right=70mm, %<-- note the change
textwidth=130mm,
marginparsep=8.2mm,
marginparwidth=50mm,
showframe
}
\usepackage{polyglossia}
\setdefaultlanguage{hebrew}
\setotherlanguage{english}
\defaultfontfeatures{Scale = MatchUppercase , Ligatures =TeX}
\newfontfamily\englishfont{Latin Modern Roman}[Script=Latin,Language=English]
\newfontfamily\hebrewfont{David CLM}[Script=Hebrew]
\begin{document}
לורם איפסום דולור סיט אמט.
\marginnote{זו הערה שצריכה להופיע בשולי הדף}
\end{document}
\rlap
so it has zero width and sticks out on one side, but it's getting the wrong side in rtl contexts by the look of it.\if@RTL
, which is not the case here, as the problem happens only withxelatex
+bidi
. See my answer.