retorquere / zotero-better-bibtex

Make Zotero effective for us LaTeX holdouts
https://retorque.re/zotero-better-bibtex/
MIT License
5.43k stars 291 forks source link

select-link with non-existent citekeys select all items #2109

Closed laurastephsmith closed 2 years ago

laurastephsmith commented 2 years ago

Hi. I'm trying to get my citekeys into this format:

If one author: surname-2022
If two authors: surname-and-surname-2022
If three authors: surname-surname-and-surname-2022
If more than three authors: surname-etal-2022

I've found the bit of the docs I think I need:

$author, +<joinchar>: Author/editor information. Parameters are: - creator: author or editor, - initials: whether to add initials or to only use initials, - letters: pick this many letters from the name, defaults to 0 = all, - select: select these authors, number or range (inclusive); negative numbers mean “from the end”, default = 0 = all, - given: use given name instead of family name, - etal: use this term to replace authors after etalafter authors have been named, - etalafter: add the etal if there are more authors selected that - joiner: use this character to join authors

But I'm struggling to understand the syntax. I have this [authors+-]-[year] outputting Szabo-Burns-Lantrip-2022. I'm now trying to add etal and etalafter=3. I've tried:[authors:etal:etaafter=3]-[year], [authors:etal,etalafter=3]-[year], [authors+-etal,etalafter=3]-[year] and various other combinations of +/:/-/., but I clearly don't know what I'm doing because the "Citation key format" box goes orange and doesn't let me save it!

Thanks for your help.

Support log ID: 72WF67SG-refs-euc

retorquere commented 2 years ago

The docs are out of sync alas - I have a change lined up that will what you want possible, but I expect to take a few more days to get it ready for release.

laurastephsmith commented 2 years ago

The docs are out of sync alas - I have a change lined up that will what you want possible, but I expect to take a few more days to get it ready for release.

Oo that's wonderful, thank you :). I'm in no rush. I've been playing around with different ideas and decided I'd like the title in it too, in the format every-word-with-hypens - is that possible too? So in total it would be:

If one author: surname-2022-every-word-of-the-title-no-caps-hypens-not-spaces-but-stripped-of-punctuation
If two authors: surname-and-surname-2022-every-word-of-the-title-no-caps-hypens-not-spaces-but-stripped-of-punctuation
If three authors: surname-surname-and-surname-2022-every-word-of-the-title-no-caps-hypens-not-spaces-but-stripped-of-punctuation
If more than three authors: surname-etal-2022-every-word-of-the-title-no-caps-hypens-not-spaces-but-stripped-of-punctuation

Might seem a bit odd. But my rationale is that in Obsidian I can use that as the title of the note, and put the human-readable version in the display text, for example: `[[surname-2022-every-word-of-the-title-no-caps-hypens-not-spaces|Surname et al. 2022]] Then I can do Scan Markdown file for references in Zotero and it'll still be able to match it. Does that seem sensible? I'm only on day three of using Zotero, so happy to be told I'm barking up the wrong tree (as we say in the UK!)

laurastephsmith commented 2 years ago

I've been tinkering some more, and realised that I can keep most of the name of my Obsidian notes in human-readable format and just put the citekey at the end. So I realise I actually want the shortest citekey possible really!

So I've now got my citekey as: bratmanetal2015 And this as my note name: Bratman et al. (2015) ‘Nature experience reduces rumination and subgenual prefrontal cortex activation’ (@bratmanetal2015)

So thanks very much for looking at this, but I've realised I don't need what I asked how to do in the first place. All a learning curve, hey! Thanks for a great plugin :)

github-actions[bot] commented 2 years ago

Thanks for the feedback; there's no way you could have known, but @retorquere prefers to keep bugreports/enhancements open as a reminder to merge the changes into a new release.

laurastephsmith commented 2 years ago

Awesome bot!

retorquere commented 2 years ago

That's the first time I heard that! 😄

laurastephsmith commented 2 years ago

That's the first time I heard that! smile

Haha! It hassles politely :-D. Can I set the citekey as the Zotero key? In other words, PFFCF6SB from zotero://select/library/items/PFFCF6SB?

retorquere commented 2 years ago

Not currently.

retorquere commented 2 years ago

The other way around does work BTW; zotero://select/library/items/@citekey

laurastephsmith commented 2 years ago

The other way around does work BTW; zotero://select/library/items/@citekey

Oo that's good to know, thanks. I've settled on using the DOI or ISBN as the citekey where those exist (slash converted to hyphen), and I'm really happy with that. Thanks for all your work on the plugin!

laurastephsmith commented 2 years ago

FYI on my setup, zotero://select/library/items/@doi-10.1073-pnas.1510459112 and zotero://select/library/items/doi-10.1073-pnas.1510459112 both select everything in my library, not just the one item!

5FBYUHH2-refs-euc - the item with the citekey above. JP7QMN3H-refs-euc - one of the other items that also gets selected by mistake.

retorquere commented 2 years ago

I see that happening too, but this seems to be a Zotero behavior; I don't do anything with the second link, so that's definately Zotero, and for the first, when I cannot find the citekey, I pass back to Zotero, and you get the same behavior as with the 2nd URL. I could perhaps generate an error when I see an @ but cannot find the key.

laurastephsmith commented 2 years ago

Sorry, I'm not quite with you. Are you saying you get the same behaviour I got with the one without the @?

retorquere commented 2 years ago

Zotero has changed the behavior of select links. zotero://select/library/items/<something> will now select group <something> if it is present, and the user library if not. That is the behavior you're seeing. The only route BBT can patch in Zotero is now zotero://select/items/<something>, and that should select the single item pointed to by <something>, which can be an @citekey when BBT is installed.

github-actions[bot] commented 2 years ago

:robot: this is your friendly neighborhood build bot announcing test build 6.4.3.2403 ("parseLibrarKey")

Install in Zotero by downloading test build 6.4.3.2403, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

retorquere commented 2 years ago

Will you take it up with Zotero? This is really not something BBT does.

laurastephsmith commented 2 years ago

Sure!

retorquere commented 2 years ago

This is not something I can do anything about.