# Numbering in Devanāgarī while using XeTeX

I have been using XeTeX for typsetting Devanāgarī documents and it is going great. But I have encountered one issue, that whenever i use commands like \section, \begin{enumerate},\footnote or any command that generates numbering the numbering appears in the roman. Like 1,2,3 but I want to it in Devanāgarī like १, २, ३ ,४ .... Any possible way/best practices to make this happen ?

PS: Once fixed, this could be used for other Indic Scripts too.

-

A better and easier solution is to use the package polyglossia:

\usepackage{polyglossia}
\setdefaultlanguage{hindi}


This should be enough to switch on Devanāgarī numerals. (Is Hindi the correct language? I’m guessing here. According to the documentation of polyglossia it has the correct numerals, at least.)

-
If numerals comes as १,२,३,४ in polyglossia. Hindi can be correct. –  Ujjwol Sep 17 '10 at 12:08
While using polyglossia, my compiler says ! LaTeX Error: File polyglossia.sty' not found. –  Ujjwol Sep 17 '10 at 12:13
@Ujjwol: if the file isn’t found, you need to install that package from CTAN. –  Konrad Rudolph Sep 17 '10 at 12:58
Ok ! Thanks for the answer. –  Ujjwol Sep 17 '10 at 16:24

You can create your own numbering style as follows:

\newcommand*\devanagari[1]{\expandafter\@devanagari\csname c@#1\endcsname}

\newcommand*\@devanagari[1]{%
\ifcase#1\or १\or २\or ३\or ४\or ५\or ६\or ७\or ८\or ९\fi}


Since this code uses the @ character in commands, you need to put \makeatletter before this code if it’s not in a package file. And it’s best to put \makeatother after it, to switch the character code of @ back to its default.

Then you can use this numbering style like any other (e.g. \arabic or \roman). For example, to set the footnote numbering, do the following:

\renewcommand*\thefootnote{\devanagari{footnote}}


And to change the first-level enumeration style, do:

\renewcommand*\theenumi{\devanagari{enumi}}

-
Just check what is wrong with the code below. –  Ujjwol Sep 17 '10 at 11:43
Check this code, it is not working. pastebin.com/g37g4GHp –  Ujjwol Sep 17 '10 at 11:45
@Ujjwol: you didn’t follow the second half of my posting! Just creating the \devanagari command won’t apply it in the text, you explicitly have to assign the enumeration style. Furthermore, better put these declarations into the header, before the \begin{document}`. –  Konrad Rudolph Sep 17 '10 at 11:47
@Ujjwol: Take a look at the other answer I wrote. That is a better way. Feel free to ignore my first answer. –  Konrad Rudolph Sep 17 '10 at 11:54