I am trying to set org roam bibtex in order to write notes on references.
I followed the manual, and I am trying this simple config:
(setq org-roam-capture-templates
'(("r" "bibliography reference" plain
"%?
%^{author} published %^{entry-type} in %^{date}: fullcite:%\\1."
:target
(file+head "references/${citekey}.org" "#+title: ${title}\n")
:unnarrowed t)))
However, it does not work well. I am asked to choose an entry-type and I do not understand what that is.
Can anyone please explain how should I configure this?
It’s the type of BibTeX entry: article, book, proceedings, and so on. Make sure “entry-type” is on the orb-preformat-keywords list, see the default value for this option. You won’t need to type it then, it will be substituted automatically.
Thanks! I now do not need to choose anything, but it also does not type anything.
I mean, it does not write the entry type, nor it write the date.
In particular I want it to write the year of publication, and the last author. How can I achieve that?
That’s strange and I can’t reproduce that. It’s probably silently throwing an error. You could try debug on error. Or edebug orb-edit-note, orb--new-note and/or orb--pre-expand-template in this order to get the clue.
Do you use the date (biblatex) or year (plain BibTeX) field in your BibTeX file? Whatever you use, you should put all the keywords you want to expand in orb-preformat-keywords, and of course put the template placeholders where you want them.
That isn’t currently possible, unfortunately, out of the box - it’s either all authors or none. But you can use a custom function in your templates %(my-split-authors ...), which you will need to define yourself. Maybe this thread can be of some help: How to use extracted %^{keywords} from pdf as seperate filetags in note. It’s about splitting the value of the keywords field into separate keywords. You’d want to split the authors field into separate authors…
Thanks a lot for you answer!
I wrote a function that gets the last name of the author, but now I am not sure how to write the template.
I tried many things, but they do not work.
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.