30

I would like to have \alph{counter} for values larger than 26. The following MnWE gives me the error ! LaTeX Error: Counter too large.

\documentclass{article}
\begin{document}

\begin{enumerate}
\def\theenumi{\alph{enumi}}
\setcounter{enumi}{24}
\item twenty-five
\item twenty-six
\item twenty-seven
\end{enumerate}

\end{document}

I would like it to behave like one of these:

..., x, y, z, aa, bb, cc, ..., xx, yy, zz, aaa, bbb, ccc, ... (preferred)
..., x, y, z, aa, ab, ac, ..., ax, ay, az, ba,  bb,  bc,  ... (can be if nothing else works)

A solution without LaTeX3 extensions would be awesome as I cannot run LaTeX3 extensions.

2
  • 5
    Look at the alphalph package.
    – egreg
    Apr 19, 2012 at 16:09
  • @egreg Great! Would you like to extend it into an answer or should I post the answer as CW?
    – yo'
    Apr 19, 2012 at 16:25

2 Answers 2

37

The alphalph package by H. Oberdiek provides the second numbering system out of the box. As usual with Heiko's packages, a counter representation such as

\renewcommand{\thesection}{\alphalph{\value{section}}}

is completely expandable.

And, as you remark in comments, with

\makeatletter
\newalphalph{\alphmult}[mult]{\@alph}{26}
\makeatother
\renewcommand{\thesection}{\alphmult{\value{section}}}

you get your preferred way. Of course, replace section with the counter you need.

4
  • For new kinds of symbol wrapping, see this question: tex.stackexchange.com/questions/37447/…
    – Seamus
    Apr 19, 2012 at 16:33
  • There is a way in the package you mention, it is \newalphalph{\@aalph}[mult]{\@alph}{26} \def\aalph#1{\@aalph{\value{#1}}} ;)
    – yo'
    Apr 19, 2012 at 16:38
  • @egreg How do you get this to work with enumitem package. I do not want to create a question because I have seen another one and it has been closed due to the same reason.
    – azetina
    Mar 20, 2013 at 19:36
  • @azetina I don't think this fits in the \AddEnumerateCounter scheme of enumitem.
    – egreg
    Mar 20, 2013 at 20:22
6

Should you happen to use biblatex for your bibliography, you may use its \mknumalph macro for counter values up to 702 ("zz").

\documentclass{article}

\usepackage{biblatex}

% Everything from here to \begin{document} only serves to avoid biber errors
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,
  author = {Author, A.},
  year = {2001},
  title = {Alpha},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\nocite{*}

\begin{document}

\begin{enumerate}
\def\theenumi{\mknumalph{\value{enumi}}}
\setcounter{enumi}{24}
\item twenty-five
\item twenty-six
\item twenty-seven
\end{enumerate}

\end{document}

enter image description here

3
  • Why do you mention "biber errors"? You don't need to run biber ;-) Apr 19, 2012 at 18:46
  • 1
    Tell that latexmk. ;-)
    – lockstep
    Apr 19, 2012 at 18:47
  • 1
    Use arara ;-) Apr 19, 2012 at 18:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .