4

I have installed org-ref, and enjoy its functionality when writing notes where I need literature references in my text.

However, when I press the command C-c ], the BibTex entries that are listed in Helm are not alphabetically sorted. That makes it difficult to find the references I want to insert. How can I sort the list of references shown in Helm?

I am using Emacs (25.0.93.1) and org-mode (9.0.1) on my windows 10.

1
  • Author of helm-bibtex here. I haven't bothered to implement sorting because personally I think it antithetical to the helm approach. I just enter information until I have narrowed the list down enough to immediately spot the entry I'm looking for. No point in scanning a longer list of entries when narrowing down the list is faster. Having said that, if someone is interested in adding a sorting feature, I'd be happy to accept a patch. Should be relatively easy to implement.
    – tmalsburg
    Oct 6, 2017 at 22:43

2 Answers 2

3

It is possible to use a different backend than helm-bibtex which offers different sorting options. The org-ref-helm-cite backend allows you to sort by key, year and first author lastname (both ascending and descending) with key bindings. You type M- and then you get a menu to select the sort type and direction. It is not a well-used feature even by me, so your mileage on its utility might vary.

2
  • Hi, and thanks for your answer. I call M-x org-ref-helm-cite and I get the citation list and a prompt "pattern:" in the command line, but your "M-" ("alt" + "-") command does not function. What have I misunderstood?mm
    – myotis
    Mar 24, 2017 at 18:12
  • 1
    It should have been Alt downarrow. it seems that the down arrow markup got lost! Mar 24, 2017 at 18:25
4

Helm Bibtex entries are presented in the reverse of the order in which they appear in your .bib file: https://github.com/tmalsburg/helm-bibtex/issues/21

You can reverse this order with the following (taken from the linked thread). Put this in your .emacs:

(eval-after-load "helm-bibtex"
    '(advice-add 'bibtex-completion-candidates
            :filter-return 'reverse))

My bib file is sorted alphabetically, so this gives me alphabetically sorted results from helm-bibtex.

You can't, yet, customize which column the results are sorted by: https://github.com/tmalsburg/helm-bibtex/issues/5

2
  • Thanks for your answer, but where do I put the code you suggest?
    – myotis
    Mar 24, 2017 at 18:57
  • 1
    It goes in your .emacs, and needs to run after you've loaded helm-bibtex. I'll updated the answer.
    – Tyler
    Mar 24, 2017 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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