1

enter image description here

\documentclass{article}
\usepackage{forloop}
\usepackage{polyglossia}
\setmainlanguage[numerals=Devanagari]{bengali}
\setmainlanguage{bengali}
\setotherlanguage{english}
\newfontfamily\bengalifont[Script=Bengali]{Akaash}
\usepackage[a4paper,left=0cm,top=0cm,bottom=0cm]{geometry}
\newcommand{\aline}{\\\hline \arabic{theyflines} &&&&&&&\rule{0cm}{0.5cm}}
\begin{document}
\pagenumbering{gobble}
\newcounter{theyflines}
%\begin{center}
%Extension - 1
%\end{center}
\noindent
\begin{tabular}{|p{0.15cm}|p{6cm}|p{1.5cm}|p{1.3cm}|p{1cm}|p{1.5cm}|p{4.5cm}|p{3cm}|}
\hline
{\tiny ক্রমিক} নং & নাম & রুম নং & ডিপার্টমেন্ট & বর্ষ & সেশন & মোবাইল নং & জেলা
\forloop{theyflines}{1}{\value{theyflines} < 40}{\aline}\\
\hline
\end{tabular}
\end{document}

As my document is written in bengali I want to put the serial no in bengali ১,২,৩,৪,৫ ... instead of 1,2,3,4,5 .....

1

The macro \bengaliNum takes the name of a LaTeX counter as argument (so similar to \value{theyflines} you can use \bengaliNum{theyflines}) and prints the number in Bengali.

\documentclass[]{article}

\usepackage{polyglossia}
\setmainlanguage[numerals=Devanagari]{bengali}
\setmainlanguage{bengali}
\setotherlanguage{english}
\newfontfamily\bengalifont[Script=Bengali]{Ekushey Amar Desh}

\makeatletter
\newcommand\bengaliNum[1]
  {%
    \expandafter\@bengaliNum\csname c@#1\endcsname
  }
\newcommand\@bengaliNum[1]
  {%
    \expandafter\bengaliNum@a\the#1\end@bengaliNum
  }
\newcommand\bengaliNum@a{}
\def\bengaliNum@a#1#2\end@bengaliNum
  {%
    \ifcase#1 ০%
    \or ১%
    \or ২%
    \or ৩%
    \or ৪%
    \or ৫%
    \or ৬%
    \or ৭%
    \or ৮%
    \or ৯%
    \fi
    \if\relax\detokenize{#2}\relax
      \expandafter\@gobble
    \else
      \expandafter\@firstofone
    \fi
    {\bengaliNum@a#2\end@bengaliNum}%
  }
\makeatother

\newcounter{testcounter}

\begin{document}
\loop\ifnum\value{testcounter}<20
  \makebox[1em][r]{\thetestcounter:} \bengaliNum{testcounter}\par
  \stepcounter{testcounter}
\repeat
\end{document}

Bengali numbers from 0 to 19

Using your MWE (I did not adjust any spacing):

\documentclass[]{article}

\usepackage{forloop}
\usepackage{polyglossia}
\setmainlanguage[numerals=Devanagari]{bengali}
\setmainlanguage{bengali}
\setotherlanguage{english}
\newfontfamily\bengalifont[Script=Bengali]{Ekushey Amar Desh}

\makeatletter
\newcommand\bengaliNum[1]
  {%
    \expandafter\@bengaliNum\csname c@#1\endcsname
  }
\newcommand\@bengaliNum[1]
  {%
    \expandafter\bengaliNum@a\the#1\end@bengaliNum
  }
\newcommand\bengaliNum@a{}
\def\bengaliNum@a#1#2\end@bengaliNum
  {%
    \ifcase#1 ০%
    \or ১%
    \or ২%
    \or ৩%
    \or ৪%
    \or ৫%
    \or ৬%
    \or ৭%
    \or ৮%
    \or ৯%
    \fi
    \if\relax\detokenize{#2}\relax
      \expandafter\@gobble
    \else
      \expandafter\@firstofone
    \fi
    {\bengaliNum@a#2\end@bengaliNum}%
  }
\makeatother


\usepackage[a4paper,left=0cm,top=0cm,bottom=0cm]{geometry}
\newcommand{\aline}{\\\hline \bengaliNum{theyflines} &&&&&&&\rule{0cm}{0.5cm}}

\begin{document}
\pagenumbering{gobble}
\newcounter{theyflines}
\noindent
\begin{tabular}{|p{0.15cm}|p{6cm}|p{1.5cm}|p{1.3cm}|p{1cm}|p{1.5cm}|p{4.5cm}|p{3cm}|}
\hline
{\tiny ক্রমিক} নং & নাম & রুম নং & ডিপার্টমেন্ট & বর্ষ & সেশন & মোবাইল নং & জেলা
\forloop{theyflines}{1}{\value{theyflines} < 40}{\aline}\\
\hline
\end{tabular}
\end{document}

Bengali numbers in table

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.