Document Classes ⇒ how to use or create custom counters via another alphabet
how to use or create custom counters via another alphabet
I have been busy creating a thesis style for my college in Turkey. Our regs push us use Turkish alphabet in various places like page numbering (appendix), sectioning, enumerating. As you all may now, we are restricted to use arabic, roman, Alph and alph by default. We have 29 letters in our alphabet. Just to cut it short, is there any way to use our alphabet as a counter? can we create something like \Alphtr{counter} or \alphtr{counter}? if yes how please? Thanks in advance
MTURAN
http://www.turkishlanguage.co.uk/alphabet.htm link of turkish alphabet
Turkish character codes, I used in cls file
% Turkce Karakter Kodlari
\catcode240=13 \def ğ{\u g}
\catcode231=13 \def ç{\c c}
\catcode246=13 \def ö{\"o}
\catcode254=13 \def ş{\c s}
\catcode252=13 \def ü{\"u}
\catcode253=13 \def ı{{\i}}
\catcode221=13 \def İ{\.I}
\catcode199=13 \def Ç{\c C}
\catcode208=13 \def Ğ{\u G}
\catcode214=13 \def Ö{\"O}
\catcode222=13 \def Ş{\c S}
\catcode220=13 \def Ü{\"U}
MTURAN
http://www.turkishlanguage.co.uk/alphabet.htm link of turkish alphabet
Turkish character codes, I used in cls file
% Turkce Karakter Kodlari
\catcode240=13 \def ğ{\u g}
\catcode231=13 \def ç{\c c}
\catcode246=13 \def ö{\"o}
\catcode254=13 \def ş{\c s}
\catcode252=13 \def ü{\"u}
\catcode253=13 \def ı{{\i}}
\catcode221=13 \def İ{\.I}
\catcode199=13 \def Ç{\c C}
\catcode208=13 \def Ğ{\u G}
\catcode214=13 \def Ö{\"O}
\catcode222=13 \def Ş{\c S}
\catcode220=13 \def Ü{\"U}
Last edited by mturan on Sat Nov 13, 2010 12:02 am, edited 1 time in total.
NEW: TikZ book now 40% off at Amazon.com for a short time.

how to use or create custom counters via another alphabet
The definition of \alph is:
You can adapt this by replacing "a", "b" etc with the Turkish equivalents. (You'll need to add some extra \or parts to go up to 29.)
Regards
Nicola Talbot
Code: Select all
\newcommand\alph[1]{%
\expandafter \@alph \csname c@#1\endcsname
}
\newcommand\@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
}
Regards
Nicola Talbot
LaTeX Resources: http://www.dickimaw-books.com/latexresources.html
Creating a Minimal Example: http://www.dickimaw-books.com/latex/minexample/
Creating a Minimal Example: http://www.dickimaw-books.com/latex/minexample/
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
how to use or create custom counters via another alphabet
Let me translate Nicola's suggestion into code. As she already mentioned, you can derive and equivalent definition for your needs. I once did something similar for a »greek« numbering some time ago [1]. See code below for a new \turkish and \Turkish numbering macro.
These new numberings can be used as known from the default ones (\roman, \Roman, …). If you are using the enumitem package, it may require some further additions in the preamble to make the package aware of the new definitions. But we can handle that occasionally.
[1] View topic: greek letters as page numerals?
Best regards and welcome to the board
Thorsten
Code: Select all
\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{blindtext}
\makeatletter
\newcommand*{\turkish}[1]{%
\expandafter\@turkish\csname c@#1\endcsname
}
\newcommand*{\@turkish}[1]{%
\ifcase#1\or a\or b\or c\or \c{c}\or d\or e\or f\or g\or \u{g}\or h\or i%
\or \i\or j\or k\or l\or m\or n\or o\or \"{o}\or p\or r\or s\or \c{s}%
\or t\or u\or \"{u}\or v\or y\or z%
\else\@ctrerr\fi
}
\newcommand*{\Turkish}[1]{%
\expandafter\@Turkish\csname c@#1\endcsname
}
\newcommand*{\@Turkish}[1]{%
\ifcase#1\or A\or B\or C\or \c{C}\or D\or E\or F\or G\or \u{G}\or H\or I%
\or \.{I}\or J\or K\or L\or M\or N\or O\or \"{O}\or P\or R\or S\or \c{S}%
\or T\or U\or \"{U}\or V\or Y\or Z%
\else\@ctrerr\fi%
}
\makeatother
\begin{document}
\pagenumbering{Turkish}
\Blinddocument
\end{document}
[1] View topic: greek letters as page numerals?
Best regards and welcome to the board
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
how to use or create custom counters via another alphabet
Beeing a part of community is a great feeling Thorsten and Nicola, thanx for that
. I kinda mixed up what you guys replied and came up with the solution. I tried the first code and it worked for me now, but the second code might be replaced in enumitem.sty in between line 225 through 229 for the second solution as a future reference for the people who want use both eng and tr alphabet selectively. I will be on with more questions and more friends. Again thanks for on time on target replies.
Best Regards
MTURAN

Best Regards
MTURAN
Code: Select all
\renewcommand\alph[1]{%
\expandafter \@alph \csname c@#1\endcsname
}
\renewcommand\@alph[1]{%
\ifcase #1%
\or a\or b\or c\or \c{c}\or d\or e\or f\or g\or \u{g}\or h\or i%
\or \i\or j\or k\or l\or m\or n\or o\or \"{o}\or p\or r\or s\or \c{s}%
\or t\or u\or \"{u}\or v\or y\or z%
\else \@ctrerr
\fi
}
\renewcommand\Alph[1]{%
\expandafter \@Alph \csname c@#1\endcsname
}
\renewcommand\@Alph[1]{%
\ifcase #1%
\or A\or B\or C\or \c{C}\or D\or E\or F\or G\or \u{G}\or H\or I%
\or \.{I}\or J\or K\or L\or M\or N\or O\or \"{O}\or P\or R\or S\or \c{S}%
\or T\or U\or \"{U}\or V\or Y\or Z%
\else \@ctrerr
\fi
}
Code: Select all
\AddEnumerateCounter{\arabic}{\@arabic}{0}
\AddEnumerateCounter{\alph}{\@alph}{m}
\AddEnumerateCounter{\Alph}{\@Alph}{M}
\AddEnumerateCounter{\roman}{\@roman}{viii}
\AddEnumerateCounter{\Roman}{\@Roman}{VIII}
\AddEnumerateCounter{\Turkish}{\@Alphtr}{R}
\AddEnumerateCounter{\turkish}{\@alphtr}{r}
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
how to use or create custom counters via another alphabet
It is not necessary (and anything but recommendable) to modify the package file itself. Just put those lines into the preamble of your document and it will work.mturan wrote: […] I tried the first code and it worked for me now, but the second code might be replaced in enumitem.sty in between line 225 through 229 for the second solution as a future reference for the people who want use both eng and tr alphabet selectively. […]
Code: Select all
\AddEnumerateCounter{\Turkish}{\@Turkish}{R}
\AddEnumerateCounter{\turkish}{\@turkish}{r}
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: how to use or create custom counters via another alphab
Good call Thorsten, thanks for the heads up.