2

I am trying to write some Arabic using arabi package. Here is the code:

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[LAE]{fontenc}
\usepackage[arabic]{babel}


\begin{document}
\selectlanguage{arabic}
مرحبا
\end{document}

I get a blank page with only Arabic number one at the bottom of the page.

My operating system is macOS Sierra, and I use xelatex from MikTex.

Output:

This is XeTeX, Version 3.14159265-2.6-0.99998 (MiKTeX 2.9.6500)
entering extended mode
(ara.tex
LaTeX2e <2017-04-15>
Babel <3.17> and hyphenation patterns for 1 language(s) loaded.
(/usr/local/share/miktex-texmf/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/share/miktex-texmf/tex/latex/base/size10.clo))
(/usr/local/share/miktex-texmf/tex/latex/base/inputenc.sty

Package inputenc Warning: inputenc package ignored with utf8 based engines.

) (/usr/local/share/miktex-texmf/tex/latex/base/fontenc.sty
(/Users/taha/.miktex/texmfs/install/tex/latex/arabi/laeenc.def)
(/Users/taha/.miktex/texmfs/install/tex/latex/arabi/laecmr.fd))
(/usr/local/share/miktex-texmf/tex/generic/babel/babel.sty
(/usr/local/share/miktex-texmf/tex/generic/babel/switch.def)
*************************************
* Local config file bblopts.cfg used
*
(/Users/taha/.miktex/texmfs/install/tex/latex/arabi/bblopts.cfg)
(/Users/taha/.miktex/texmfs/install/tex/latex/arabi/arabic.ldf
(/usr/local/share/miktex-texmf/tex/generic/babel/babel.def
(/usr/local/share/miktex-texmf/tex/generic/babel/switch.def)
(/usr/local/share/miktex-texmf/tex/generic/babel/xebabel.def
(/usr/local/share/miktex-texmf/tex/generic/babel/txtbabel.def)))

Package babel Warning: No hyphenation patterns were preloaded for
(babel)                the language `Arabic' into the format.
(babel)                Please, configure your TeX system to add them and
(babel)                rebuild the format. Now I will use the patterns
(babel)                preloaded for \language=0 instead on input line 35.

Loading the definitions for the LaTeX{} Arabic encoding
(/Users/taha/.miktex/texmfs/install/tex/latex/arabi/laeenc.def)
Loading the Common definitions for Arabic and Farsi
(/Users/taha/.miktex/texmfs/install/tex/latex/arabi/arabicore.sty
  Arabi Core switching commands v1.0  2006/01/01   (may still change)  )
Loading the Arabi fonts definitions for Arabic
(/Users/taha/.miktex/texmfs/install/tex/latex/arabi/arabicfnt.sty
  Arabic font switching commands v1.0  2006/01/01   (may still change)  )
Loading the Common definitions for Arabic and Farsi
(/Users/taha/.miktex/texmfs/install/tex/latex/arabi/arabnovowel.sty)
*************************************
* Local config file arabic.cfg used
*
(/Users/taha/.miktex/texmfs/install/tex/latex/arabi/arabic.cfg))) (ara.aux

LaTeX Font Warning: Font shape `LAE/lmr/m/n' undefined
(Font)              using `LAE/cmr/m/n' instead on input line 3.

) (/usr/local/share/miktex-texmf/tex/latex/base/ifthen.sty)
(/usr/local/share/miktex-texmf/tex/latex/lm/ot1lmr.fd) [1] (ara.aux)

LaTeX Font Warning: Some font shapes were not available, defaults substituted.

 )
(see the transcript file for additional information)
Output written on ara.pdf (1 page).
Transcript written on ara.log.
5
  • 2
    arabi is for pdflatex, not for XeLaTeX.
    – egreg
    Feb 14, 2018 at 0:21
  • Welcome! You need to specify fonts which support Arabic. Also, don't load fontenc or inputenc. And probably not babel either. Instead, use fontspec, probably by loading polyglossia.
    – cfr
    Feb 14, 2018 at 1:39
  • With xetex, you should use arabxetex. There are many examples of its usage on this site, and there are sample files in the package documentation.
    – Thérèse
    Feb 14, 2018 at 1:45
  • @Thérèse Rather than polyglossia? That's a shame.
    – cfr
    Feb 14, 2018 at 1:55
  • polyglossia works better, thank you all.
    – Taha
    Feb 14, 2018 at 1:55

1 Answer 1

1

Since you are compiling with XeTeX, don't load fontenc or inputenc. You want to use fontspec. Rather than babel, you probably want polyglossia.

Here's a very simple example. You need to specify a suitable font available on your system. On my system, Noto Naskh Arabic supports Arabic.

\documentclass{article}
\usepackage{polyglossia}
\setmainlanguage{arabic}
\newfontfamily\arabicfont[Script=Arabic]{Noto Naskh Arabic}
\begin{document}
مرحبا
\end{document}

Arabic

8
  • 1
    AFAIK, the letters must be connected to each other in this language, so something's wrong with the output since they are detached here.
    – user78499
    Feb 14, 2018 at 2:09
  • @Roboticist I wouldn't know. Is that what arabxetex does (mentioned in the comments)?
    – cfr
    Feb 14, 2018 at 3:13
  • 1
    These letters are connected where they should be. Whether the O.P. should use arabxetex or just this depends in part on the complexity of his document: arabxetex would be overkill if only stray Arabic words are needed.
    – Thérèse
    Feb 14, 2018 at 3:32
  • 1
    I’ve never seen hyphenation in Arabic (search for kashida on this site to see the lovely alternative solution for justification). But you can load polyglossia before arabxetex to get hyphenation in other languages used.
    – Thérèse
    Feb 14, 2018 at 3:41
  • 1
    @Roboticist I assumed polyglossia would set the script, but apparently not (according to the manual). I guess adding it activates the feature responsible for the joining.
    – cfr
    Feb 14, 2018 at 4:16

You must log in to answer this question.

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