Closed ghost closed 1 year ago
The section code should read
\section{section name (\textarabic{اسم الفصل})}
shouldn't it?
Does this fix the first problem?
As to the second problem (which includes the wrong parentheses in the section heading): I suppose this is a bidi
bug rather than a polyglossia
bug as it (1.) does not occur if you use luatex and (2.) also occurs without polyglossia
if you load bidi
, see
% !TeX TS-program = xelatex
\documentclass[a4paper, 12pt]{report}
\usepackage{fontspec}
\usepackage{bidi}
\setmainfont[Scale=1, Script = Arabic]{Traditional Arabic}
\begin{document}
\setlatin
\chapter{Chapter name}
\section{section name (اسم الفصل)}
\begin{enumerate}
\item The first item
\end{enumerate}
\end{document}
So maybe also investigate with the bidi
maintainers.
Actually, looking closer I really think this is due to wrong document settings. You are defining a main font with Script=Arabic
, but the main language (English) actually uses Latin script. The wrong script tag causes the irritations.
Define a main font with Latin script and an Arabic font with Arabic script (might be the same font if it features both scripts), and everything works as expected:
% !TeX TS-program = xelatex
\documentclass[a4paper, 12pt]{report}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage[locale=mashriq, numerals=maghrib]{arabic}
\setmainfont{Traditional Arabic}% <-- For English: Latin script here!
\newfontfamily\arabicfont[Scale=1, Script=Arabic]{Traditional Arabic}
\begin{document}
\chapter{Chapter name}
\section{section name (\textarabic{اسم الفصل})}
\begin{enumerate}
\item The first item
\end{enumerate}
\end{document}
Closing this ticket.
Thanks very much.
Small addendum: If you really use the same font and no specific options, the definition of \arabicfont
can be omitted. Polyglossia will try the main font with the correct script tag. Again, the prerequisite is that the font covers the needed script:
% !TeX TS-program = xelatex
\documentclass[a4paper, 12pt]{report}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage[locale=mashriq, numerals=maghrib]{arabic}
\setmainfont[Scale=1]{Traditional Arabic}
\begin{document}
\chapter{Chapter name}
\section{section name (\textarabic{اسم الفصل})}
\begin{enumerate}
\item The first item
\end{enumerate}
\end{document}
Thanks very much. One final thing I can't figure out: In this setting, how can I change the english font? Also, say I want to write some Arabic inside the document "السلام عليكم" in KacstFarsi font (which is different than the global font), how can I do it please?
Thanks very much. One final thing I can't figure out: In this setting, how can I change the english font?
The English font is the main font. So take the example from https://github.com/reutenauer/polyglossia/issues/591#issuecomment-1550806482 (with the \arabicfont
) and simply redefine the mainfont (which is used for English)
Also, say I want to write some Arabic inside the document "السلام عليكم" in KacstFarsi font (which is different than the global font), how can I do it please?
In preamble:
\newfontfamily\altarabicfont[Script=Arabic]{KacstFarsi}
In the document body:
bla bla ... \textarabic{\altarabicfont السلام عليكم}
Thanks very much.
I have the following code to produce a pdf:
The code has 2 problems:
The first section contains english and arabic words. The Arabic are displayed incorrectly.
The enumeration has the dot '.' on the opposite side.