2

I'm trying to use arabic script but it seems I run into trouble, the output is just a mess of question marks, literally. I took this code from this page

(I'm on Macbook Pro Yosemite, TeXLive, TeXshop, XeLaTeX etc)

\documentclass{book}

\usepackage{setspace}

\usepackage{fontspec}
\usepackage{polyglossia}

\setmainlanguage{english}
\setotherlanguage{arabic}

\newfontfamily\arabicfont[Script=Arabic,Scale=1.1]{Scheherazade}

\begin{document}

Some latin text and inline arabic: \textarabic{السلام عليكم}

And for larger blocks of text you can use Arabic environment:

\begin{Arabic}

العربية أكثر لغات المجمأعلى الصفحة إلى أسفلها.

\end{Arabic}

To get even spacing between lines, you can use \verb|\lineskiplimit| command (locally or globally, preferably locally) and set spacing with \verb|setspace| or \verb|leading| package to avoid possible overlapping:

\begin{Arabic}
\lineskiplimit=-1000pt
\setstretch{1.2}

العربية أكثر لغات المجموعة السامية متحدثينَ، وإحدى أكثر اللغات انتشارًا في العافارسية والعبرية وعلى عكس الكثير من اللغات العالمية - ومن أعلى الصفحة إلى أسفلها.

\end{Arabic}

\end{document}

The output is

enter image description here

To the best of my knowledge, I have installed the Scherzade font (I see it in other softwares/Pages) but I'm not so sure about the Polyglossia thing. Anyone know how I can fix this?

  • didn't you get an error message that Scheherazade could not be found (or any other warnings in the log) ? – David Carlisle Apr 20 '15 at 14:03
  • 1
    Your example produces this output which I hope is correct (I can't read the Arabic, sorry) – David Carlisle Apr 20 '15 at 14:06
  • No, nothing I immediately can see, it prints out fine. But one thing (that I will also put in the question) is that after restarting TeXshop even the (nonlatin) text that I entered in the main .tex document is turned into a bunch of question marks. Don't know why. – Your Majesty Apr 20 '15 at 14:08
  • 2
    You need to give us some hints preferably the full log file that you get added to your question in a code block. Also make sure that your file is saved as UTF-8. – David Carlisle Apr 20 '15 at 14:10
  • 1
    @Love Learning To use the UTF-8 Unicode encoding on a per-file basis, you can insert the magic comment % !TEX encoding = UTF-8 Unicode at the beginning of your file. And if you want to use this encoding as a default for all your subsequent files, you can either use this line systematically (e.g. via a template) or open TeXShop's Preferences, its Document panel, and there select “Unicode (UTF-8)” in the “Encoding” section. – Franck Pastor Apr 20 '15 at 14:24
8

Probably your file is not saved in UTF-8 encoding. Apparently TeXshop allows you to put

% !TEX encoding = UTF-8 Unicode

as the first line, although since it's now the 21st Century you should probably make that the editor default. This can be done in the main preferences of TeXShop in the Source panel (Encoding).

To summarize:

  • Install polyglossia (which should be installed in a full TeXLive (MacTeX))
  • install whichever fonts you fancy (Scheherazade for example)

Fonts in the Mac are installed in /Library/Fonts. The easiest way to do this is to use the Go menu in the finder, and enter /Library/Font when prompted. This will open the appropriate folder, and you can just drag the fonts into it.

Go to your TeX Editor preferences and make it

  • save things in UTF-8 Encoding!
  • Use XeLaTeX

Now you can type stuff in Kurdi/كوردی(Sorani/سۆرانی) and it should work out fine.

  • Thanks for your answer @David Carlisle Please review my edits, I tried adding some content for future users. Cheers. – Your Majesty Apr 20 '15 at 15:27
  • @LoveLearning This is not generally how fonts are installed in OS X. They typically go into /Library/Fonts. – Alan Munn Apr 20 '15 at 16:21
  • @AlanMunn I did wonder but not having a Mac decided to let the OP's edit through, feel free to edit if it's wrong! – David Carlisle Apr 20 '15 at 16:23

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.