Arabic
The Arabic language 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
:
maparabic
does it at the TeX level, by redefining\arabic
. Note the form written to the auxiliary files is the converted one. It works withxetex
, too.mapdigits
does it at the engine level. This is usually the preferred method.
Calendars
Two calendar are defined: islamic-civil
(arithmetical) and
islamic-umalqura
. Since the main aim is to provide a suitable
\today
, and maybe some close dates, data for islamic-umalqura
just
cover Hijri ~1435/~1460 (Gregorian ~2014/~2038). They can be adjusted
with +
, -
after the name (and ++
, --
in the Civil calendar), so
that, for example, with islamic-civil+
a day is added.
The default calendar, which applies to \today
, can be set in the
following way:
\babelprovide[import, calendar=islamic-civil]{arabic}
If the default calendar is Gregorian, you can convert and print it as follows:
\localedate[calendar=islamic-civil, convert]{\year}{\month}{\day}
Following the CLDR, the default calendar is gregorian
in all regions
except in Saudi Arabia, where it’s islamic-umalqura
.
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 pdftex
is provided by the external package
arabi
, which has been devised for
documents written in Arabic.
For a few words or sentences (unvowelized) in a non-Arabic document, you may prefer to set the language on the fly as shown in the following example (≥3.84):
\documentclass{article}
\usepackage[bidi=default, ngerman]{babel}
\usepackage[LAE, T1]{fontenc}
\begin{document}
Eine Präposition (\foreignlanguage{arabic}{حرف}) ist per Definition
\foreignlanguage{arabic}{مبني}.
\end{document}
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).