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.
Best Answer
This is an issue with TeXShop's file encoding, not XeLaTeX itself.
In Sublime Text, this works fine for me:
(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
usingxelatex [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.