[texhax] Counting letters

Robin Fairbairns Robin.Fairbairns at cl.cam.ac.uk
Fri Oct 15 18:52:51 CEST 2004


> > -----------------
> > 
> > \newcount\footnotecounter
> > \newcount\footnotetmp
> > \def\lettercounter#1{\message{#1}\footnotecounter=#1
> >   \footnotetmp=\footnotecounter
> >   \divide\footnotetmp by 25 
> >   \multiply\footnotetmp by 25 
> >   \advance\footnotecounter by -\footnotetmp
> > 
> >   \ifnum\footnotecounter < 25 \message{hallo}\fi
> > 
> >   \ifcase\footnotecounter \or a\or b\or
> >   c\or d\or e \or f \or g \or h \or i \or k \or l \or m \or n \or o
> >   \or p \or q \or s \or t \or u \or v \or w \or x \or y \or z\fi}
> > 
> 
> Ross Moore kindly pointed out the problem -- the blanks in the macro
> definition cause the havoc.

oh.  i'd noted that down as something to comment on, but hadn't
imagined it would cause the problem.

the other issue i'd noted was that you're reducing \footnotecounter to
the range 0..24, and then doing a case statement that selects 1..25

i think you need to decrement \footnotecounter by 1 at the start of
the calculation, and to remove the initial \or in your case statement.



More information about the texhax mailing list