Text FormattingEnumeration with a given List of Characters

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
bkarpuz
Posts: 124
Joined: Thu Dec 18, 2008 4:53 pm

Enumeration with a given List of Characters

Post by bkarpuz »

Dear LC members,

Suppose that I have the following list of characters:
a, b, c, ç, d, e, f, g, ğ, h, ı, i, j, k, l, m, n, o, ö, p, r, s, ş, t, u, ü, v, y, z
and when I use the enumerate environment, I want the items change by following the list given above. I know that we can do it manually but I want to modify the enumerate environment if possible.


Many thanks.
bkarpuz
Last edited by bkarpuz on Mon Nov 14, 2011 12:52 pm, edited 2 times in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Enumeration with a given List of Characters

Post by localghost »

Looks like the Turkish alphabet. An almost identical question has already been discussed here [1]. Should be sufficient for you, too.

[1] View topic: How to use or create custom Counters via another Alphabet


Thorsten
bkarpuz
Posts: 124
Joined: Thu Dec 18, 2008 4:53 pm

Enumeration with a given List of Characters

Post by bkarpuz »

Thank you localghost! This is what I really wanted to see. But I could not make it work with enumerate package. You have mentioned in your post that we have to introduce them to the package. Can you help me please to make it work with enumerate package.

I used as follows.

Code: Select all

\begin{enumerate}[label={1.\turkish*},leftmargin=*,ref={1.\turkish*.}]
\setcounter{enumi}{0}
\item
\item 
\end{enumerate}
Many thanks.
bkarpuz
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Enumeration with a given List of Characters

Post by localghost »

bkarpuz wrote:[…] But I could not make it work with enumerate package. You have mentioned in your post that we have to introduce them to the package. Can you help me please to make it work with enumerate package. […]
Do not use the enumerate package. This won't work. Use the enumitem package and add the two lines that I mentioned to the preamble of your document.
bkarpuz
Posts: 124
Joined: Thu Dec 18, 2008 4:53 pm

Enumeration with a given List of Characters

Post by bkarpuz »

Thank you very much localghost!

Code: Select all

\documentclass{article}
\usepackage{enumitem}

\makeatletter
\newcommand*{\alphtr}[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*{\Alphtr}[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

\AddEnumerateCounter{\Alphtr}{\@Turkish}{R}
\AddEnumerateCounter{\alphtr}{\@turkish}{r}

\begin{document}

\begin{enumerate}[label={\alphtr*.},leftmargin=*,ref={\alphtr*.}]
\item
\item
\end{enumerate}

\end{document}
Post Reply