I am trying to migrate from Zotero to org-ref, and got stuck when trying to use the doi-utils-add-bibtex-entry-from-doi command. After reading the Automatic Reference Key Generation section and searching online couldn't find an answer to this question. Can I change the order of the auto-generated entries (author, year, title), for example, to have an author_title_year bibtex key? Thank you in advance.


The order of the components of the key are hard-coded, so you can't change them with a user option. However, you can re-write the function to set the order you want. You need to load your modified function after the original version, so your modification will replace it. The following code does this:

(eval-after-load "bibtex"
  '(defun bibtex-generate-autokey ()
    (let* ((names (bibtex-autokey-get-names))
           (year (bibtex-autokey-get-year))
           (title (bibtex-autokey-get-title))
           (autokey (concat
                     bibtex-autokey-prefix-string ;; optional prefix string
                     (unless (or (equal names "")
                                 (equal title ""))
                       "_") ;; string to separate names from title
                     (unless (or (and (equal names "")
                                      (equal title ""))
                                 (equal year ""))
      (if bibtex-autokey-before-presentation-function
          (funcall bibtex-autokey-before-presentation-function autokey)
  • Works perfectly. I am surprised that this option does not exist by default. Thanks! – Ajned Dec 25 '18 at 16:22

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.