4

I'm writing in English about Arabic collocations, quoting both English and Arabic sources. As there are many sources, I use a sectioned bibliography, filtering for keywords with biblatex, where each sections consists of either only English or only Arabic sources.

Using XeTeX and polyglossia, the main language of my document is English, so I have to switch to Arabic for the Arabic sections of my bibliography. This works partially insofar as the section is right-to-left, but the Arabic letters are disconnected.

Garbled output

Disconnected letters

Minimal (not) working example

\documentclass[12pt]{article}
\usepackage{fontspec}
\usepackage{csquotes}
\setmainfont[Mapping=tex-text]{Amiri}
\setsansfont[Mapping=tex-text]{Amiri}

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

\usepackage{filecontents}
\begin{filecontents}{refs_test.bib}
@Article{Ghazala1993,
  author       = {غزالة, حسن},
  title        = {ترجمة المتلازمات اللفظية (عربي-انجليزي)},
  journaltitle = {ترجمان},
  year         = {1993},
  keywords     = {arabic},
}
@Book{Baalbaki1987,
  author    = {Baalbaki, Munir},
  title     = {Al-Mawrid: A Modern Arabic-English Dictionary},
  year      = {1987},
  publisher = {Dar al-'Ilm li'l-Malayin},
  address   = {Beirut},
  keywords  = {english}
}
\end{filecontents}

\usepackage[style=authoryear,backend=biber]{biblatex}
\addbibresource{refs_test.bib}

\usepackage{xunicode}

\begin{document}

Sample enumeration:
\begin{enumerate}
\item first
\item second
\end{enumerate}

\section{References}

\nocite{*}

\printbibliography[keyword={english}, title={English Dictionaries}, heading=subbibliography]
\selectlanguage{arabic}
\printbibliography[keyword={arabic}, title={قواميس عربية}, heading=subbibliography]

\end{document}

NB: I am aware of the following questions, which deal with related but different problems:

Edit: Adding Script=Arabic as suggested by Salim Bou

Using

\setmainfont[Mapping=tex-text,Script=Arabic]{Amiri}
\setsansfont[Mapping=tex-text,Script=Arabic]{Amiri}

makes the letter get connected, but seems to turn the document from LTR to RT: In enumerations, for example, the numbers are preceded by points, not the other way around. (To make this point clear, I added an enumeration to the MWE and updated the images.)

enter image description here

  • 2
    Just change \setmainfont[Mapping=tex-text]{Amiri} to \setmainfont[Mapping=tex-text,Script=Arabic]{Amiri} same for \setsansfont – Salim Bou Dec 15 '16 at 17:34
  • @SalimBou: Thanks for the suggestion. I tried it out, but it seems to make the whole document RTL - I updated my question accordingly. – Mirko Vogel Dec 15 '16 at 23:10
  • 1
    What about surrounding your Arabic text in the bib file and document with \textarabic{}? e.g., author = {\textarabic{غزال, حسن}} You might also have to create an arabic csquotes style to get the quotation marks right. And you will probably need various sort fields to make sure your bibliography (and index) is sorted correctly. – David Purton Dec 16 '16 at 0:34
  • @DavidPurton: That's the approch suggested in Arabic bibliography with biblatex. But it's a very hacky way to add formatting markup to bib file ... especially since biblatex is able to produce a somewhat correct bibliography without this markup when the document's main language is Arabic. (Only somewhat: As you mentioned, quotation marks are wrong and some strings, like "In" for articles, need to be translated.) – Mirko Vogel Dec 16 '16 at 9:12
  • 2
    As suggested by Salim Bou, change your main font... but locally: {\setmainfont[Mapping=tex-text,Script=Arabic]{Amiri} \setsansfont[Mapping=tex-text,Script=Arabic]{Amiri}\selectlanguage{arabic}\printbibliography[keyword={arabic}, title={قواميس عربية}, heading=subbibliography]} – Paul Gaborit Dec 16 '16 at 9:44
4

As suggested by Salim Bou, change your main font... but locally using {...}:

{
   \setmainfont[Mapping=tex-text,Script=Arabic]{Amiri}
   \setsansfont[Mapping=tex-text,Script=Arabic]{Amiri}
   \selectla‌​nguage{arabic}
   \print‌​bibliography[keyword‌​={arabic}, title={قواميس عربية}, heading=subbibliography]
}

enter image description here

Whole document:

\documentclass[12pt]{article}
\usepackage{fontspec}
\usepackage{csquotes}
\setmainfont[Mapping=tex-text]{Amiri}
\setsansfont[Mapping=tex-text]{Amiri}

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

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Article{Ghazala1993,
  author       = {غزالة, حسن},
  title        = {ترجمة المتلازمات اللفظية (عربي-انجليزي)},
  journaltitle = {ترجمان},
  year         = {1993},
  keywords     = {arabic},
}
@Book{Baalbaki1987,
  author    = {Baalbaki, Munir},
  title     = {Al-Mawrid: A Modern Arabic-English Dictionary},
  year      = {1987},
  publisher = {Dar al-'Ilm li'l-Malayin},
  address   = {Beirut},
  keywords  = {english}
}
\end{filecontents}

\usepackage[style=authoryear,backend=biber]{biblatex}
\addbibresource{\jobname.bib}

\usepackage{xunicode}

\begin{document}

Sample enumeration:
\begin{enumerate}
\item first
\item second
\end{enumerate}

\section{References}

\nocite{*}

\printbibliography[keyword={english}, title={English Dictionaries}, heading=subbibliography]

{
  \setmainfont[Mapping=tex-text,Script=Arabic]{Amiri}
  \setsansfont[Mapping=tex-text,Script=Arabic]{Amiri}
  \selectlanguage{arabic}
  \printbibliography[keyword={arabic}, title={قواميس عربية}, heading=subbibliography]
}
\end{document}

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.