Skip to content

Instantly share code, notes, and snippets.

@nsommer
Created August 24, 2017 14:26
Show Gist options
  • Save nsommer/8cda705b48c7ba64eada106bcc74bef3 to your computer and use it in GitHub Desktop.
Save nsommer/8cda705b48c7ba64eada106bcc74bef3 to your computer and use it in GitHub Desktop.
Addition to alphadin.bst that enables overriding of labels by the key attribute of BibTeX entries.
FUNCTION {key.label}
{ key #20 text.prefix$ } %% Length of 20 chars should be sufficient
FUNCTION {calc.label}
{ type$ "book" =
type$ "booklet" =
type$ "inbook" =
or or
'author.editor.key.label
{ type$ "proceedings" =
'editor.key.organization.label
{ type$ "manual" =
'author.key.organization.label
'author.key.label
if$
}
if$
}
if$
duplicate$
year field.or.null purify$ #-1 #2 substring$
*
'label :=
key empty$ 'label 'key.label if$ 'label := %% Override automatically generated label with key, if it exists
year field.or.null purify$ #-1 #4 substring$
*
sortify 'sort.label :=
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment