retorquere / zotero-better-bibtex

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

Second italic word in title gets upper case in BibLatex export #3015

Closed eberlejonas closed 1 month ago

eberlejonas commented 1 month ago

Debug log ID

ZPUZ8HBI-refs-euc/6.7.240-6

What happened?

In my Zotero library, I have entries containing species names which are composed of an upper case genus epthet and a lower case species epithet. Both should be in italics.

In the Zotero title field, it looks like this: Kairomone response in <i>Thanasimus</i> predators to pheromone components of <i>Ips typographus</i>

In my file that I export via Better BibLaTeX, I get the following: title = {Kairomone Response in {{{\emph{Thanasimus}}}} Predators to Pheromone Components of {{{\emph{Ips}}}}{\emph{ Typographus}}} Note the upper case last word. I attached the output *.bib file.

Exported Items.bib.txt

I expect it to be lower case and both word to be in one \emph-command: {\emph{Ips typographus}}

Thank you for your quick reply to my opened discussion https://github.com/retorquere/zotero-better-bibtex/discussions/3014#discussion-7271360

retorquere commented 1 month ago

I can understand the surprise, but that is actually correct. Bib(La)TeX expects Title Case titles, and since typographus is not case-protected, it gets converted to Title Case. For things like proper nouns in all-lowercase, you will want to have something like

Kairomone response in <i><span class="nocase">Thanasimus</span></i> predators to pheromone components of <i><span class="nocase">Ips typographus</span></i>

that's not pretty, but this is how Zotero expects it. Your original input would also have gone wrong if you render it to a Title-Casing style with Zotero itself (I believe Chicago does this), and the way to protect against it is this same way.

If you want to have all <i>...</i> behave like <i><span class="nocase>...</span></i>, I can write you a postscript that does that during export.

retorquere commented 1 month ago

You can turn that behavior off if you want to though:

https://retorque.re/zotero-better-bibtex/installation/preferences/export/index.html#apply-title-casing-to-titles https://retorque.re/zotero-better-bibtex/installation/preferences/export/index.html#apply-case-protection-to-capitalized-words-by-enclosing-them-in-braces

eberlejonas commented 1 month ago

Ah, I see. That makes sense.

I can live with the suggested workarounds for now. However, I guess all biologists out there will sooner or later run into this issue. Since the case-changing behaviour does make sense, the cleanest solution would probably be to have an option in a future version to suppress case-changing for italicized words, like you proposed.

Many thanks for pointing this out! It would have taken me a long time to figure it out.

retorquere commented 1 month ago

I am not adding an option to suppress case-changing for italicized words. I would be happy to post a postscript that does it though, that would just be added to https://retorque.re/zotero-better-bibtex/exporting/scripting/index.html

eberlejonas commented 1 month ago

Sounds good to me. This would be much appreciated, since we are talking of hundreds of papers. Thanks!

retorquere commented 1 month ago

https://retorque.re/zotero-better-bibtex/exporting/scripting/index.html#case-protect-italicized-text

mind that this only works for BBT export. If you render your bibliography in Word or LibreOffice in a title-case style, that will still uppercase the T.

eberlejonas commented 1 month ago

That works perfectly! Thank you!