6

When using org-ref, the bibliography:ref.bib directive in the notes.org file can be used to direct it to the corresponding ref.bib bibliography. Is there a similar such directive or approach to enable the ref.bib file to "discover" its corresponding notes.org file and bibtex-pdfs folder?

One can set the following within their init.el, or emacs-init.org file:

(setq org-ref-bibliography-notes "~/Dropbox/bibliography/notes.org"
      org-ref-default-bibliography '("~/Dropbox/bibliography/references.bib")
      org-ref-pdf-directory "~/Dropbox/bibliography/bibtex-pdfs/")

However, in the case of multiple projects, each with their own notes.org and ref.bib files, and bibtex-pdfs directories, how can one specify and associated a ref.bib file with a specific notes.org file and bibtex-pdfs folders?

Specifically when working on an article within a project, it's pretty neat to click on a reference that's been inserted with C-c ], and then "Add Notes" to that particular reference 3 RET.

Without the above snippet in my init.el, I get the following error:

org-ref-open-bibtex-notes: Org-ref-bib-bibliography-notes is not set to anything

This error persists even after setting up file local variables:

* File Local Variables
# Local Variables:
# org-ref-bibliography-notes: "~/Dropbox/bibliography/notes.org"
# org-ref-pdf-directory: "~/Dropbox/bibliography/bibtex-pdfs/"
# End:

or:

# -*- org-ref-bibliography-notes: "~/Dropbox/bibliography/notes.org"; -*-
# -*- org-ref-pdf-directory: "~/Dropbox/bibliography/bibtex-pdfs/"; -*-
  • You saved and reloaded the file with the file-local variable- right? (I bet you did, but just for the sake of troubleshooting you can verify with M-x describe-variable org-ref-bibliography-notes and note that it is set locally) – ebpa Jan 19 '17 at 21:27
  • ^Yes. C-h v org-ref-bibliography-notes confirms that its original and global values were / are nil, and that it has been correctly set locally and that its value is indeed file-local. – nyameko Jan 20 '17 at 9:18
  • Please note however, that when the org-ref variables are not set globally in my init.el, and with M-x toggle-debug-on-error, as per my original post, the specific error message is Org-ref-bib-bibliography-notes is not set..., note the bib. – nyameko Jan 20 '17 at 9:37
6

I think you need to put the local variables in two places, which is the org file and the bib file. The issue is that the notes functions are called while the bibtex buffer is active, so the local variables in the org file do not affect them.

In my org file I put something like

* File Local Variables
# Local Variables:
# org-ref-bibliography-notes: "/Users/jkitchin/tmp/org-ref-issue-368/notes.org"
# org-ref-default-bibliography: ("/Users/jkitchin/tmp/org-ref-issue-368/test.bib")
# bibtex-completion-notes-path: "/Users/jkitchin/tmp/org-ref-issue-368/notes/"
# org-ref-pdf-directory: "/Users/jkitchin/tmp/org-ref-issue-368/bibtex-pdfs/"
# End:

In the bib file I put

# -*- org-ref-bibliography-notes: "/Users/jkitchin/tmp/org-ref-issue-368/notes.org"; bibtex-completion-notes-path: "/Users/jkitchin/tmp/org-ref-issue-368/notes/"; org-ref-pdf-directory: "/Users/jkitchin/tmp/org-ref-issue-368/bibtex-pdfs/"; -*-

at the top in one line. That seems to be the only way to get the right thing to happen since the doi utils append to the end of the file and don't look for local variables.

There might still be a notes issue I am looking into, but this is what should be required to work with project specific variables I think.

  • Thank you very much for not only your assistance, but for the project itself. I've adapted my workflow to make use of a single .bib bibliography file, a single notes.org file and a single bibtex-pdfs/ folder. As was the intended use case (I'd imagine). Project specific notes have their own (sub)-trees and tags within the default notes.org file. – nyameko Jan 23 '17 at 9:28

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.