# Minimal setup for helm-bibtex, org-roam v2, org-roam-bibtex

**URL:** <https://org-roam.discourse.group/t/minimal-setup-for-helm-bibtex-org-roam-v2-org-roam-bibtex/1971>\
**Category:** Requests\
**Created:** [August 23, 2021, 8:36pm UTC](https://org-roam.discourse.group/t/minimal-setup-for-helm-bibtex-org-roam-v2-org-roam-bibtex/1971 "2021-08-23T20:36:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nanounanue](https://avatars.discourse-cdn.com/v4/letter/n/6a8cbe/32.png) [@Nanounanue](https://org-roam.discourse.group/u/Nanounanue)\
**Post date:** [August 23, 2021, 8:36pm UTC](https://org-roam.discourse.group/t/minimal-setup-for-helm-bibtex-org-roam-v2-org-roam-bibtex/1971/1 "2021-08-23T20:36:11Z")

</div>

I know that there are several posts in this community about this specific question, but I can’t make it work.

I want to point that org-roam v2 is working for me, and I am able to insert nodes, etc. (I am having a little trouble with the new movement to the extensions folder, but I am not using dailies a lot, so, not my big problem right now).

I used to have a workflow that incorporated Zotero, org-noter, org-ref, helm-bibtex, org-roam etc. And everything was working.

Today, I wanted to take some notes regarding a book, and org-roam is not using the appropriate template (is using the default from helm-bibtex). I already removed org-noter (I am not using it anyway a lot), but I don’t know how to get the correct template here.

My configuration is the following:

## helm-bibtex

```auto
 (use-package helm-bibtex
  :config
  (setq bibtex-completion-bibliography bib-files-directory
        bibtex-completion-library-path pdf-files-directory
        bibtex-completion-pdf-field "File"
        bibtex-completion-notes-path bib-notes-directory)

  ;; Símbolos usados para indicar que tiene PDF y notas
  (setq bibtex-completion-pdf-symbol "⌘")
  (setq bibtex-completion-notes-symbol "✎")
  (setq bibtex-completion-additional-search-fields '(journal booktitle))

  (setq bibtex-completion-notes-extension ".org")
  (setq bibtex-completion-pdf-extension '(".pdf" ".djvu" ".txt"))

  ;; Para abrir URL/DOIs
  (setq bibtex-completion-browser-function
        (lambda (url _) (start-process "firefox" "*firefox*" "firefox" url)))

  (helm-add-action-to-source
   "Open annotated PDF (if present)" 'helm-bibtex-open-annotated-pdf
   helm-source-bibtex 1)

  :bind
  (("C-x C-b" . helm-bibtex)
   ("<menu>" . helm-bibtex)
   :map helm-command-map
   ("b" . helm-bibtex)))

```

## org-ref

```auto
(use-package org-ref
  :after (org bibtex)
  :init
  (setq org-ref-default-bibliography bib-files-directory)
  (setq org-ref-completion-library 'org-ref-helm-cite)
  (setq org-ref-get-pdf-filename-function 'org-ref-get-pdf-filename-helm-bibtex)
  (setq org-ref-default-citation-link "citep"))

```

## org-roam

```auto
(use-package org-roam
  :init
  (setq org-roam-v2-ack t)
  :custom
  (require 'org-roam-protocol)
  (org-roam-directory "~/research/notas")
  (org-roam-dailies-directory "~/org/daily")
  (org-roam-db-location "~/.cache/emacs/org-roam.db")
  (org-roam-completion-everywhere t)
  (org-roam-db-gc-threshold most-positive-fixnum)
  (org-id-link-to-org-use-id 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 r" . org-roam-ref-find)
         ("C-c n c" . org-roam-capture)
         ("C-c n j" . org-roam-dailies-capture-today)
         :map org-mode-map
         ("C-M-i" . completion-at-point))
  :config
  (org-roam-db-autosync-enable)
  (setq org-roam-capture-templates
        '(("d" "default" plain
           "%?"
           :if-new (file+head "${slug}.org"
                              "#+title: ${title}\n#+date: %U\n")
           :immediate-finish t
           :unnarrowed t)
          ("p" "project" plain
           "* Objetivos\n\n* Tasks\n\n** TODO Agregar tareas iniciales\n\n* Fechas importantes\n\n"
           :if-new (file+head "${slug}.org"
                              "#+title: ${title}\n#+date: %U\n#+filetags: Projects")
           :immediate-finish t
           :unnarrowed t)
          ("P" "Nota privada" plain
           "%?"
           :if-new (file+head "${slug}.org.gpg"
                              "#+title: ${title}\n#+date: %U\n")
           :unnarrowed t)
          ("r" "bibliography reference" plain
           (file "~/.config/emacs/org-templates/roam-ref.org")
           :if-new
           (file+head "references/${citekey}.org" "#+title: ${title}\n#+date: %U\n")
           :unnarrowed t)))
  (setq org-roam-dailies-capture-templates
        '(("d" "default" entry
           "* %?"
           :if-new (file+head "%<%Y-%m-%d-%H%M%S>.org"
                              "#+title: %<%Y-%m-%d-%H%M%S>\n")))))

```

## org-roam-bibtex

```auto
(use-package org-roam-bibtex
  :after (org-roam)
  :bind (:map org-mode-map ("C-c n b" . orb-note-actions))
  :config
  ;(require 'org-ref)
  (setq orb-note-actions-interface 'hydra)
  (setq orb-preformat-keywords
        '("citekey" "title" "url" "author-or-editor" "keywords" "file" "date")
        orb-process-file-keyword t
        orb-insert-interface 'helm-bibtex 
        orb-file-field-extensions '("pdf")))

```

My (attempt) of workflow is:

Open helm-bibtex, press Tab to get the extended actions, press `f9` to get the `Edit notes` and the thing that happen is that I get a buffer with

```auto
#+TITLE: name of the reference ...

```

This template comes from `helm-bibtex` no `org-roam`, So, what I am doing wrong?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![mshevchuk](https://avatars.discourse-cdn.com/v4/letter/m/35a633/32.png) [@mshevchuk](https://org-roam.discourse.group/u/mshevchuk)\
**Post date:** [August 23, 2021, 9:50pm UTC](https://org-roam.discourse.group/t/minimal-setup-for-helm-bibtex-org-roam-v2-org-roam-bibtex/1971/2 "2021-08-23T21:50:40Z")

</div>

> [@Nanounanue](#):
>
> This template comes from `helm-bibtex` no `org-roam` , So, what I am doing wrong?

Hi, `org-roam-bibtex-mode` should be on to make Helm-bibtex use Org-roam. If it’s off then Helm-bibtex will use its own note-taking facility. You can call this command interactively after Emacs startup or add `(org-roam-bibtex-mode +1)` somewhere in your config.

In Org-roam v1, `org-roam-bibtex-mode` was usually called upon startup through `org-roam-mode-hook` as soon as Org-roam was loaded. The corresponding line was nevertheless required in the config as in `:hook (org-roam-mode . org-roam-bibtex-mode)`. In Org-roam v2, `org-roam-mode` is not longer a minor mode, so doing so makes little sense. Instead, one can put `(org-roam-bibtex-mode +1)` in the `:config` section of `use-package org-roam`:

```elisp
(use-package org-roam
  :init
  (setq org-roam-v2-ack t)
  ...
  :config
  (org-roam-bibtex-mode +1)
  ...)

```

---

<div class="post-metadata">

**Author:** ![Nanounanue](https://avatars.discourse-cdn.com/v4/letter/n/6a8cbe/32.png) [@Nanounanue](https://org-roam.discourse.group/u/Nanounanue)\
**Post date:** [August 23, 2021, 11:20pm UTC](https://org-roam.discourse.group/t/minimal-setup-for-helm-bibtex-org-roam-v2-org-roam-bibtex/1971/3 "2021-08-23T23:20:16Z")

</div>

Thank you @mshevchuk , Following your advice I added that line but I am getting this error:

```auto
(void-variable bibtex-completion-find-note-functions)

```

Any idea? ~~It is weird, because it is defined in `helm-bibtex` …~~

Forget it, if I `C-h v` it is not defined … except in the `org-roam-bibtex.el` file

---

<div class="post-metadata">

**Author:** ![mshevchuk](https://avatars.discourse-cdn.com/v4/letter/m/35a633/32.png) [@mshevchuk](https://org-roam.discourse.group/u/mshevchuk)\
**Post date:** [August 24, 2021, 10:48am UTC](https://org-roam.discourse.group/t/minimal-setup-for-helm-bibtex-org-roam-v2-org-roam-bibtex/1971/4 "2021-08-24T10:48:26Z")

</div>

> [@Nanounanue](#):
>
> Forget it, if I `C-h v` it is not defined …

This should not be the case @Nanounanue. That variable is defined in `bibtex-completion.el` and `org-roam-bibtex.el` explicitly requires this library, so it should be already loaded when you call `(org-roam-bibtex-mode +1)` no matter what. Maybe some stale `.elc` files? Try to reinstall Org-roam-bibtex and Helm-bibtex/Bibtex-completion.

---

<div class="post-metadata">

**Author:** ![Nanounanue](https://avatars.discourse-cdn.com/v4/letter/n/6a8cbe/32.png) [@Nanounanue](https://org-roam.discourse.group/u/Nanounanue)\
**Post date:** [August 24, 2021, 6:02pm UTC](https://org-roam.discourse.group/t/minimal-setup-for-helm-bibtex-org-roam-v2-org-roam-bibtex/1971/5 "2021-08-24T18:02:42Z")

</div>

Thank you! I will try it, and will report back

---

<div class="post-metadata">

**Author:** ![tim\_uni](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@tim\_uni](https://org-roam.discourse.group/u/tim_uni)\
**Post date:** [February 24, 2022, 10:07am UTC](https://org-roam.discourse.group/t/minimal-setup-for-helm-bibtex-org-roam-v2-org-roam-bibtex/1971/6 "2022-02-24T10:07:35Z")

</div>

> [@mshevchuk](#):
>
> ```auto
> (use-package org-roam
> :init
> (setq org-roam-v2-ack t)
> ...
> :config
> (org-roam-bibtex-mode +1)
> ...)
> 
> ```

is this information given somewhere in one of the main repo (org-roam, org-roam-bibtex, …) readme files? I spent quite some time searching for the correct way to enable `org-roam-bibtex-mode`. Not sure if that is just my fault though…

---

<div class="post-metadata">

**Author:** ![fsantos](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/fsantos/32/838_2.png) [@fsantos](https://org-roam.discourse.group/u/fsantos)\
**Post date:** [November 25, 2022, 5:53pm UTC](https://org-roam.discourse.group/t/minimal-setup-for-helm-bibtex-org-roam-v2-org-roam-bibtex/1971/7 "2022-11-25T17:53:09Z")

</div>

> [@mshevchuk](#):
>
> ```auto
> (use-package org-roam
> :init
> (setq org-roam-v2-ack t)
> ...
> :config
> (org-roam-bibtex-mode +1)
> ...)
> 
> ```

Hi,

I notice that, in the code block suggested here, `org-roam-bibtex-mode` is not enabled at startup if the corresponding instruction lies in the `:config` part. If it lies in the `:init` part, everything works as expected. This contradicts (I think) what I could find among various documentation files and tutorials. Am I the only one noticing this behaviour?

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [November 26, 2022, 8:19am UTC](https://org-roam.discourse.group/t/minimal-setup-for-helm-bibtex-org-roam-v2-org-roam-bibtex/1971/8 "2022-11-26T08:19:25Z")

</div>

> [@fsantos](#):
>
> at startup

Startup of Emacs? If so, the behaviour you observe may be because at Emacs startup, Org-roam is not loaded yet. The code snippet you quote does not explicitly load Org-roam. And it tells Emacs to wait activating org-roam-bibtex-mode until after Org-roam is loaded.

Perhaps you can test what I am saying by launching Emacs and then manually loading Org-roam via load-library and see what happens?

Also the code snippet does not show where org-roam-db-autosync-mode is activated.

It seems there is confusion around load sequence.
