Changing enumerate to Thai label

#enumerateenumitempolyglossia

\documentclass[a4paper, 12pt]{article}

\usepackage{fontspec}
\newfontfamily{\defaultfont}{CMU Serif}
\newfontfamily{\thaifont}[Scale=MatchLowercase]{TH Sarabun Chula}

\usepackage{polyglossia}
\setdefaultlanguage{thai}
\setotherlanguages{english}

\usepackage[Latin, Thai]{ucharclasses}
\setDefaultTransitions{\defaultfont}{}
\setTransitionTo{Thai}{\thaifont}

\XeTeXlinebreaklocale "th"
\XeTeXlinebreakskip = 0pt plus 1pt

\linespread{1.25}

\usepackage{amsmath, amsthm, amssymb}

\begin{document}
\begin{enumerate}
   \item A
         \begin{enumerate}
             \item a
             \item b
         \end{enumerate}
   \item B
         \begin{enumerate}
             \item c
             \item d
         \end{enumerate}
\end{enumerate}
\end{document}

gives

enter image description here

I want to change (a), (b), … to ก., ข., … (Thai language). I have tried using enumitem package but it clashed with polyglossia package and cause many problems. Using polyglossiato change the enumerate might be the way to go but I can't figure it out.

Best Answer

Let's look at the definition of default enumerate counters in source2e

enter image description here

And now one can create a custom counter for enumerate, in your case for Thai alphabet

\makeatletter
\newcommand*{\@thaialph}[1]{%
 \ifcase#1\or ก\or ข\or ฃ\or ค\or ฅ\or ฆ\or 
 ง\or จ\or ฉ\or ช\or ซ\or ฌ\or 
 ญ\or ฎ\or ฏ\or ฐ\or ฑ\or ฒ\or 
 ณ\or ด\or ต\or ถ\or ท\or ธ\or 
 น\or บ\or ป\or ผ\or ฝ\or พ\or 
 ฟ\or ภ\or ม\or ย\or ร\or ฤ\or 
 ล\or ฦ\or ว\or ศ\or ษ\or ส\or 
 ห\or ฬ\or อ\or ฮ\or ฯ\or \else\@ctrerr\fi}
\newcommand*{\thaialph}[1]{\expandafter\@thaialph\csname c@#1\endcsname}
\makeatother

And whenever you want to use the counter, add this command before your enumerate environment.

\renewcommand{\theenumi}{\thaialph{enumi}}

Alternatively, you can redefine styling of each enumerate levels by changing \labelenumi, \labelenumii, \labelenumiii, \labelenumiv, etc.

For example, setting this will make all first level list have 1), 2), ... numbering and all second level enumerate list will have Thai alphabet numbering in parentheses.

\renewcommand*\labelenumi{\arabic{enumi})}
\renewcommand*\labelenumii{(\thaialph{enumii})}