1

For the following MWE, I need to understand

1- when I should use the starred version of \babelfont[*arabic] and

2- the differences between/impact of setting the language arabic and the script *arabic.

\documentclass[12pt, a4paper]{article}

\usepackage[tuenc,no-math]{fontspec}
\setmainfont[
Ligatures = {
    NoCommon, % liga
    NoRare,% dlig
}
]{Latin Modern Roman}

\newfontfamily\arabicfont{Scheherazade}[ Script = Arabic, RawFeature={+anum}, Scale = 1]

\usepackage[english, bidi = basic]{babel}
\babelprovide[import, onchar = ids fonts]{arabic}
\babelfont[arabic]{rm}{Scheherazade} % [Scale = 2]{Scheherazade}
\babelfont[arabic]{sf}{Scheherazade}

\parindent=0pt

\begin{document}
    السلام عليكم ورحمة الله وبركاته
\end{document}

1 Answer 1

5

Let’s suppose you are writing a book in French on the Arabic script. Here is a minimal setup:

\documentclass[french]{book}

\usepackage[bidi=basic]{babel}

\babelfont[*arabic]{rm}{Amiri}

\begin{document}

Français \foreignlanguage{arabic}{العربية} français
\foreignlanguage{persian}{فارسی} français
\foreignlanguage{uyghur}{ئۇيغۇرچە} français.

\end{document}

enter image description here

\babelfont[*arabic]{rm}{Amiri} presets the font for all languages using the Arabic script at once. This is what *arabic with the star means. With arabic without the star, only the font for the Arabic language would be preset, and not for Persian or Uyghur. Note I've said preset, because the font is not actually loaded if not necessary.

I’d like to highlight several points:

  • The main language can be set as either a class or a package option. This is the standard way in LaTeX to set the document language. Here I opted for the class option.
  • However, and following the customary practice in many systems, there is usually no need to declare explicitly at the beginning of the document other languages for just a few words or phrases, because they are loaded on the fly if required.
  • There are variations, of course. You may want to declare all languages explicitly, for example. You may also want to create short commands like \textpersian (with \babeltags), but for the reasons explained in the manual (mainly because the \text... prefix is heavily overloaded) this isn’t recommended.
6
  • Very informative! I assume \textparsian should be \textpersian. As you know, I also usually pair Amiri with Khaled Hosny’s other font Libertinus.
    – Davislor
    Commented Jul 6, 2021 at 14:27
  • @Davislor Oops! \textpersian, of course (fixed). Definitely, CM and Amiri don’t match, but it’s a minimal setup, after all 🙂. Commented Jul 6, 2021 at 14:30
  • What is the meaning of using an Arabic script for another language (e.g. French)?
    – Diaa
    Commented Jul 18, 2021 at 14:00
  • @Diaa The Arabic script is used in the Arabic language, Farsi, Urdu... But consider a book written in French explaining how this writing system works. Of course, the French text is written in the Latin script. Commented Jul 18, 2021 at 15:51
  • 1
    @Diaa babel provides complete or partial support for the following languages: Uzbek, Urdu, Uyghur, Turkmen, Pashto, Punjabi, Mazanderani, Northern Luri, Kashmiri, Northern Kurdish, Persian, Central Kurdish, Arabic. Commented Jul 19, 2021 at 14:42

You must log in to answer this question.

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