You are right in that the BibTeX style (alphadin.bst
) adds an extra label to entries that appear the same to it. This label is just the counter of equivalent entries converted to characters, and after z
comes {
in ASCII.
We can fix that by changing this conversion to obtain extra labels of the form a..z, aa..az, ba..bz, ...
.
For that, make a copy of alphadin.bst
, say alphadin2.bst
, and save it in a place where BibTeX can find it.
Open the new file in an editor, and locate the function forward.pass
(line 2144 ff.) Add the following integer division function before that function:
INTEGERS { a b aneg bneg }
%% takes two arguments a and b, and returns q = a/b, and the remainder a-q*b
FUNCTION {div} {
'a :=
'b :=
a #0 <
{ #1 'aneg :=
#0 a - 'a := }
{ #0 'aneg := }
if$
b #0 <
{ #1 'bneg :=
#0 b - 'b :=
}
{ #0 'bneg := }
if$
b #0 =
{
"Division by zero requested, will return 0 0" * warning$
#0 #0
}
{
#0 %% initialize quotient on stack
{ a b > a b = or }
{ a b - 'a := %% decrement a by b
#1 + %% increment value on stack
}
while$
aneg
{
a #0 >
{ b a - 'a :=
#-1 swap$ -
}
{ #0 swap$ - }
if$
}
{}
if$
bneg
{ #0 swap$ - }
{}
if$
a %% push remainder
}
if$
}
Then, modify forward.pass
as follows:
FUNCTION {forward.pass}
{ last.sort.label sort.label =
{ last.extra.num #1 + 'last.extra.num :=
%% last.extra.num int.to.chr$ 'extra.label := %% original; the next 10 lines are new
last.extra.num #122 >
{
last.extra.num #97 - #26 swap$ div
#97 + int.to.chr$ %% remainder; 0..25 -> a..z
swap$ #96 + int.to.chr$ %% quotient; 1..26 -> a..z
swap$ *
'extra.label :=
}
{ last.extra.num int.to.chr$ 'extra.label := }
if$
}
{ "a" chr.to.int$ 'last.extra.num :=
"" 'extra.label :=
sort.label 'last.sort.label :=
}
if$
}
Now you can use \bibliographystyle{alphadin2}
in your document.
alphalph
package (to allow for alphabetical "numbers" to continue past "z") and hack the.bst
file to change instances of\alph
to\alphalph
. Is the bibliography style file available for general downloading? – Mico May 3 '13 at 13:24