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:WindowsFonts 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:


mi_tAl: aemph{45} darajaT


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

Eclipse, Java, C++, Lisp, LaTeX and Isabelle

I’ve recently re-discovered Eclipse. My first encounter with it was back when I was learning Prolog. I worked with it and while I liked the work-flow, I never got to using it full-time. It’s back and it’s staying.

Most people may think of Eclipse as simply a Java IDE but there’s a lot more to it that just that. Eclipse is at heart, a plugin framework and is very very extensible. Let me tell you why:

I’ve configured Eclipse to work as my primary C++ IDE, as my primary Lisp IDE, as my thesis word processor using LaTeX and am working on using it for as my Java IDE too. Now, I may be wrong but there’s no other IDE which can do all this.

As an example, see how easy it is to get Lisp working in Eclipse on Linux.

  • Download CUSP plugin for Eclipse
  • Extract the contents of the archive
  • Copy the folder jasko.tim.lisp to the plugins folder of Eclipse
  • The Lisp distro used is SBCL which sits in the sbcl sub-folder
  • Create a symbolic link to sbcl executable in someplace accessible globallly:

ln -s /usr/share/eclipse/plugins/jasko.tim.lisp/sbcl/sbcl /usr/bin/sbcl

  • assuming you installed Eclipse in /usr/share
  • Start Eclipse and change perspective to Lisp.

Six easy steps and you have a lovely Lisp IDE. Oh, and if you’re worried about Java being a “slow” language, you haven’t been around the latest JREs. Get the latest JRE and try Eclipse. You’ll love it.

Now, if I can only get my Isabelle to work with Eclipse! Yes, there is a plugin that does this. It’s just too crude right now.

A Simple PathSearching Agent

I’ve recently started working on Intelligent Agents. I chose to work with Java because I’m more confortable with object oriented approaches and there’s more AI literature based on Java than any other language.

As a beginning, I chose an exercise in AIMA and implemented it in Java. The framework of the Agent and its Environment is based on Ravi Mohan’s code. (I did have to make a few minor changes to make it work for me.)

The agent works in a dynamic environment and is not given full information regarding the environment. It has to keep track of known hurdles and update them based on the percepts passed to it as it moves around. It uses A* search strategy for calculating the path.

The architecture is capable of accomodating more than one agent but as of now, the environment has only one agent.

Download the JAR from here and the full source code from here. You need JDK/JRE 5.0+ to use both of these.