7

I like alphanumerical citations written as in alpha.bst style, with initials of authors and years, but I would like references to appear sorted as in plain.bst style. As an example, I prefer the order

[BN07] M. Baker and S. Norine (2007)...
[Blo07] S. Bloch (2007)...

to

[Blo07] S. Bloch (2007)...
[BN07] M. Baker and S. Norine (2007)...

Then I would like to know how to modify the *.bst file in order to get what I want.

migrated from stackoverflow.com Oct 16 '11 at 18:32

This question came from our site for professional and enthusiast programmers.

  • 4
    Please keep in mind, that this will get confusing for the reader of your document. He will see BN07 in the document, might skip to the end and through the list of references and will (especially if there are a lot of references) have a hard time finding what he is looking for. – Stephan Oct 16 '11 at 17:17
4

EDITED: You could try the following: copy alpha.bst to your tex directory and rename it e.g. to alpha_plsort.bst (you can find the location of the bst files with kpsewhich <bst-file>). In this file locate the definition of the function presort and rename it to presort.alpha. Now open plain.bst, copy the presort function from there, paste it into alpha_plsort.bst and rename it to presort.plain. Then change the call ITERATE(presort) to ITERATE(presort.plain) and insert ITERATE(presort.alpha) after the call to the SORT function. Your new bst file should look now something like this:

FUNCTION {presort.plain}
{ 
    % presort from plain.bst
}

FUNCTION {presort.alpha}
{ 
    % presort from alpha.bst
}

ITERATE {presort.plain}

SORT

ITERATE {presort.alpha}
  • Thanks to all. I tried copying the presort function from plain.bst and removing the one of alpha.bst looking at the functions .sort but I obtain errors when I compile. Nevertheless, if I don't remove the original presort function (of the alpha.bst), copying just after it the presort function from the plain.bst, changing its name and iterating both functions (first presort-alpha and later presort-plain), all before the instruction SORT, I obtain what I want. – iago Oct 20 '11 at 17:04
  • Yes, you're right, I should have tested it before. What also works is iterating presort-alpha after SORT to just get the labels right. – Elmar Zander Oct 21 '11 at 12:33
  • @iago: I've edited my answer now to reflect your comments. This version should work now. – Elmar Zander Oct 21 '11 at 12:52
  • + 1 for SORT. Adding it to a weird journal specific .bst file really seems to change the sorting to alphabetical. Nice and easy. – Mikko Jul 18 '14 at 8:24
2

I'm afraid you didn't provide quite enough information for us to tell you fully how to modify a given .bst file. However, I would recommend that you run the file makebst.tex -- it'll compile under both plain TeX and LaTeX, and it's entirely menu driven: it asks you a series of question, and at the end it creates a new .bst file for you. Happy (Bib)TeXing!

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.