View on GitHub

Babel

The multilingual framework to localize LaTeX, LuaLaTeX, XeLaTeX

Arabic

Arabic is available for pdftex, xetex, and luatex, but the preferred engine is the latter, because of its unique features for bidirectional texts, not requiring explicit mark up.

The recommended basic settings for a monolingual Arabic document in luatex is (please, note your browser might not be rendering correctly the source code):

\documentclass{article}

\usepackage[arabic, provide=*, bidi=basic, layout=counters.tabular]{babel}
\babelfont{rm}[Renderer=Harfbuzz]{FreeSerif}

\begin{document}

الموسيقى أو الموسيقا هي فن مؤلف من الأصوات والسكوت عبر فترة زمنية،
ويعتقد العلماء بأن كلمة الموسيقى يونانية الأصل، وقد كانت تعني سابقا
الفنون عموما غير أنها أصبحت فيما بعد تطلق على لغة الألحان فقط.

\end{document}

There is a complete example (with tables, columns, a figure, a description, etc.) in the repository (tex, pdf). It uses the tentative algorithm for justification with kashida.

Counters

Numerals are best entered directly in the desired form, but you may still need some conversion because LaTeX uses internally the Western Arabic ones. With luatex there are two ways to map the latter to the locale numerals, passed as option to \babelprovide:

Transliteration

The transform transliteration.dad applies the transliteration system devised by Yannis Haralambous for dad. Not yet complete, but sufficient for many texts.

This method to enter Arabic can be useful if you only need a few words in this language:

\documentclass{article}

\usepackage[bidi=basic, ngerman]{babel}
\babelprovide[transforms = transliteration.dad]{arabic}
\babelfont{rm}{FreeSerif}

\begin{document}

Eine Präposition (\foreignlanguage{arabic}{Harof}) ist per
Definition \foreignlanguage{arabic}{maboniY+}.

\end{document}

pdftex

Arabic support in pdftexis provided by the external package arabi, which has been devised for documents written in Arabic.

For a few words or sentences in a non-Arabic document, you may prefer to declare a language from scratch in the following way:

\usepackage[bidi=default, english]{babel}
\usepackage[LAE, T1]{fontenc}
\babelprovide{arabic}
\addto\extrasarabic{\fontencoding{LAE}\selectfont}
\addto\noextrasarabic{\fontencoding{T1}\selectfont}

Then \foreignlanguage and \selectlanguage can be used in the usual manner, but very likely you will need some manual intervention (for example, numerals). Sadly, with this procedure text cannot be copy-pasted (and cmap works only to some extent).