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.

Drew
  • 75,699
  • 9
  • 109
  • 225
myotis
  • 1,099
  • 1
  • 13
  • 27
  • 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 06 '17 at 22:43

2 Answers2

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

Tyler
  • 21,719
  • 1
  • 52
  • 92
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.

John Kitchin
  • 11,555
  • 1
  • 19
  • 41
  • 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 '17 at 18:12
  • 1
    It should have been Alt downarrow. it seems that the down arrow markup got lost! – John Kitchin Mar 24 '17 at 18:25