4

I'm trying bibulous to make custom formatted references. In fact, I'm aiming for a small modification of the amsplain bibtex style. That style sorts all appearing references alphabetically and numbers them alphabetically. I'm unable to reproduce this behaviour with bibulous. The relevant options are citelabel and sortkey. Basically the citelabel should be 'numerical in alphabetical order' and sortkey should be equal to <citelabel>. The best approximation I can get is the following which sorts alphabetically, but also puts alphabetically composed labels.

TEMPLATES:
article = <au>, <title>, <journal> <volume> (<year>) <startpage> -- <endpage>.

SPECIAL-TEMPLATES:
authorlist = <author.to_namelist()>
editorlist = <editor.to_namelist()>
authorname.n = [<authorlist.n.prefix> ]<authorlist.n.last>[ <authorlist.n.first.initial()>.][ <authorlist.n.middle.initial()>.][,  <authorlist.n.suffix>.]
au = <authorname.0>, ..., <authorname.9>
ed = [<editorlist.0.first.initial()>. ][ <editorlist.0.middle.initial()>. ][<editorlist.0.prefix> ]<editorlist.0.last>[,  <editorlist.0.suffix>.]
citelabel = <citealpha>
sortkey = <citelabel>

If I change citelabel to <citenum> then the references are numbered in the order of appearance in the document, which I don't want.

Please don't suggest bibtex solutions, I know they exist, but I want to solve this with bibulous.

6

I verified that Bibulous could not achieve what you're looking for, because it lacked access to a variable which gives the numerical order in which a reference is sorted in the reference list. So I added it. This is now available by downloading bibulous.py at Bibulous' GitHub page immediately, and will become available via pip (Python's package manager system) in the next update.

There is now another variable that is always available for each reference, called "sortnum". Thus, you can now achieve what you're looking for by defining the following two special templates:

sortkey = [<authorlist.0.last><authorlist.0.first><year>|<editorlist.0.last><editorlist.0.first><year>]
citelabel = <sortnum>

This sorts the reference by author last name (or editor last name if the former is undefined). It also adds the author's first name and year to the sorting key in order to make the key unique, in case there are more than one reference with the same author last name.

After sorting, this template definition uses the numerical order of citation for the citation label. Running this template on Bibulous' Example #2, gives the following result

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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