# Adding Arabic text to an English document

I'm trying to include Arabic text in an English document (I'm a new latex user), but I can't seem to get any Arabic text to render at all, using xelatex or any kind of tex. I'm using texshop 3.51 on a mac. I can't get this basic example to work, it just displays question marks in the output pdf.

\documentclass[12pt]{article}
\usepackage[utf]{arabxetex}
\newfontfamily\arabicfont[Script=Arabic]{Amiri}
\begin{document}
\begin{arab}[voc]
وَهَذِهِ فِقرَةٌ بِالعَرَبِيَة مَعَ كَلِمَة اِنكلِيزِيَة
\end{arab}
\end{document}


I've downloaded Amiri (and also Scheherazade and Lateef) into Fontbook, and they show up if I go Source->Font->Show Fonts in texshop. If I remove the Amiri part it still doesn't work.

Is there anything I can do? I've looked at other links here, like Arabic text with Polyglossia and How write a one-sentence arabic text in a latin document? but I can't even render any of those examples.

Thank you so much for any help! I'll love you forever if I can get this to work.

• This picture shows what I get from your very same code. Apr 16, 2015 at 22:33
• Could I ask you what OS/tex setup you're using? Apr 16, 2015 at 22:38
• Welcome to TeX SE, by the way!
– cfr
Apr 16, 2015 at 23:01
• @peter Mac OS X 10.9, MacTeX 2014 Apr 16, 2015 at 23:03
• Also works on Arch Linux.
– cfr
Apr 16, 2015 at 23:07

This is an issue with TeXShop's file encoding, not XeLaTeX itself.

In Sublime Text, this works fine for me:

% !TEX TS-program = xelatex
\documentclass[12pt]{article}

\usepackage{fontspec}
\newfontfamily\arabicfont{Al Nile}

\begin{document}
\arabicfont وَهَذِهِ فِقرَةٌ بِالعَرَبِيَة مَعَ كَلِمَة اِنكلِيزِيَة
\end{document}


(sorry, I don't have a good Arabic font, I just used a mac default)

TeXShop's settings allow for the encoding to be changed, but I can't seem to make it work. (see here I've selected "Arabic, Hebrew, Persian" and changed the encoding to Unicode UTF-8, which should work in theory, but TeXshop reopens the file with question marks, and therefore passes question marks to XeLaTeX.

I'll keep looking at this, but for the moment as a workaround, you can use a different text editor and then compile inside terminal using xelatex [filename].

## Got it!

The key was to apply the settings as I did in the above screenshot, restart TeXShop, and then reopen the file explicitly with the right encoding, then paste the Arabic in.

When you open the file, make sure the encoding is set here as well:

And then, it works!

## For a new file, make sure to set the encoding here:

Note: These examples are all using my simplified MWE above, not @cfr's suggestion.

• Your arabic sentence is in reverse order you need bidi package and the command \setRTL command to write right to left text like arabic Sep 2, 2016 at 20:24