Why do I need the org-roam-bibtex package?

Previously, I rely on the org-ref package to insert citations into my Org notes. By clicking on a citation key, I can directly open associated PDF file and bibliography notes which are stored in an independent file, e.g. bib-notes.org. Even though org-roam recognizes the citation keys inserted via org-ref, bibliography notes are incompatible with org-roam and cannot be visualized in org-roam-ui. Then I need org-roam-bibtex to solve this problem by storing the notes for each bibliography item into an independent Org file.

Problems met

When saving an Org file, org-roam-bibtex will check the attached documents for each bibliography item. When there are more than one PDF files associated with an item, there will be an prompt in the mini buffer to let me choose which one is to be used. When there are a bunch of bibliography items containing multiple PDF files, and they usually are duplicated files, confirming each prompt will be unbearable.

Solution

  1. Remove all duplicated PDF files in Zotero and export the Bibtex file used by org-ref via the “Better Bibtex” plugin. N.B. The cache generated by “Better Bibtex” should be deleted before the export, otherwise, the file field in the exported Bibtex file will not be updated.
  2. org-roam-bibtex-mode should not be added to org-mode-hook, otherwise, when editing or creating a bibliography note, there will be an error like this:

    orb-edit-note caught an error during capture: Lisp nesting exceeds ‘max-lisp-eval-depth’
    
  3. I’ve also written an Elisp function tjh/orb-edit-note to create or edit a note, which does not require the cursor to be on a citation key.

    (defun tjh/orb-edit-note()
      "Edit an existing or creating a new note for a bibliography item
    for the user input bibtex key."
      (interactive)
      (let ((key (org-ref-read-key)))
        (if (> (length key) 0)
            (orb-edit-note key))))
    

Now the bibliography notes can be visualized in org-roam-ui.

img