summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/thaienum
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-05-01 21:54:33 +0000
committerKarl Berry <karl@freefriends.org>2017-05-01 21:54:33 +0000
commitf372f265ea1e6039d2bbd8d412c146cd5efc60da (patch)
tree82d450ef682aa7de9accd1a459ebbfac9949e7c5 /Master/texmf-dist/tex/latex/thaienum
parent9072a8c9158e77a25e1c6c5b5cdd97a44ee70855 (diff)
thaienum (1may17)
git-svn-id: svn://tug.org/texlive/trunk@44140 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/thaienum')
-rw-r--r--Master/texmf-dist/tex/latex/thaienum/thaienum.sty71
1 files changed, 71 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/thaienum/thaienum.sty b/Master/texmf-dist/tex/latex/thaienum/thaienum.sty
new file mode 100644
index 00000000000..e6bf05887fb
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/thaienum/thaienum.sty
@@ -0,0 +1,71 @@
+%% thaienum.sty
+%% Copyright 2017 Abhabongse Janthong
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+% The Current Maintainer of this work is Abhabongse Janthong.
+% This work consists of all files in the repository, including
+% thaienum.sty and thaienum.tex.
+%
+% This package provides Thai enumeration labels to the 'enumitem' package.
+% It was heavily inspired by the package 'moreenum'.
+%
+\ProvidesPackage{thaienum}[2017/04/30 v0.2]
+\RequirePackage{alphalph} % For doubling characters
+
+%%------------------------------------------------------------------
+%% Expectes 'enumitem' and 'babel-thai' to be loaded.
+%%------------------------------------------------------------------
+\@ifpackageloaded{enumitem}{}{%
+\RequirePackage{enumitem}%
+\PackageWarning{thaienum}{Package 'enumitem' not loaded before 'thaienum' %
+(please load 'enumitem' package before 'thaienum')}%
+}
+\@ifpackageloaded{babel}{}{%
+\PackageError{thaienum}{Package 'babel' not loaded before 'thaienum' %
+(please load 'babel' package before 'thaienum')}%
+{Please load 'babel' package before 'thaienum'}%
+}
+\@ifpackagewith{babel}{thai}{}{%
+\PackageWarning{thaienum}{Package 'babel' not loaded with option 'thai' %
+(please load 'babel' package with option 'thai')}%
+}
+
+%%------------------------------------------------------------------
+%% Reuses the counter defined by 'babel-thai' package.
+%% How convenient is that!
+%% However, note that \thaialph and \thaiAlph will run
+%% out of counters once it reaches 41 and 44, respectively.
+%%------------------------------------------------------------------
+\AddEnumerateCounter{\thaialph}{\@thaialph}{\thaiNoNen}
+\AddEnumerateCounter{\thaiAlph}{\@thaiAlph}{\thaiNoNen}
+\AddEnumerateCounter{\thainum}{\@thainum}{\thainine}
+\AddEnumerateCounter{\thaibracenum}{\@thaibracenum}{\thainine}
+
+%%-----------------------------------------------------------------
+%% \thaimultialph and \thaimultiAlph are the multi-character
+%% version of \thaialph and \thaiAlph, respectively.
+%% Once the counter reaches \thaiHoNokhuk, it continues with
+%% \thaiKoKai\thaiKoKai, \thaiKoKai\thaiKhoKhai,
+%% \thaiKoKai\thaiKhoKhwai, etc.
+%%-----------------------------------------------------------------
+\newalphalph{\@thaimultialph}[alph]{\@thaialph}{41}
+\newcommand*{\thaimultialph}[1]{%
+\expandafter\@thaimultialph\csname c@#1\endcsname%
+}
+\AddEnumerateCounter{\thaimultialph}{\@thaimultialph}{\thaiNoNen}
+
+\newalphalph{\@thaimultiAlph}[alph]{\@thaiAlph}{41}
+\newcommand*{\thaimultiAlph}[1]{%
+\expandafter\@thaimultiAlph\csname c@#1\endcsname%
+}
+\AddEnumerateCounter{\thaimultiAlph}{\@thaimultiAlph}{\thaiNoNen}
+
+\endinput