# How to get devanagari numerals in latex or xetex

How to get devanagari numerals in xetex or latex - especially in enumerate environment?

I can use unicode to write devanagari text but I am unable to get devenagari numerals in section numbers, enumerate environment, etc.

Here is the basic code I am using:

\documentclass{article}

\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{hindi}
\setotherlanguage{english}
\setmainfont[Script=Devanagari]{Nakula}

\begin{document}

देवनागरी

Same English Text

१ २ ३ ४ ५ ६ ७ ८ ९ ०

\begin{enumerate}
\item   This is first
\item   देवनागरी
\end{enumerate}

\end{document}


And I am compiling using xetex (default set-up on Ubuntu 12.04).

-
Your question was migrated here from another stackexchange site. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question. –  percusse Sep 6 '12 at 11:56
You'll probably need a specific font for that. SIL has some devanagari fonts: sil.org/sil/news/2011/annapurna-font.htm –  ℝaphink Sep 6 '12 at 14:20
I can see devanagari numerals and devanagari text (१, २, देवनागरी, etc.) But the numbers in section numbers, enumerate environment are still arabic –  deshmukh Sep 8 '12 at 10:29

## migrated from askubuntu.comSep 6 '12 at 11:52

This question came from our site for Ubuntu users and developers.

There's currently no interface for changing all numerals to Devanagari ones. However you can define your own:

\documentclass{article}

\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{hindi}
\setotherlanguage{english}

\setmainfont[Script=Devanagari]{Nakula}

\newcommand{\devanagarinumeral}[1]{%
\devanagaridigits{\number\csname c@#1\endcsname}}

% renew all representation of counters
\renewcommand{\thesection}{\devanagarinumeral{section}}
\renewcommand{\thepage}{\devanagarinumeral{page}}
\renewcommand{\theenumi}{\devanagarinumeral{enumi}}

\begin{document}

देवनागरी

\foreignlanguage{english}{Some English Text}

१ २ ३ ४ ५ ६ ७ ८ ९ ०

\begin{enumerate}
\item   \foreignlanguage{english}{This is first}
\item   देवनागरी
\end{enumerate}

\end{document}


A more risky approach is to change the meaning of \@arabic (the internal command that represents counter with arabic digits):

\makeatletter
\def\@arabic#1{\expandafter\devanagaridigits\expandafter{\number#1}}
\makeatother


This would spare you from redefining all needed counter representations, but may break packages that rely on \@arabic.

-
I tried both the approaches. It produces an error ! Undefined control sequence. \devanagarinumeral #1->\devanagaridigits {\number \csname c@#1\endcsname } l.20 ...foreignlanguage{english}{Section Heading}}  What could be wrong here? –  deshmukh Sep 11 '12 at 12:01
Add \usepackage{devanagaridigits}; on my machine this package is automatically loaded, perhaps your TeX distribution is older than mine. –  egreg Sep 11 '12 at 12:05
This has opened up Pandora's Box! My texlive installation is from Ubuntu repositories. It is a 2009 version. I could not find any devanagaridigits package in the repositories or on ctan.org Should I, therefore, go and install latest tex-live 2012? Can I install and use it where I do not have root access? I know, this should be a separate question. But thought might ask here for a link to these answers. Thanks, @egreg –  deshmukh Sep 12 '12 at 14:06
@deshmukh As far as I know TeX Live 2012 is in the Debian "testing" tree, but installing it requires root access anyway. –  egreg Sep 12 '12 at 14:14
thanks @egreg. I have accepted your answer and passed on the bounty. Will look up on installing Tex Live 2012 (with/ without root access). :) –  deshmukh Sep 12 '12 at 14:30