Org roam bibtex configuration

The expression should be part of the string template:

("r" "bibliography reference" plain
            "%?
%(roi-get-last-author \"%^{author}\")  published in %^{year}."
           :target
           (file+head "references/${citekey}.org" "#+title: ${title}\n\n#+CREATED: %U\n#+LAST_MODIFIED: %U\n#+OPTIONS: toc:nil, ':t\n#+SETUPFILE: ~/.doom.d/templates/org_latex_header.org\n#+filetags: :reference:\n\n")
           :unnarrowed t)))

Mind the escaped double quotes around %^{author}. They are needed because you write the expression itself as an Elisp string. Shall you use a template file as in that keywords thread, those won’t be needed and you would write simply %? %(roi-get-last-author "%^{author}") published in %^{year}.

During org-capture, the Elisp template placeholder %(...) gets expanded after all other templates, so the intermediate string before reading your expression would internally look like
%? %(roi-get-last-author "First, J., Last J.") published in 2021.

You can read more about Org-capture templates in the Org manual or in the org-capture-templates docstring. Although Org-roam and ORB somewhat extend the Org-capture functionality, they do not cut anything out, so everything that applies to Org-capture templates also applies to Org-roam capture templates.

1 Like