Arabic/Urdu Typesetting the Easy Way

As the regular readers might know, I’m a big fan and regular user of the LaTeX typsetting system. Keeping to the tradition of occasionally posting a LaTeX tutorial on the blog, here’s one that will be useful to all those that are trying to get up and running with XeTeX — the unicode support adding big brother to the TeX typesetting system. XeTeX basically allows you to use all the Opentype (and other) fonts installed on your system — and it adds unicode support. That means you can use the latest Adobe fonts you’ve got as well as all the Arabic, Urdu, Chinese and Japanese fonts and typeset them as beautifully as you would any Latin script in LaTeX. It’s a hassle to set it up though and you wouldn’t find many tutorials or how-tos on the Internet.

So, here’s one that will allow you to setup and start using XeTeX — especially if you’re trying to find a way to easily typeset Arabic/Urdu. Let’s get started: First, download and install MikTeX 2.7+ (for Windows or any other LaTeX package for your favourite OS). I use 2.8 but I guess you should download the latex (2.9). Everything after 2.6 t has XeTeX built-in. You should download the basic installer from here.

Install also the TeXMaker IDE. We’re going to configure that in a little while to use XeTeX instead of LaTeX. Get the Scheherazade font from the SIL page. You can just extract the zip file anywhere and copy the .ttf file into C:\Windows\Fonts folder. That installs the font required for Arabic typesetting.

Now, fire up TexMaker, go to Options menu and click on ‘Configure Texmaker’. In the Pdflatex section, replace pdflatex with xelatex.

Configure texmaker for XeLaTeX

Create a new file and insert the following code:

\documentclass{article}
\usepackage{arabxetex}
\begin{document}

\begin{arab}[novoc]
mi_tAl: \aemph{45} darajaT
\end{arab}

\end{document}

Before we build, you might need to refresh the font-cache for XeLaTeX (especially if you’ve used it before). For that, go to your MikTeX bin directory and enter the command fc-cache.exe --force. It might take a while but it should run without any errors.

Now, back to Texmaker   and ‘Quick Build’.

Build ArabXeTeX

You should be able to see the output like so:

Arabic Output

During the quick build, you might get a dialog box saying that a certain package is missing and you need to install it. If so, just click ‘Ok’ or ‘Install’ and it will be automatically installed on-the-fly by MikTeX. (You’ll need an internet connection though.) If it simply exits giving some error about a missing .sty file (look at the bottom of the screen for the errors/output messages) — you need to open up the “Package Manager” from the MikTeX folder in the start menu and install that package. For example, if you get the error, “Missing arabxetex.sty”, search for arabxetex package, select it in the list and click on the ‘install button’. Then try to quick build again. Let me know in the comments below if you have any errors and I’ll try to help you out.

Installing MikTeX Packages

Finally, you can look at the original documentation for ArabXeTeX for the details of use. I’ll leave you with another output from the examples in that doc.

Another example output from ArabXeTeX

6 Comments

  1. شكرا لك على المعلومات المفيدة

  2. زبردست جناب

  3. Hi,
    I came across your website through a google search. When I do all the steps you have described and then I do the “Quick Build” I get errors. I’ll list it below. Do you think you can help me here?

    Package arabxetex Warning: \arabicfont\ is not defined!
    I will try to load Scheherazade (scaled 1.5) on input line 6.
    Requested font “Scheherazade/ICU” at 10.0pt
    -> C:/Windows/Fonts/ScheherazadeRegOT.ttf
    ! Undefined control sequence.
    \l_fontspec_hexcol_tl
    \l_fontspec_opacity_tl
    l.6 \begin{document}
    The control sequence at the end of the top line
    of your error message was never \def’ed. If you have
    misspelled it (e.g., `\hobx’), type `I’ and the correct
    spelling (e.g., `I\hbox’). Otherwise just continue,
    and I’ll forget about whatever was undefined.
    ! Undefined control sequence.
    …ec_hexcol_tl \l_fontspec_opacity_tl
    l.6 \begin{document}
    The control sequence at the end of the top line
    of your error message was never \def’ed. If you have
    misspelled it (e.g., `\hobx’), type `I’ and the correct
    spelling (e.g., `I\hbox’). Otherwise just continue,
    and I’ll forget about whatever was undefined.
    ! Undefined control sequence.
    \g_fontspec_hexcol_tl
    \g_fontspec_opacity_tl
    l.6 \begin{document}
    The control sequence at the end of the top line
    of your error message was never \def’ed. If you have
    misspelled it (e.g., `\hobx’), type `I’ and the correct
    spelling (e.g., `I\hbox’). Otherwise just continue,
    and I’ll forget about whatever was undefined.
    ! Undefined control sequence.
    …ec_hexcol_tl \g_fontspec_opacity_tl
    l.6 \begin{document}
    The control sequence at the end of the top line
    of your error message was never \def’ed. If you have
    misspelled it (e.g., `\hobx’), type `I’ and the correct
    spelling (e.g., `I\hbox’). Otherwise just continue,
    and I’ll forget about whatever was undefined.
    \g_fontspec_family_Scheherazade_int=\count187
    ………………………………………….
    . fontspec info: “defining-font”
    .
    . Defining font family ‘Scheherazade(0)’ for font ‘Scheherazade’ with options
    . [Script=Arabic,Scale=1.5].
    ………………………………………….
    ! Undefined control sequence.
    \l_fontspec_hexcol_tl
    \l_fontspec_opacity_tl
    l.6 \begin{document}
    The control sequence at the end of the top line
    of your error message was never \def’ed. If you have
    misspelled it (e.g., `\hobx’), type `I’ and the correct
    spelling (e.g., `I\hbox’). Otherwise just continue,
    and I’ll forget about whatever was undefined.
    ! Undefined control sequence.
    …ec_hexcol_tl \l_fontspec_opacity_tl
    l.6 \begin{document}
    The control sequence at the end of the top line
    of your error message was never \def’ed. If you have
    misspelled it (e.g., `\hobx’), type `I’ and the correct
    spelling (e.g., `I\hbox’). Otherwise just continue,
    and I’ll forget about whatever was undefined.
    ! Undefined control sequence.
    \g_fontspec_hexcol_tl
    \g_fontspec_opacity_tl
    l.6 \begin{document}

    and it goes on and on….

  4. recluze

    November 28, 2011 at 10:08 am

    Please paste your code here: https://gist.github.com/1399851 and drop me a message. I’ll take a look at the code. Keep the code minimal, remove all the unnecessary portions.

    If you don’t have an account on github, create one. If you don’t want to, paste the code in pastebin and send me the link but it will be difficult for you to keep track of the changes in this case.

  5. i followed according your direction but i got this errer. what shoul i do.

    MiKTeX Problem Report
    Message: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

    Data: connect failed in tcp_connect()
    Source: Libraries\MiKTeX\PackageManager\PackageManager.cpp
    Line: 2461
    MiKTeX: 2.9
    OS: Microsoft Windows 7 Home Basic Edition, 64-bit (build 7600)
    Invokers: explorer
    SystemAdmin: no
    PowerUser: no
    Root0: C:\Users\Saila\AppData\Roaming\MiKTeX\2.9
    Root1: C:\Users\Saila\AppData\Local\MiKTeX\2.9
    Root2: C:\ProgramData\MiKTeX\2.9
    Root3: C:\Program Files (x86)\MiKTeX 2.9
    UserInstall: C:\Users\Saila\AppData\Roaming\MiKTeX\2.9
    UserConfig: C:\Users\Saila\AppData\Roaming\MiKTeX\2.9
    UserData: C:\Users\Saila\AppData\Local\MiKTeX\2.9
    CommonInstall: C:\Program Files (x86)\MiKTeX 2.9
    CommonConfig: C:\ProgramData\MiKTeX\2.9
    CommonData: C:\ProgramData\MiKTeX\2.9

  6. I after quick built of
    \documentclass{article}
    \usepackage{arabxetex}
    \begin{document}

    \begin{arab}[novoc] mi_tAl:
    \aemph{45} darajaT
    \end{arab}

    \end{document}
    i got the following error
    ! LaTeX Error: File `arabxetex.sty’ not found.
    Type X to quit or to proceed,
    or enter new name. (Default extension: sty)

    Then i tried to instal arabxetex from progam manager then i got connection problem like following
    MiKTeX Problem Report
    Message: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

    What should i do, please.
    Help me.
    Thank you

Leave a Reply

Your email address will not be published.

*

© 2017 recluze

Theme by Anders NorénUp ↑