8

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

Say OL
  • 143
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Sean Allred Aug 17 '13 at 16:50
  • @dustin I actually, want the second level item of the enumerate to be 'Khmer (unicode) alphabets'. – Say OL Aug 17 '13 at 17:02
  • 2
    I don't think there is a simple way to do this, but it wouldn't be too hard to construct a gloss-khmer.ldf file for polyglossia modeled after the gloss-thai.ldf file. You could copy that more or less exactly and use it. Since the work involves actual knowledge of the script and the language, this is not something that the average person here can do. – Alan Munn Aug 17 '13 at 17:02
  • @AlanMunn It works fine with document classes article and book but in beamer class, the total page number is still in arabic. How can I change it? Note I use the default theme Madrid. – Say OL Dec 31 '14 at 13:14
  • @OLSAY I think you should ask this as a new question, with a minimal beamer example. – Alan Munn Dec 31 '14 at 17:54
  • @AlanMunn finally, I found it. The last frame number is stored in \inserttotalframenumber and its definition was given in beamerbasemisc.sty at lines 42 and 166. Now, I am able to change it :) Thank you anyway! – Say OL Jan 02 '15 at 07:37
  • @OLSAY I'm glad you figured it out. You should post an answer to your new question (and then accept it in a couple of days.) Also, do you have two accounts (one OL SAY and the other SAY OL)? If so you can ask one of the moderators to merge them for you. Just go into the chat when one of them is there. – Alan Munn Jan 02 '15 at 07:47
  • @AlanMunn OK, I will answer it anyway. For my former account SAY OL, I think I forgot the password and so use this new account. – Say OL Jan 02 '15 at 07:59

1 Answers1

14

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}
David Carlisle
  • 757,742
  • It works fine. Anyway, how can I know and understand all of your syntax (I mean keyword like c@ or @ctrerr ....)? Because I downloaded manual from CTAN and other websites but they have no such special syntax. Especially, when I open the default class or package, I see some other special syntax that I rarely see in the user guide. So where can I find, if possible download, the book that show all of the syntax for writing package or class? – Say OL Aug 19 '13 at 13:24
  • @SayOL That is just copied from the source of latex, you can get a documented version of that as source2e.tex (textdoc source2e) – David Carlisle Aug 19 '13 at 13:29
  • I found source2e.pdf instead from CTAN. Here is the link http://www.tug.org/texlive/Contents/live/texmf-dist/doc/latex/base/source2e.pdf And is it the source codes you meant? – Say OL Aug 20 '13 at 09:18
  • @SayOL yes although I tend to just use latex2e.ltx (which will be in tex/macros/latex/base in your distribution, which is the same without the comments – David Carlisle Aug 20 '13 at 09:26