-
Notifications
You must be signed in to change notification settings - Fork 54
Searching using Zotero's collections
When using https://github.com/retorquere/zotero-better-bibtex, Zotero's collection are exported as "groups" in the bib file. As explained in https://github.com/emacs-citar/citar/issues/769#issuecomment-2483019322 and https://github.com/emacs-citar/citar/issues/741, " the groups fields are parsed, and so stored in the cache". To use them in searches (and/or to narrow searches) all you need to do is add "groups" to the citar-templates
.
This is a simple example.
First, create this bibtex file: test1.bib
@article{ag1,
title = {One title by one author},
author = {Someone},
groups = {Group1}
}
@article{ag2,
title = {The first paper by the second author},
author ={AuthorB},
groups = {caracol}
}
@article{ag3,
title = {This title by second author has a different group},
author ={AuthorB},
groups = {hola}
}
Now, emacs -Q
and:
-
M-x package-initialize
(citar, vertico, and orderless are installed) M-x vertico-mode
- Evaluate
(setq citar-bibliography '("~/tmp/test1.bib"))
(setq completion-styles '(orderless basic))
And also evaluate this citar-templates
definition
(setq citar-templates
'((main . "${author editor:30%sn} ${date year issued:4} ${title:48}")
(suffix . " ${=key= id:15} ${=type=:12} ${tags groups keywords:*}")
(preview . "${author editor:%etal} (${year issued date}) ${title}, ${journal journaltitle publisher container-title collection-title}.\n")
(note . "Notes on ${author editor:%etal}, ${title}")))
This is copied from https://github.com/emacs-citar/citar#templates, but we add "groups" to "suffix".
-
Open a buffer/file, say test.tex and
M-x citar-insert-keys
-
Start typing
AuthorB
and if you typecara
you select only the ag2 entry. -
Type
hola
(the name of the other group): ag3 is the only selected reference.