Generated stable keys with better-bibtex
Hello to all
Background:
I currently use Zotero, better-bibtex and emacs. This question can be answered without knowing emacs.
To insert a citation, I just need to do the command "org-cite-insert", which allows me to insert something like this :
[cite:@a-key]
Here, the key obviously refers to the right reference in zotero.
Unfortunately, my key generation depends on the author, a date or whatever: it is modified if I modify the reference. In my documents, it will always be marked "[cite:@a-key]", and not "[cite:@a-new-key]" (because I change a field in the reference). And so, org-mode doesn't recognize my key anymore.
So my question is:
How to randomly and stably generate the keys, even if I change a field of my reference (name, date etc) ?
I didn't find a clear explanation about this, the only method I can use is to put a key generation that gives an empty result, so I would have keys with this : zotero-1, zotero-2 etc. I find the solution not very clean.
Does anyone have a better solution?
(maybe I missed something in the documentation, and I didn't pay attention)
PS : the keys can be anything, it could simply be the date with a precision to the second, or why not a uuid (a bit long maybe ?). It should not be a meaning, but unique and it should never change.
Thanks in advance for your answer.
Background:
I currently use Zotero, better-bibtex and emacs. This question can be answered without knowing emacs.
To insert a citation, I just need to do the command "org-cite-insert", which allows me to insert something like this :
[cite:@a-key]
Here, the key obviously refers to the right reference in zotero.
Unfortunately, my key generation depends on the author, a date or whatever: it is modified if I modify the reference. In my documents, it will always be marked "[cite:@a-key]", and not "[cite:@a-new-key]" (because I change a field in the reference). And so, org-mode doesn't recognize my key anymore.
So my question is:
How to randomly and stably generate the keys, even if I change a field of my reference (name, date etc) ?
I didn't find a clear explanation about this, the only method I can use is to put a key generation that gives an empty result, so I would have keys with this : zotero-1, zotero-2 etc. I find the solution not very clean.
Does anyone have a better solution?
(maybe I missed something in the documentation, and I didn't pay attention)
PS : the keys can be anything, it could simply be the date with a precision to the second, or why not a uuid (a bit long maybe ?). It should not be a meaning, but unique and it should never change.
Thanks in advance for your answer.
Select all the items you want to remain the same, then right click, go to Better BibTeX, and select Pin BibTeX Key.
You can undo this in the future with Unpin, but if you changed the name or date while it was pinned, it will not automatically change it when you unpin it. For that, you will have to Refresh the key.
I saw the possibility of pin, the problem being that it is a manual step, I find it surprising that there is not an option(I read the second message, and there is a practical option). I also have a problem: in the options, it says: On conflict with a pinned key, not pinned keys will be "kept" or "postfixed". So, if I understand correctly, if a key is pinned, when adding a reference, there can be a conflict. One more manual step. Isn't there a way to generate these keys otherwise?
Moreover, I have another question: why do you need to have control over the generation of your keys? They must be unique, so why not generate a simple uuid? Is it to know which reference they are linked to ? (I don't have this problem with my software, I click on it and it shows me all the fields of the reference)
You can have BBT pin the existing, generated key, and there should be no conflicts, but you can pin the key to whatever you buy manually typing the key. If you enter a key that way, or if you import a bib file that has a key that you already have in your library, you have to tell BBt what to do with these existing, non-pinned keys. If BBT generated
heyns2022
, and you import or manually type a keyheyns2022
for a different entry, you now have two items with the same key. BBT can leave it that way, or it can postfix the existingheyns2022
so you have unique keys.But whatever you pin stays pinnned. You could have every item in your library pinned to
heyns2022
, and this option would do nothing.That just tells me you don't use LaTeX for document authoring. Keys are meaningfully part of the text to LaTeX users, and between
and
the first is easy to type by hand (which is what many LaTeX users like me do, without opening the bib file), and allows me to meaningfully review my text, where the second is gibberish, and I'd have to look it up every time I wanted to add a reference.
then you don't meaningfully use bibtex, and bib files are just a transport mechanism in your toolchain.