XeLaTeX and Arabic – Solving Display Issues with Titles and Sections

arabicsectioningxetex

Titles and Sections are not displayed properly in Arabic. They are shown as separated characters while other parts of the document is displayed perfectly.

If I remove \setmainfont[Ligatures=TeX]{Amiri}, nothing gets displayed when it is processed with XeLaTeX besides the text within \begin{arab}, however, \section{التعليمات} is still separated characters.

\documentclass[a4paper,12pt]{article}
\usepackage{fontspec}
\usepackage[pdfauthor={Yousef Raffa},pdftitle={Translation of The ARRL LoTW Registration Instructions in Arabic}]{hyperref}

\usepackage{arabxetex}

\setmainfont[Ligatures=TeX]{Amiri}
\newfontfamily\arabicfont[Script=Arabic,Scale=1.1]{Amiri}

\pagestyle{headings}

\title{ترجمة لتعليمات التسجيل في \textLR{ARRL LoTW}\\ \textLR{Translation of ARRL LoTW Registration
Instructions in Arabic}}
\author{يوسف عدنان رفـّـه\and Yousef A. Raffah}
\date{\today}

\begin{document}
\maketitle
\thispagestyle{empty} % No page number on 1st page

\begin{arab}

\section{التعليمات}

اتبع الخطوات التالية لإتمام عملية إنشاء حسابك الخاص في دفتر سجلات العالم 
\textLR{Logbook of the World}.

\subsection{الخطوة الأولى - تنزيل و تهيئة البرنامج}

دفتر سجلات العالم \textLR{Logbook of the World} يستخدم برنامج اسمه \textLR{TrustedQSL} وهو

\end{arab}
\end{document}

Here is a link to the Amiri font I'm using

UPDATE:

If I \setmainfont[Ligatures=TeX]{Geeza Pro} the output displays titles and sections properly but English characters are squares now and so are section numbers!

Screenshot showing the problem of separated characters
Screenshot of what happens if I remove \setmainfont[Ligatures=TeX]{Amiri}
Screenshot of output when \setmainfont is changed to Geeza Pro

Best Answer

Use polyglossia instead of arabxetex and set the main document language to Arabic and the secondary language to English, for English text you will now have to use \textenglish instead of textLR. Refer to polyglossia package documentation for more details.

\documentclass[a4paper,12pt]{article}
\usepackage[pdfauthor={Yousef Raffa},pdftitle={Translation of The ARRL LoTW Registration Instructions in Arabic}]{hyperref}

\usepackage{polyglossia}
\setmainlanguage{arabic}
\setotherlanguage{english}

\setmainfont[Ligatures=TeX]{Amiri}
\newfontfamily\arabicfont[Script=Arabic]{Amiri}

\pagestyle{headings}

\title{ترجمة لتعليمات التسجيل في \textenglish{ARRL LoTW}\\ \textenglish{Translation of ARRL LoTW Registration
Instructions in Arabic}}
\author{يوسف عدنان رفـّـه\and Yousef A. Raffah}
\date{\today}

\begin{document}
\maketitle
\thispagestyle{empty} % No page number on 1st page

\section{التعليمات}
اتبع الخطوات التالية لإتمام عملية إنشاء حسابك الخاص في دفتر سجلات العالم 
\textenglish{Logbook of the World}.

\subsection{الخطوة الأولى - تنزيل و تهيئة البرنامج}
دفتر سجلات العالم \textenglish{Logbook of the World} يستخدم برنامج اسمه \textenglish{TrustedQSL} وهو
\end{document}
Related Question