2

I am using a translation platform to translate a book. I have no control over which characters the translators input.

Currently, the Egyptian Build fails. With

! Package inputenc Error: Unicode character د (U+062F)
(inputenc)                not set up for use with LaTeX.

See the inputenc package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.97 ...xtit{Version 25 ديس, 2018  01:56:00 م}
                                                   % Printing/edition date
? 
! Emergency stop.
 ...                                              

l.97 ...xtit{Version 25 ديس, 2018  01:56:00 م}
                                                   % Printing/edition date

How can I use Latex for this case? For me, all the answers including "Declare this one unicode character and use \XX" is not an option. Can I use Latex for this?

  • 4
    Welcome to TeX.SX! Use Xe- or LuaLaTeX and choose a suitable font. – TeXnician Dec 25 '18 at 13:08
  • 2
    I thnk LuaTeX and XeTeX are options that might work. – Benjamin McKay Dec 25 '18 at 13:08
  • Thanks for that! Using LuaTex it already builds. Now, I will look for a font. – User Dec 25 '18 at 13:15
  • Btw: You will not be able to use the whole unicode range with a single font. But simply decide for one that covers your language best. Unfortunately, LuaLaTeX in contrast to ConTeXt does not support proper font fallbacks. – TeXnician Dec 25 '18 at 13:20
  • I can vary the font depending on the language. – User Dec 25 '18 at 13:20
5

Since I see from your download page that you’d like to use the Amiri font, you might try something like this template in XeLaTeX. It selects the Libertinus font family (an extension of Linux Libertine by Khaled Hosny, who also designed Amiri, that complements it well) as the corresponding fonts for other languages. You might want to change the document class, or add more packages.

\documentclass[a4paper]{book} % Or scrbook, memoir, etc.
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage[svgnames]{xcolor}
\usepackage[colorlinks,
            linkcolor = orange,
            pdfpagemode = UseOutlines,
            pdflang = ar-EG,
            pdftitle={12 Characters in Search of an Apocalypse},% But in Arabic?
            % pdfauthor, pdfcreator, etc.
            unicode
           ]{hyperref}

\setdefaultlanguage[locale=mashriq]{arabic}
\setotherlanguage{english}

\defaultfontfeatures{ Scale = MatchUppercase }
\setmainfont{libertinusserif}[
    Scale = 1.0 ,
    Ligatures = {Common, TeX} ,
    Numbers = {OldStyle, Proportional} ,
    UprightFont = *-regular ,
    BoldFont = *-bold ,
    ItalicFont = *-italic ,
    BoldItalicFont = *-bolditalic ,
    Extension = .otf ]
\setsansfont{libertinussans}[
    Ligatures = {Common, TeX} ,
    Numbers = {OldStyle, Proportional} ,
    UprightFont = *-regular ,
    BoldFont = *-bold ,
    ItalicFont = *-italic ,
    BoldItalicFont = *-bolditalic ,
    Extension = .otf ]
\setmonofont{libertinusmono}[
    Ligatures = TeX ,
    UprightFont = *-regular ,
    BoldFont = *-bold ,
    ItalicFont = *-italic ,
    BoldItalicFont = *-bolditalic ,
    Extension = .otf ]
\newfontfamily\arabicfont{Amiri}[
    Ligatures = {Common, TeX} ,
    Script = Arabic ,
    Language = Arabic ,
    UprightFont = *-Regular ,
    BoldFont = *-Bold ,
    ItalicFont = *-Slanted ,
    BoldItalicFont = *-BoldSlanted ,
    Extension = .ttf ]

\begin{document}
\chapter{مصر}\label{chapter:1}

مصر , دوله اراضيها ف قارتين الشرق ف شمال افريقيا و الغرب ف غرب اسيا ,اهلها بيتكلموا مصرى , دينها الرسمي الاسلام (الإسم الرسمى للدولة الحالية هو جمهورية مصر العربية من سنة 1971, اسامى الدولة قبل كده كان من ضمنها السلطنة المصرية و المملكة المصرية و الجمهورية المصرية و الجمهورية العربية المتحدة, فيه بيطالبو بالرجوع لإسم الجمهورية المصرية أو جمهورية مصر).

مصر بلد موجوده فى شمال شرق قارة أفريقيا, بيحدها من الشمال البحر المتوسط و من الشرق البحر الأحمر مساحة مصر حوالى مليون كيلومتر مربع. مصر دوله أفريقيه بس فيه حته من أراضيها, اللى هى شبه جزيرة سينا, فى قارة اسيا فعشان كده مصر بتعتبر دولة عابرة للقارات.

مصر ليها حدود من الغرب مع ليبيا و من الجنوب مع السودان و من الشمال الشرقى مع إسرائيل و قطاع غزه, و البحر الأحمر بيفصلها عن الأردن و السعوديه, و قناة السويس اللى بتفصل جزءها اللى فى اسيا عن اللى فى أفريقيا. 

\end{document}

You can insert English paragraphs with \begin{english} and short English phrases with \textenglish{...}, or similar for any other language you need. You can also insert short snippets of the Latin alphabet with \LTE{12 Characters} if you would rather stick with Amiri.

If this is the rare play that needs to typeset mathematical equations, the unicode-math package and the Libertinus Math font do support right-to-left Arabic mathematics, but you’d no doubt have further questions.

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.