I recently started to incorporate Emacs as part of my workflow. Specifically, I am looking forward to a system that allows me to maintain and manage my bibliography. For this purpose I am now using org-ref with ivy as the completion system. Coming from using Zotero, I like having short bibkeys (eg. Author2021) as in this format it is easier to the eye in latex documents. On the other hand, I like my pdf files named with a more descriptive text such as Author 2021 - The title of the publication.pdf as I systematically find myself looking for files through the OS.

I have been able to accomplish the former (short bibkeys) by defining a function to be run when the system calls bibtex-generate-autokey. For example, when I call org-ref-clean-bibtex-entry. However, I haven't been able to even look at the right place in the documentation to have a different pdf naming convention.

Any help towards this dual goal is greatly appreciated as my understanding and experience with lisp is very limited.

  • 1
    How are you generating your .bib entries?
    – Tyler
    Jun 28 '21 at 20:21
  • I am using org-ref for this. Like adding through arxiv identifiers, DOIs, or weblinks.
    – agarbuno
    Jun 28 '21 at 20:23
  • The Emacs tools (org-ref, helm-bibtex, ivy-bibtex) I'm familiar with assume your pdfs are named to match the bib key. I don't know a straightforward way to support short bib keys and long pdf file names at the same time.
    – Tyler
    Jun 28 '21 at 20:27

I guess the best way to do this would be along these lines:

  1. Write a function that takes a bibtex key and generates the pdf filename you want, e.g. it looks up the bibtex entry, gets the authors, year and title, and constructs a legitimate filename from them. There might be lots of corner cases to deal with latex markup in author names and titles. I think this function should return the full path to where the file will be.

  2. Set the value of org-ref-get-pdf-filename-function to the name of the function in 1.

I think that will cause newly added pdf files to have the name you want.

  • Easiest (and most reliable) would be to just grab the BibTeX name for the entry: They can't contain funky characters, and must be unique (at least in your *.bib file(s)). Easy to extract from the entry, as a bonus.
    – vonbrand
    Jun 29 '21 at 3:11
  • Thanks a lot @john-kitchin. I'll try to implement what you suggest. I might take a while for me to set it up. I'll make an update here as soon as possible.
    – agarbuno
    Jun 29 '21 at 16:54

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.