3

Please see the following MWE. (Written in light of this answer.)

\documentclass{article}

\usepackage{polyglossia}
\usepackage{fontspec}
% Bangla
\setmainlanguage[numerals=Bengali, changecounternumbering=true]{bengali}
\newfontfamily\bengalifont[Script=Bengali,AutoFakeBold=4.0,AutoFakeSlant=0.4]{SolaimanLipi}
\newfontfamily\bengalifontbf[Script=Bengali,AutoFakeBold=4.0,AutoFakeSlant=0.4]{SolaimanLipi}
\newfontfamily\bengalifonttt[Script=Bengali,AutoFakeBold=4.0,AutoFakeSlant=0.4]{SolaimanLipi}
\newfontfamily\bengalifontsf[Script=Bengali,AutoFakeBold=4.0,AutoFakeSlant=0.4]{SolaimanLipi}

\setotherlanguage{english}
\defaultfontfeatures{Ligatures=TeX}

% Times New Roman used
\newfontfamily\englishfont[Mapping=tex-text, Ligatures=TeX]{Times New Roman}

\renewcommand\theenumi{\bngl{enumi}}

% alph lists for Bengali, bngl
\makeatletter
\def\bngl#1{\expandafter\@bngl\csname c@#1\endcsname}
\def\@bngl#1{%
  \ifcase#1\or
  ক\or
  খ\or
  গ\or
  ঘ\or
  ঙ\or
  চ\or
  ছ\or
  জ\or
  ঝ\else\@ctrerr\fi}
\makeatother

% \usepackage{enumitem}

\begin{document}

\begin{enumerate}
\item এক
\item দুই
\item তিন
\item চার 
\end{enumerate}

\end{document}

The above code works fine and produces the expected results.

enter image description here

But breaks as soon as the enumitem package line is uncommented.

enter image description here

Is there any way I can use both my defined \bngl and enumitem?

Masroor
  • 17,842

1 Answers1

4

You must made the counter known to enumitem. I remove your font (that I don't have) as the actual content of your counter is not relevant:

\documentclass{article}
\usepackage{enumitem}

\makeatletter
\def\bngl#1{\expandafter\@bngl\csname c@#1\endcsname}

\def\@bngl#1{%
  \ifcase#1\or
  AA\or %adapt to your liking
  BB\or
  CC\or
  DD\or
  EE\or
  FF\or
  GG\or
  HH\or
  II\else\@ctrerr\fi}

\AddEnumerateCounter\bngl\@bngl{m} %make the counter known to enumitem
\makeatother

\setlist[1,enumerate]{label=\bngl*}
\begin{document}

\begin{enumerate}
\item test
\item test
\item test
\item test
\end{enumerate}

\end{document}
Ulrike Fischer
  • 327,261