1

I am writing a book in Hebrew (which means Right to Left direction of text) using the book doc class together with the twoside option.

I enlarged the margin paragraph to be 50mm. Now I want the header rule to overhang the outside margin. I followed the example in section 18 of the fancyhdr manual:

\addtolength{\headwidth}{\marginparsep}
\addtolength{\headwidth}{\marginparwidth}

That works fine on English documents, but this is the output I get for the even pages in my (Hebrew) document:

enter image description here

Besides, the margin paragraph is reversed, for some reason.

How do I fix these two things?

The MWE:

\documentclass[twoside]{book}
\usepackage{fancyhdr,lipsum}

\usepackage{geometry}
%%% Page layout
\geometry{%
asymmetric,
left=70mm,
textwidth=130mm,
marginparsep=8mm,
marginparwidth=50mm,

}
\pagestyle{fancy}
\addtolength{\headwidth}{\marginparsep}
\addtolength{\headwidth}{\marginparwidth}

\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}
\chapter{הקדמה}
\begin{english}
\lipsum[1-5]\marginpar{Some margin note goes here}
\lipsum[6-10]\marginpar{Another margin note goes here}
\end{english}
\end{document}

1 Answer 1

3
  1. The twoside and asymmetric options seem to be conflicting, and as twoside is default for the book class, oneside must be explicitly given as document class option.
  2. Both geometry and fancyhdr get confused about left/right in the Hebrew text apparently, so we have to use the opposite: right=70mm instead of left=70mm. And for fancyhdr see below.
  3. Instead of calculating \headwidth, use \fancyhfoffset, but we have to use R instead of L, although the offset is on the left.
\documentclass[oneside]{book}
\usepackage{fancyhdr,lipsum}

\usepackage{geometry}
%%% Page layout
\geometry{%
asymmetric,
right=70mm,
textwidth=130mm,
marginparsep=8mm,
marginparwidth=50mm,
}

\pagestyle{fancy}
% \addtolength{\headwidth}{\marginparsep}
% \addtolength{\headwidth}{\marginparwidth}
\usepackage{calc}
\fancyhfoffset[R]{\marginparsep+\marginparwidth}

\usepackage{polyglossia}
\setdefaultlanguage{hebrew}
\setotherlanguage{english}
\defaultfontfeatures{Scale = MatchUppercase , Ligatures =TeX}
\newfontfamily\englishfont{Latin Modern Roman}[Script=Latin,Language=English]
\newfontfamily\hebrewfont{Arial}[Script=Hebrew]

\begin{document}
\chapter{הקדמ}
\begin{english}
\lipsum[1-5]\marginpar{Some margin note goes here}
\lipsum[6-10]\marginpar{Another margin note goes here}
\end{english}
\end{document}

enter image description here

enter image description here

2
  • The output I get from your MWE is this (I checked it both on my TeXLive '21 and on overleaf.com, same output). I think that you need to change the R in \fancyhfoffset[R]{..} to L. Besides that, I want the body text to be on the right side of the page, and the margin paragraph to be to its left (as it is in my image on the original post). So, as I see it, since the margin paragraph alternates its position, the matter of how to control where it is printed should be asked in a different question.
    – tush
    Commented Apr 5, 2022 at 11:47
  • Your solution indeed works. The alternating placement of the marginal notes is probably due to the \begin{english}..\end{english} environment. With Hebrew Lorem Ipsum text it works fine.
    – tush
    Commented Apr 5, 2022 at 12:43

You must log in to answer this question.

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