2

I am typesetting a full Arabic ONLY book with XeTeX using LaTeXmk, the produced PDF when opened displays pages as if the book opens Left-to-Right as in Latin script, which is wrong, I am not sure what am I doing wrong?

This is the header of my latex file:

% !TEX TS-program = XeLaTeX
\documentclass[a5paper,twoside,openright]{book}
\usepackage{geometry}

\geometry{
b5paper,
total={136mm,210mm},
left=20mm,
top=20mm,
}
\usepackage{polyglossia}
\usepackage{fontspec}
\usepackage[bookmarks=true,
        bookmarksopen,
        bookmarksopenlevel=1,
        colorlinks=true,
        pagebackref,
        linkcolor=green
    ]{hyperref}
 \hypersetup{pdftex,colorlinks=true,allcolors=blue}
 \usepackage{hypcap}
 \usepackage{graphicx}
 \usepackage[RTLdocument]{bidi}
 \usepackage{bidiftnxtra}
 \usepackage{tocloft}

 \renewcommand\cftchapafterpnum{\vskip10pt}
 \renewcommand\cftsecafterpnum{\vskip12pt}

 \setcounter{tocdepth}{2}

 \setmainlanguage{arabic}

 \setmainfont[Script=Arabic]{Amiri}
 \let\arabicfonttt\ttfamily
 \title{\RL{\Huge كتاب عربي}}
 \author{\RL{}}
 \date{\RL{}}
 \rightfootnoterule

 \makeatletter
 \renewcommand{\thesection}{\@arabic\c@section}
 \renewcommand{\thechapter}{\@arabic\c@chapter}
 \renewcommand{\thepart}{\@arabic\c@part}
 \makeatother

 \begin{document}
 \maketitle
 هذا كتاب مكتوب بالعربي كاملا ولا يحوي سوى الحرف العربي
 \end{document}
  • 1
    Welcome, maybe you could complete your code so that people can try to compile it and see what is wrong. It might also help people help you, if you minimize your code (i.e. remove all lines which have nothing to do with your problem, and which are not crucial for compiling the document) – sheß Aug 10 '16 at 10:35
  • Thanks!, I am new to LaTex in general, and all commands used in header are Arabic-related, so I am not sure which might be problematic or missing, that's why I am including the full header :) – Abdullah Abouzekry Aug 10 '16 at 10:56
  • Not a problem and generally a good idea. What you could still do, is remove line-by-line and re-compile it, until you find either the solution to you issue, or a shorter version of the code that still causes the same problem. – sheß Aug 10 '16 at 11:01
  • 1
    polyglossia will load fontspec and bidi automatically. Not likely to be related, but hyperref should be loaded last except for any packages which you particularly know need to be loaded after (e.g. cleveref). – cfr Aug 10 '16 at 12:19
  • 1
    But probably bidi needs to be after hyperref? – cfr Aug 10 '16 at 12:42
1

Old question, but Oh well...

I believe you want to pass the option pdfdirection=R2L to the hyperref package. You can also specify pdfpagelayout=TwoColumnRight to show facing pages.

This preamble creates an A5 R2L document that will open correctly in Adobe Reader (other PDF readers may not work).

\documentclass[12pt]{book}
\usepackage[a5paper]{geometry}
\usepackage{polyglossia}
\usepackage[pdfpagelayout=TwoColumnRight,pdfdirection=R2L]{hyperref}
\setmainlanguage{arabic}
\setmainfont[Script=Arabic]{Amiri}
\begin{document}
...
\end{document}

When I open the resulting PDF up in Adobe Reader, I get this (the Arabic is some random lorem ipsum from the web):

enter image description here

As far as the imposition discussion in the comments above, you should leave this to your printer. So long as they know that it's meant to use right-edge binding, they will do it correctly.

You can create a simple 2up booklet using pdfbook:

pdfbook --signature* '4' R2L.pdf

where --signature* (as opposed to the default --signature) specifies you want right-edge binding.

But this is unsuitable for a 600 page book.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.