[Tex/LaTex] Simple example for writing Urdu using XeTeX with Nastaleeq font

babelxetex

I want to write in urdu with nastaleeq font. I have done quite a few things but i dont know how to write it. Plus i dont know how to use xetex. So can anyone give me a simple example writing urdu in the desired font and how to run it on texmaker.

Best Answer

Here is a typesetting of poem using IranNastaliq font and XePersian package. XePersian is included in texlive and in case you are missing it, you can get it from CTAN. One problem here is the font. IranNastaliq is designed for persian/farsi alphabet and despite of similarities between persian and urdu, it misses some of letters of urdu such as

enter image description here

This being said, I think you can find an urdu nastaliq font, just add it to you tex file and you will be good to go. I don't see any major difference between typesetting persian and urdu. Here is a sample tex file containing a poem from Saadi with nastaliq font.

\documentclass[a4paper]{article}
%\usepackage{persianpoem}
\usepackage{xepersian}
\settextfont[Scale=1.3]{IranNastaliq}
\renewcommand{\baselinestretch}{3.0}
\newcommand{\myverse}[2]{%
\makebox[4cm][s]{#1}
\makebox[2cm][s]{}
\makebox[4cm][s]{#2}%
}
\begin{document}
\pagestyle{empty}

\title{سر عشق}
\author{سعدی}
\date{\today}
\maketitle

\thispagestyle{empty}

\myverse{هزار جهد بکردم که سر عشق بپوشم}
{نبود بر سر آتش میسرم که نجوشم}


\myverse{به هوش بودم از اول که دل به کس نسپارم}
{شمایل تو بدیدم نه عقل ماند و نه هوشم}


\myverse{به راه بادیه رفتن به از نشستن باطل}
{که گر مراد نیابم به قدر وسع بکوشم}



\end{document}

which gives you this:

enter image description here

Please note that this is just a MWE and needs certain modification to be suitable for you purpose.

You can compile this from command line using:

xelatex your_poem.tex

To you use it with TexMaker, refer to this question.

enter image description here

Above tex sample is borrowed from XePersian Forum and it's respected creator.