请参阅以下 MWE。(根据这个答案。
\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}
上述代码运行良好并产生预期的结果。
但一旦enumitem
软件包行被取消注释,就会中断。
有什么方法可以同时使用我定义的\bngl
和enumitem
?
答案1
您必须让 enumitem 知道计数器。我删除了您的字体(我没有),因为您的计数器的实际内容不相关:
\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}