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

Replicate Zotero key algorithm #439

Closed retorquere closed 8 years ago

retorquere commented 8 years ago

@noehmeier: I'm looking at the Zotero BibTeX translator code and it only uses the first creator, never more than one. Can you get me that sample I requested in #438? I can't replicate your key.

retorquere commented 8 years ago

@noehmeier wrote:

BibTeXs citation key has seperators in the authors name: authorpart1_authorpart2_title_2016 firstauthorlastname-secondauthorlastname_title_2016

Better BibTeXs citation key removes the seperators/spaces: authorpart1authorpart2_title_2016 firstauthorlastnamesecondauthorlastname_title_2016

I can't replicate this. I'm looking at the Zotero-standard Bib(La)TeX generators, and they both use only the last name of the first creator -- no multiple creators, no firstnames. If you could right-click a reference where the standard Zotero exporter does what you want, but BBT-not, then select "send BBT error", you'll get a debug ID. If you post that here, I'll have a sample refernce I can use to try and replicate this.

retorquere commented 8 years ago

Could it be you have a modified version of the standard exporters?

noehmeier commented 8 years ago

Sorry for my late anwser, i was out of city. I haven't installed it here on the Windows pc, but i have the default Zotero here. When i export it on Windows / Mac, its the same result, so i think its the default Zotero export. Until i can access my Mac, here (maybe) some help at the attached pictures

zotero-export-window

zotero-export-file

.

retorquere commented 8 years ago

But none of these show multiple authors or first names. There won't be any difference on a mac. Can you right-click a reference where this happens and click "report bbt error"? It will give me the reference to test with.

noehmeier commented 8 years ago

The second shows firstname. The last a minus (-) if there is a double-name. Otherwise there are underscores (_). Not shown, but if there are blanks in the name, like "Harvard Law Review", there will be harvard_law_review the result. Also, if there is no date, at the end are four ???? (this is at yours also missing, but this is not important, because each entry should have a date). If there are special chars at the end of the first word in the title, it also adds this, e.g. title = {Privat! kontrollierte {Freiheit} in einer vernetzten {Welt}}, will produce the title "privat!" (don't know if yours does this also, haven't the result file here).

The "firstauthorlastname-secondauthorlastname_title_2016" i can't also reproduce, i think in my bibfile i had a single author with a double-name like the last example here with the minus and thought it would be two authors, sorry.

I will click the button on the Mac where your plugin is installed when i have access to it.

retorquere commented 8 years ago

The second doesn't technically have a first name, but a single-field name, in which case it's treated as a last name.

I'm just going to implement a function that exactly implements the zotero key function rather than emulating it, but I'd still like to have the source references as test cases.

retorquere commented 8 years ago

I've added tests for 1, 2 and 4 of the above; 3 is just an instance of 1. Those tests pass. If would appreciate it if you could give https://s3.eu-central-1.amazonaws.com/zotplus-builds/zotero-better-bibtex-1.6.33-travis-2416.xpi a spin, with the pattern set to [zotero] (nothing else), to see if it gets you the keys you want.

retorquere commented 8 years ago

I remember seeing a message that you tried it, but I don't see it here -- could you confirm to make sure?

retorquere commented 8 years ago

Assuming fixed to satisfaction.