org-roam / org-roam-bibtex

Org Roam integration with bibliography management software
GNU General Public License v3.0
576 stars 47 forks source link

working example of org-roam-bibtex with ciatar #273

Closed notuntoward closed 1 year ago

notuntoward commented 1 year ago

Could someone show an org-roam/org-roam-bibtex/citar configuration that reproduces something close to the demo in the readme?

My org-roam setup works by itself, and my citar setup works by itself, but I'm unable to get orb to work with either, at least not as the documentation seems to suggest they should.

The main missing thing is that templates have no effect. For example, if I run M-x citar-open-notes, I don't see a menu which allows me to select an org-roam-capture template; what I see instead is the standard citar minibuffer for bibtex entry selection:

image

If I select one of the papers, an org-roam note is created, but the format is the citar default, which looks like this:

image

Here's my config:

;; bib and org file setup
(setq bibfile_energy_fnm (expand-file-name "energy.bib" docDir)
      bibfile_energy_pdf_dir (expand-file-name "papers" docDir)
      bibfile_energytop_fnm (expand-file-name "energytop.org" docDir)
      zotero_filedir (expand-file-name "zotero" docDir)
      bibfiles_zotero_fnm (directory-files zotero_filedir t "\\.bib$")
      bibfile_DOE_dir (expand-file-name "DOE_brainstorm" docDir)
      bibfile_DOE_fnm (expand-file-name "deepSolarDOE.bib" bibfile_DOE_dir)
      bibfile_DOE_pdf_dir (expand-file-name "papers" bibfile_DOE_dir)
      )

(setq bibfile_list (append (list bibfile_energy_fnm bibfile_DOE_fnm)
                           bibfiles_zotero_fnm)
      bibpdf_dir_list (list bibfile_energy_pdf_dir  bibfile_DOE_pdf_dir
                        zotero_filedir))

(setq org-roam-dir "~/ref/org_roam")

;; Find pdf w/ JabRef/Zotero fields
(setq bibtex-completion-pdf-field "file")

;; *** citar and packages it needs
(use-package embark
  :after vertico
  :ensure t)

(use-package marginalia
  :after vertico
  :ensure t
  :config
  (marginalia-mode))

(use-package citeproc
  :ensure t)

(use-package citar-embark
  :after citar embark
  :ensure t
  :init
  (setq citar-at-point-function 'embark-act)
  :config
  (citar-embark-mode))

(use-package citar
  :init
  (setq org-cite-insert-processor 'citar
        org-cite-follow-processor 'citar
        org-cite-activate-processor 'citar
        org-cite-global-bibliography bibfile_list
        citar-bibliography org-cite-global-bibliography
        citar-library-paths bibpdf_dir_list
        citar-notes-paths (list org-roam-dir))
  :bind (("C-c b" . citar-insert-citation)
         ;; also  C-c C-x C-@
         (:map org-mode-map :package org ("C-c b" . #'org-cite-insert))
         ("C-c C-1" . citar-open-library-files)
         :map minibuffer-local-map
         ("M-b" . citar-insert-preset))) ; ??  from 

(use-package citar-org-roam
  :after (citar org-roam)
  :config
  (citar-org-roam-mode))

(use-package org-roam
  :after helm-bibtex ; necessary?
  ;; calling one of these commands will initialize Org-roam and ORB
  :commands (org-roam-node-find org-roam-graph org-roam-capture
                                org-roam-dailies-capture-today org-roam-buffer-toggle)
  :custom
  (org-roam-completion-everywhere t) ;; org-roam links completion-at-point
  (org-id-method 'ts)
  (org-roam-directory org-roam-dir)
  ;; from emacsconf
  (org-roam-node-display-template "${title:80} ${tags:80}")
  (org-roam-capture-templates '(("m" "main"
                                 plain
                                 "%?"
                                 :if-new (file+head "main/${slug}.org" "#+title: ${title}\n"):immediate-finish
                                 t
                                 :unnarrowed t)
                                ("r" "bibliography reference"
                                 plain
                                 "* First Pass\n** Category\n(type of paper)\n** Context\n(Related Research)\n** Correctness\n(Valid assumptions)\n** Contributions\n** Clarity\n* Second Pass\n** Notes\n** Concepts I don't get\n** Questions\n** Summary\n** Relevant Related Work\n* Third Pass\n** Strong Points\n** Weak Points\n"
                                 :target (file+head "references/notes/${citekey}.org" "#+title: ${title}\n"):unnarrowed
                                 t)
                                ("t" "topic"
                                 plain
                                 "* Category\n\n%?\n\n"
                                 :if-new (file+head "topics/${slug}.org" "#+title: ${title}\n#+filetags: Topic"):immediate-finish
                                 t
                                 :unnarrowed t)
                                ("a" "other resources"
                                 plain
                                 "%?"
                                 :if-new (file+head "articles/${title}.org" "#+title: ${title}\n#+filetags:
  :article:\n"):immediate-finish
                                 t
                                 :unnarrowed t)))
  :bind (("C-c n l" . org-roam-buffer-toggle)
         ("C-c n f" . org-roam-node-find)
         ("C-c n i" . org-roam-node-insert)
         ("C-c n g" . org-roam-graph)
         ("C-c n h" . org-roam-capture)
         ([mouse-1] . org-roam-visit-thing)

         ("C-c n d" . org-roam-dailies-capture-today)) ; only 2 keys for today
  :bind-keymap  
  ("C-c n D" . org-roam-dailies-map) ;; get options for all dailies key bindings

  :init
  (setq org-roam-dailies-directory (expand-file-name "daily"
                                                     org-roam-dir))
  :config
  (require 'org-roam-dailies) ;; Ensure the keymap is available
  (org-roam-db-autosync-mode) ;; nee org-roam-setup
  (org-roam-bibtex-mode +1))

(use-package org-roam-bibtex
  :straight t
  :after org-roam
  :hook (org-roam-mode . org-roam-bibtex-mode))
myshevchuk commented 1 year ago

Hi @notuntoward, the answer to your questions can most likely be found in the README.

Looking at the configuration you provided, the only conclusion I can make is that you didn't even bother to read the docs. For instance, this piece: :hook (org-roam-mode . org-roam-bibtex-mode) has been outdate by more than two years now. If you can't take your time to read the docs, I am not going to take any more of my time to help you.

Good luck.