How to typeset arabic with xetex (in Windows) ***************** * Getting xetex * ***************** xetex is a version of latex that ships with standard latex packages like MikTex. To see if xetex is installed, open a command prompt: All programs -> Accessories -> Command prompt then type: xetex You should see: This is XeTeX, Version ... ***************** * Getting Fonts * ***************** In the process below, you'll have to specify an Arabic font to use. You can use any font that you have available in the path C:\WINDOWS\Fonts I like Arabic Transparent Make sure you have something and that you get the name right. If you don't, xetex will choke and throw an error. *********************************** * making a xetex file with arabic * *********************************** xetex files look just like latex files. You'll need to specify a few additional packages -- see the example file below. There are two ways to enter arabic. First, you can type arabic characters into a file that is encoded in UTF-8. The way to do this is to open a text file and save it as UTF-8 format. Then you can just type arabic in, but with one major caveat. When I've tried it, the word order is NOT correct. The letters in the words read right to left, but the words are ordered from left to right. This makes it really hard to just type a sentence because you have to think of all the words backwards! The quick solution I've found is to simply enter the unicode for a space -- \char"0020 -- after each arabic word. It's kind of a pain, but far less painful than (1) trying to enter long chunks of arabic words backwards, or (2) entering ALL of the unicode charachters by hand (which is the second option below). Note that at least some Latex editors change the UTF-8 encoding, which will screw everything up. I usually use LEd for latex editing, but for this, Notepad++ seems to work well and doesn't screw up the encoding. For small bits of arabic in long english documents, I find that its almost easier to just enter the unicode for each character by hand (again, including the space character as well). It's harder to enter the arabic but you don't have to worry about making sure that the file stays encoded in UTF-8, etc. Unicode(s) available from: http://unicode.org/Public/UNIDATA/ArabicShaping.txt %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Begin example document: test.tex \documentclass{article} \usepackage{fontspec} \usepackage{xunicode} \usepackage{xltxtra} \begin{document} \newfontfamily\afont[Script=Arabic]{Arabic Transparent} \section{Arabic Unicode in Latex} Arabic will print here {\afont \char"0625\char"0646\char"0020 \char"0634\char"0627\char"0621\char"0020 \char"0627\char"FDF2}. Good, it did.\\ If you encode this file as UTF-8, you should also get some Arabic here: {\afont اللغة\char"0020 العربي}. If not, you'll just see little boxes. \end{document} %% End example document %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ************* * Compiling * ************* To compile, take the following steps: 1. open a command prompt 2. change the directory to the directory where the .tex file is: cd C:\Documents and Settings\Rich\Desktop 3. At the command line, enter (assuming your file is "test.tex": xelatex test 4. If your document has citations, follow this up with bibtex test 5. If you just ran bibtex, then rerun: xelatex test xelatex test [twice, that's right] 6. Your pdf should be there! ************* * Resources * ************* ** NOT necessarily in order of helpfulness * Unicode characters: http://unicode.org/Public/UNIDATA/ArabicShaping.txt * A great introduction to xetex http://xml.web.cern.ch/XML/lgc2/xetexmain.pdf * A sample file that got me started http://pokristensson.com/unicodelatex.html * This helped when I got stuck somewhere http://www.tug.org/pipermail/xetex/2007-June/006769.html * The fontspec manual http://mirrors.ibiblio.org/pub/mirrors/CTAN/macros/xetex/latex/fontspec/fontspec.pdf * The tex code for the manual above http://www.tex.ac.uk/CTAN/macros/latex2e/contrib/fontspec/fontspec.dtx * Not arabic related, but has great fonts! http://www.tug.dk/FontCatalogue/