TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Seeing this post, I'm looking for one good solution for alpha numbering. For my point of view, the way the numbering must be displayed depends on the maximum of the numbers.

  1. If MAX = 26, then the alpha numbering must be a, b, c, ..., z.
  2. If MAX = 26^2, then the alpha numbering must be aa, ab, ac, ..., az, ba, bb, bc, ..., bz, ..., za, zb, zc, ..., zz.
  3. If MAX = 26^n, then the alpha numbering must be similar but with n letters instead of two.

How this features can be obtained by using one command with one constant to indicate the numbers n of letters to use for the alpha numbering ?

share|improve this question
I assume that you specify MAX (or n) before the counter is used, or should this numbering style automagically figure out how many letters to use? – Werner Dec 7 '11 at 23:04
If I have to give MAX when I call the "alpha-numbering" command, it's not a problem. – projetmbc Dec 7 '11 at 23:21
up vote 10 down vote accepted
\DeclareDocumentCommand {\alphanumbering} { O{3} m } {
    \exp_last_unbraced:Nf \use_none:n {
        \int_to_alph:n {
            \exp_args:Nf \int_from_alph:n { \prg_replicate:nn {#1} {z} }
            + #2 } } }
  \alphanumbering{1}, \alphanumbering{2}, \ldots{}, \alphanumbering{26},
  \alphanumbering{27}, \ldots{}, \alphanumbering{2*26},
  \ldots{}, \alphanumbering{26*26}, \ldots{}, \alphanumbering{26*26*26},

share|improve this answer
Thanks for this great solution ! – projetmbc Dec 8 '11 at 9:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.