[Tex/LaTex] Change Enumerate Items to Khmer Unicode Alphabet

#enumeratefontslistsunicode

Here is my code that change default enumerate item to roman number

\documentclass{article}
\def\theenumi{\roman{enumi}}
\def\theenumii{\roman{enumii}}
\begin{document}
    \begin{enumerate}
        \item one
        \begin{enumerate}
            \item one
            \item two
        \end{enumerate}
        \item two
        \begin{enumerate}
            \item one
            \item two
        \end{enumerate}
    \end{enumerate}
\end{document}

My purpose is to change the second level \enumii to khmer unicode alphabet.
Is there any way to do that? Or is there any way to map the latin alphabet to khmer alphabet, i.e.

a->ក

b->ខ

c->គ

for example?

And here is the link to download Khmer fonts

Best Answer

The \alph command that uses the latin alphabet is just a simple list:

\def\@alph#1{%
  \ifcase#1\or a\or b\or c\or d\or e\or f\or g\or h\or i\or j\or
   k\or l\or m\or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or
    y\or z\else\@ctrerr\fi}

So once you have Khmer fonts set up, and know the alphabet it should be simple to add a similar command.

enter image description here

I used xetex and an existing font (DaunPenh) on my Windows system that covers this Unicode range and made a \khmercount command that (I hope, if I got that right) covers the first few slots in the alphabet.

If you are using pdflatex you will need to change the ^^^^ Unicode notation to whatever syntax your font package needs. I didn't go any further than the first few as I don't know if the counting order you need matches the Unicode order. Sorry I can not read this script at all.

\documentclass{article}
\def\theenumi{\roman{enumi}}
\def\theenumii{\khmercount{enumii}}
\usepackage{fontspec}
\setmainfont{DaunPenh}

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

% extend as needed!
\def\@khmercount#1{%
  \ifcase#1\or
   ^^^^1780\or
   ^^^^1781\or
   ^^^^1782\or
   ^^^^1783\or
   ^^^^1784\or
   ^^^^1785\or
   ^^^^1786\else
   \@ctrerr\fi}

\makeatother
\begin{document}

    \begin{enumerate}
        \item one
        \begin{enumerate}
            \item one
            \item two
        \end{enumerate}
        \item two
        \begin{enumerate}
            \item one
            \item two
        \end{enumerate}
    \end{enumerate}
\end{document}