retorquere / zotero-better-bibtex

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

Imported name suffix in `family` part #2744

Closed zepinglee closed 10 months ago

zepinglee commented 10 months ago

Debug log ID

6MKZLSYL-refs-apse/6.7.143-6

What happened?

When imported from .bib, the name suffix "Jr." is placed in the family name part and it's not correctly recognized as suffix in the exported CSL-JSON. According to https://forums.zotero.org/discussion/23745, the "Jr." is expected in the given part. The exported CSL-JSON works correctly in the latter format. See also https://forums.zotero.org/discussion/37289 and https://forums.zotero.org/discussion/3271.

BibTeX data:

@BOOK{apa-test.9.46:8,
  AUTHOR = {Costa, Jr., P. T. and McCrae, R. R.},
  DATE   = {2013}
}

Exported CSL-JSON:

            {
                "family": "Costa, Jr.",
                "given": "P. T."
            }

Exported CSL-JSON with "Jr." in given name part:

            {
                "family": "Costa",
                "given": "P. T.",
                "suffix": "Jr."
            }
retorquere commented 10 months ago

Is Jr. a special case then? Because Costa, J. would mean { given: 'J.', family: 'Costa' }.

retorquere commented 10 months ago

@njbart? Do you know if there are more of these special cases?

retorquere commented 10 months ago

Does that mean {MacCallum, III, T.} should parse into { given: 'T.', family: 'MacCallum, III' }?

zepinglee commented 10 months ago

Does that mean {MacCallum, III, T.} should parse into { given: 'T.', family: 'MacCallum, III' }?

No. My understanding is that “III” is also a name suffix as "Jr". In the apa.csl output, { given: 'T.', family: 'MacCallum, III' } becomes MacCallum, III, T. and { given: 'T., III', family: 'MacCallum' } with "III" in the given part gives MacCallum, T., III. as expected in the APA manual.

Screenshot 2024-01-13 at 13 27 47

CSL-JSON:

[
    {
        "id": "apa.9.44:6b",
        "type": "document",
        "language": "en-US",
        "note": "tex.entrytype: nameonly",
        "author": [
            {
                "family": "MacCallum",
                "given": "T.",
                "suffix": "III"
            }
        ]
    }
]
Screenshot 2024-01-13 at 13 26 40
zepinglee commented 10 months ago

Is Jr. a special case then? Because Costa, J. would mean { given: 'J.', family: 'Costa' }.

The btxdoc.pdf says:

To summarize, BibTeX allows three possible forms for the name: "First von Last" "von Last, First" "von Last, Jr, First"

The Jr part is not likely to be confused with First part because it's delimited by the second comma.

If there are more commas, BibTeX will raise an error.

Too many commas in name 1 of "Costa, Jr., P. T., Doe" for entry apa-test.9.46:8
retorquere commented 10 months ago

All right, that's what my parser does, I just stuck the result in the wrong place.

github-actions[bot] commented 10 months ago

:robot: this is your friendly neighborhood build bot announcing test build 6.7.143.2744.5614 ("name split")

Install in Zotero by downloading test build 6.7.143.2744.5614, 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 10 months ago

5614 fixes it. Would appreciate it if you could check it does what you want.

zepinglee commented 10 months ago

It works correctly now.

github-actions[bot] commented 10 months ago

Thanks for the feedback! Just so you know, GitHub doesn't let me control who can close issues, and @retorquere likes to leave bug reports and enhancements open as a nudge to merge them into the next release.

github-actions[bot] commented 10 months ago

:robot: this is your friendly neighborhood build bot announcing test build 6.7.143.2744.5630 ("new texifier")

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