retorquere / zotero-better-bibtex

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

Debugging translator issue for PhD Dissertation type #1950

Closed resistor4u closed 2 years ago

resistor4u commented 2 years ago

I'm using Thesis in Zotero's Item Type field for all my PhD Dissertations, and PhD Dissertation (no punctuation) in the Type. Using either pandoc or knitr, the refs cited entry shows as {{PhD Dissertation}}. Changing the entry in Zotero and the biblio.bib file to dissertation, Ph.D. Dissertation, or any other variant produces similar results. My expectation is that, minimally, the entry would not be bounded in {} but would appear as whatever the citation style requires, e.g., Ph.D. Dissertation, PhD Dissertation, Doctoral Dissertation, or whatever. When BBT translators are updated in Zotero, sometimes the problem goes away and some updates bring it back. So, I'm guessing the issue is with BBT translators, but maybe also with the csl stylesheets (if any are given).

The bibtex manual specifies @phdthesis as a particular type, so the question is: How should the entry be recorded in Zotero or what can be done to restore some consistency to how Ph.D.'s appear in refs section?

Here's the support log ID, but not sure it's relevant: 9GVBD9ZB-refs-euc

Paste the following into test.md and test.bib for an MRE:

---
title: "My dissertation"
bibliography: "./test.bib"
biblio-style: apalike
listoffigures: True
numbersections: True
reference-section-title: References
output:
  officedown::rdocx_document:
    reference_docx: ../../../reference.docx
    md_extensions: +footnotes+table_captions+multiline_tables+escaped_line_breaks
---

# First section

Test reference, according to Woodson [-@woodsonToutMounnSe1990].

and for the test.bib:

@phdthesis{woodsonToutMounnSe1990,
  type = {Dissertation},
  title = {Tout {{Mounn S\'e Mounn}}, {{Men Tout Mounn Pa Menm}}: Microlevel {{Sociocultural Aspects}} of {{Land Tenure}} in a {{Northern Haitian Locality}}},
  author = {Woodson, Drexel G.},
  year = {1990},
  address = {{Chicago, IL}},
  school = {Department of Anthropology, The University of Chicago},
  keywords = {ethnography,Haiti,land tenure,peasants}
}
resistor4u commented 2 years ago

after experimenting with some static files, i think the translator might be a bit overzealous with inserting { and } around items, e.g., Ph.D. Dissertation becomes {Ph.{{D}}. {{Dissertation}}} etc., and when removing additional brackets from the .bib file, pandoc and knitr just spit out Ph.D. Dissertation. Is this, then, a translator issue?

retorquere commented 2 years ago

When BBT translators are updated in Zotero, sometimes the problem goes away and some updates bring it back.

I'd have to know for which versions this was the case. The handling of the type field in the bibtex translator hasn't changed in ages.

So, I'm guessing the issue is with BBT translators, but maybe also with the csl stylesheets (if any are given).

CSL styles do not affect BBT. But if you're using pandoc to generate docx, Better CSL JSON is a much better choice than bibtex.

The bibtex manual specifies@phdthesis as a particular type, so the question is: How should the entry be recorded in Zotero or what can be done to restore some consistency to how Ph.D.'s appear in refs section?

For the current release, either phdthesis or phd (case insensitive). Build 1655 will drop here in 10 minutes or so that adds heuristics that will pick (a.o.) the variants you listed above.

Here's the support log ID, but not sure it's relevant: 9GVBD9ZB-refs-euc

It is. It makes sure we're looking at the same concrete sample rather than discussing misleading hypotheticals, and if there is something to fix (as there was now), this sample gets added to my test suite so that later changes can't cause (unnoticed) regressions. If you have tips on how to explain this aspect better in the issue template, that'd be very welcome. The request for a support log really is there for a reason; it saves me massive amounts of time and frustration in getting to the point of the issue. The test is tagged with the issue number, so if a breaking change is ever needed, I can inform the users that reported the issue (in this case, @murmlgrmpf from issue #435, and @sanmame from issue #565) who will likely be affected by the change, and I can discuss workarounds with them if needed.

after experimenting with some static files, i think the translator might be a bit overzealous with inserting { and } around items, e.g., Ph.D. Dissertation becomes {Ph.{{D}}. {{Dissertation}}}

BibTeXing (page 6, point 7) suggests the type should get case protection, in which case this behavior would be correct; Tame the Beast doesn't say anything in this regard about the type field. @njbart? But it seems to me that for a dis you just want the type field gone and the entry type set to @phdthesis, and build 1655 will do that.

github-actions[bot] commented 2 years ago

:robot: this is your friendly neighborhood build bot announcing test build 5.5.3.1655 ("more test case updates")

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

resistor4u commented 2 years ago

@retorquere thanks for the heads up about Better CSL JSON. I will read into it before bed tonight. Meantime, I've installed and tested build 1655. All the type fields are gone for PhD entries in the Zotero .bib file, and they're set to @phdthesis, but after knitting or running pandoc all those phd entries get rendered as PhD thesis in the refs.

retorquere commented 2 years ago

Thanks for the confirmation, much appreciated.

after knitting or running pandoc all those phd entries get rendered as PhD thesis in the refs.

I don't think I can do much about that - I don't know what CSL pandoc translates this to.