EDIT 03/09/24 It turns out there are some related elements that’s worth putting together here:
- this post on this platform deals with a similar effect with
:PROPERTIES:
being added in a separate drawer. Somehow related (like in my case) with the use of prompts - this issue report deals with the same topic
Hi, first post here, go easy on me
I would like to implement a Zettelkasten or slip-box and I am now focusing on creation of the bibliographical notes. These are, in my definition, a single note per paper/book/web-page, containing a :ROAM_REFS: property wich either has - automagically created - a CITEKEY citation link or a web address in case of a web publication like a blog post, tutorial, you name it.
As far as the CITEKEY part is concerned, I have found a way to obtain a first success, doing the following:
- install
biblio
, to be able to search and insert records in one’s bib file by drawing info from databases like CrossRef and the like. - install
org-roam-bibtex
andivy-bibtex
. The first should integrate bibtex-like bibliographical information into org-roam nodes and templates, while the latter is a completion system to browse one’s bib files, but also ultimately gave me “the key” to a bibliographical note. M-x ivy-bibtex
, then insert a few words, select the target record,M-o e
to effectively create a note.
Having activated org-roam-bibtex-mode
(BTW, how to do it by default? Is it not default because I am not in an org
buffer to start with?) the associate note editing function called from within ivy-bibtex
does what is needed at a basic level:
Now, I would like to add two custom features, namely:
- Store this type of notes in a sub-folder and not where my other “main nodes” reside
- Add some keywords in the property drawer
That’s where the issues arise and where I need your wisdom
I could not trace back where the templates are defined/used for the specific note creation function, so I have tried to add another template to the default, in order to be able to implement those customizations. The relevant init.el
portion looks then like this:
(use-package org-roam
:ensure t
:custom
(org-roam-directory "m:/ZK")
(org-roam-capture-templates
'(("d" "default" plain
"%?"
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
:unnarrowed t)
("r" "reference" plain
"%?"
:if-new (file+head "reference/${citekey}.org"
":PROPERTIES:
:KEY:
:ROAM_REFS:[cite:@${citekey}]
:END:
#+title: ${title}\n")
: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))
:config
(org-roam-db-autosync-enable)
)
I added a new template that saves the note in a different location with the ${citekey}
variable as file name, then it should add a bunch of properties, among which I just tried to define a test one, “KEY”. It’s just a try at this point.
However, what comes out is this:
:PROPERTIES:
:ID: 6a4f9129-488b-44b3-9a8e-e5722dea9902
:ROAM_REFS: cite:Lou
:END:
:PROPERTIES:
:KEY:
:ROAM_REFS:[cite:@Lou]
:END:
#+title: Design of cmos rf low-noise amplifiers and mixer for wireless applications
The note is created in the location I indicated, so this is good.
However, the original template (the one I don’t know where it’s located or how to modify) is not extended, it is just put there, closed with the :END:
and then my stuff is appended.
Of course then the second :ROAM_REFS:
key is totally redundant, I could just remove it from the template, but I’d still like to have the extra properties before the :END:
.
Finally, the question: how do I handle the creation of notes via a more flexible template, that adds properties where they should normally go?
Maybe I should just settle for adding properties after the #+title
line, with the alternative
+#PROPERTY
syntax and be happy?
Any comments, thoughts and suggestions very welcome!!
Michele
P.S.
I found this very elegant solution by Jethro Kuan, which however I would have to adapt to work with ivy-bibtex
and not citar
, as I don’t have it and would not llike to add another package just for this…