How i can give section numbers and page numbers with Bengali numerals in latex?
2 Answers
You can use Enrico’s answer in the other question, provided you define a macro that outputs the Bengali numerals, as in the code below:
\documentclass{article}
\makeatletter
\def\bengalidigits#1{\expandafter\@bengali@digits #1@}
\def\@bengali@digits#1{%
\ifx @#1
\else
\ifx0#1০\else\ifx1#1১\else\ifx2#1২\else\ifx3#1৩\else\ifx4#1৪\else\ifx5#1৫\else\ifx6#1৬\else\ifx7#1৭\else\ifx8#1৮\else\ifx9#1৯\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
\expandafter\@bengali@digits
\fi
}
\makeatother
\def\bengalinumber#1{\bengalidigits{\number#1}}
\def\bengalinumeral#1{\bengalinumber{\csname c@#1\endcsname}}
\renewcommand\thesection{\bengalinumeral{section}}
\renewcommand\thepage{\bengalinumeral{page}}
\usepackage{fontspec}
\setmainfont{Lohit Bengali}
\begin{document}
\section{বৈশাখ}
\section{জ্যৈষ্ঠ}
\section{আষাঢ়}
\section{শ্রাবণ}
\section{ভাদ্র}
\section{আশ্বিন}
\end{document}
With this code I get the following result:
Note in particular the Bengali digit 1 as the page number.
I’ll make the Bengali digit code in a package as part of Polyglossia.
- 2,920
- 19
- 17
-
Thank u so much.But is there any easier way to solve? if u make the Bengali digit code in a package as part of Polyglossia. how can i know u did? thanks again in advance :) – Masud May 26 '15 at 08:53
-
-
Have you finished doing Bengali digit code in Polyglossia? :-) (I can hardly wait to see!) – hola May 30 '17 at 02:55
-
@ArthurReutenauer Any plans of adding this? People are still asking questions about this feature… See also this question. – ShreevatsaR Jun 28 '17 at 22:16
There is a gloss-bengali.ldf file, such that, when you use the polyglossia command:
\setdefaultlanguage[numerals=Bengali,changecounternumbering=true]{bengali}, the numbering for page and for section down to subparagraph are changed to Bengali digits. Bengali names for the parts of a document are also in the file.
Some random text:
MWE
\documentclass[12pt]{article}
\usepackage{fontspec}
\setmainfont[Script=Bengali,Scale=1.5]{Noto Serif Bengali}
\usepackage{polyglossia}
\setdefaultlanguage[numerals=Bengali,
changecounternumbering=true]{bengali}
\begin{document}
\today
\tableofcontents
\section{কখগঘ কাকিকী কেকৈককোকৌ}
\subsection{ক}
০১২৩৪৫৬৭৮৯ \bengalidigits{123 456 789}
\newpage
\section{কখগঘ কাকিকী কেকৈককোকৌ}
কখগঘ
\subsection{ক}
কখগঘ
\subsubsection{ক}
কখগঘ
\subsubsection{ক}
কখগঘ
\subsubsection{ক}
কখগঘ
\end{document}
From the .ldf code, it should be straightforward to add the chapter, figure, table and footnote counters. Which leaves csquotes package quotation marks , perhaps equation numbering, and maybe the biblatex bibliography (and numeric citation style). And a note in the .ldf says the calendar still has to be done.
Certainly, section numbers and page numbers are available.
- 10,129

\renewcommandof\thesectionand\thepage. – Werner May 25 '15 at 18:11