Zotero-better-bibtex: Extra Braces Added on Export

Created on 14 Sep 2016  ·  6Comments  ·  Source: retorquere/zotero-better-bibtex

Hello,

I've started using BetterBibtex for my citation needs, however at the moment it seems a bit overzealous in protecting titlecase that might already exist in the title of an imported journal article. Currently, with version 1.6.75, if an imported article is stored in sentence case, the current behavior is correct in that it will upgrade the the title to titlecase correctly. However, if the imported journal article is already stored in title case, BetterBibtex tries its darnedest to protect words that do not need to be protected. As an example, import 10.1104/pp.114.254664, which results in the following title being exported:

title = {Unique {{Aspects}} of the {{Structure}} and {{Dynamics}} of {{Elementary I}} {\emph{$\beta$}} {{Cellulose Microfibrils Revealed}} by {{Computational Simulations}}},

This is what I would instead like to see:
title = {Unique Aspects of the Structure and Dynamics of Elementary {I\emph{$\beta$}} Cellulose Microfibrils Revealed by Computational Simulations},

The reason for this is that most journals I submit to expect titles to be submitted in sentence case, which BibTex can nicely take care of if the capitalization is left unprotected, but causes alot of grief if many of my imported titles are protected from demotion to sentence case by the extra braces. I don't expect my behavior to be the default, but I would certainly like the option of fixing the few times something was left unprotected that should have been protected by script rather than removing many, many unneeded braces.

Thanks!

P.S. Why are all of these protections double braced? Only one additional set of internal braces is needed to prevent bibtex or biblatex from mutilating internal capitalization.

question

Most helpful comment

Zotero recommends storing references in sentence case (it's what their own citation processor expects); you can right-click the title text to change it to sentence case. BBT exports references with that recommendation on mind, knowing Bib(La)TeX expects title case (for English references only btw, and references without a language set are assumed to be English by BBT).

I can't distinguish between a reference being stored in title case and it containing words that are intentionally capitalized and which do need to be protected (like IEEE proceedings), but Zotero already has a method to protect parts you don't want case manipulation on - anything that is enclosed with <span class="nocase">...</span> won't be touched by zotero or bbt.

The double rather than single braces are because the Bib(La)TeX case protection rules are incredibly convoluted, see e.g. https://github.com/retorquere/zotero-better-bibtex/issues/541 and https://github.com/retorquere/zotero-better-bibtex/issues/383 . Did you know for example that {\emph{Homo sapiens}} does _not_ case-protect Homo sapiens? It sure was a surprise to me. The double-bracing is the only unambiguous rule we could construct that consistently got the rendered reference right. Oh, and craziness like https://github.com/retorquere/zotero-better-bibtex/issues/541#issuecomment-240156274, where the casing behavior over the _whole_ title depends on whether there's a slash-command at the first position of the title. Or that https://github.com/retorquere/zotero-better-bibtex/issues/541#issuecomment-240999396 makes that Reading HLA Hart's: <i>The Concept of Law</i> really only renders well if you spit out the astoundingly ugly {Reading {{HLA Hart}}'s: {{{\emph{The Concept}}}}{\emph{ of }}{{{\emph{Law}}}}}

Bib(La)TeX provides (by way of the knowledge @nickbart1980 brings in -- I really don't know Bib(La)TeX too well) a never-ending stream of edge cases, which BBT tries to decide algorithmically. I try to keep the resulting file as pretty as I can (I'm sensitive to the aesthetics myself), but the target is best described as "given reasonable input, generate well-rendering output", and reasonable in this case will have to include "follows Zotero recommendations for storing references".

All 6 comments

Zotero recommends storing references in sentence case (it's what their own citation processor expects); you can right-click the title text to change it to sentence case. BBT exports references with that recommendation on mind, knowing Bib(La)TeX expects title case (for English references only btw, and references without a language set are assumed to be English by BBT).

I can't distinguish between a reference being stored in title case and it containing words that are intentionally capitalized and which do need to be protected (like IEEE proceedings), but Zotero already has a method to protect parts you don't want case manipulation on - anything that is enclosed with <span class="nocase">...</span> won't be touched by zotero or bbt.

The double rather than single braces are because the Bib(La)TeX case protection rules are incredibly convoluted, see e.g. https://github.com/retorquere/zotero-better-bibtex/issues/541 and https://github.com/retorquere/zotero-better-bibtex/issues/383 . Did you know for example that {\emph{Homo sapiens}} does _not_ case-protect Homo sapiens? It sure was a surprise to me. The double-bracing is the only unambiguous rule we could construct that consistently got the rendered reference right. Oh, and craziness like https://github.com/retorquere/zotero-better-bibtex/issues/541#issuecomment-240156274, where the casing behavior over the _whole_ title depends on whether there's a slash-command at the first position of the title. Or that https://github.com/retorquere/zotero-better-bibtex/issues/541#issuecomment-240999396 makes that Reading HLA Hart's: <i>The Concept of Law</i> really only renders well if you spit out the astoundingly ugly {Reading {{HLA Hart}}'s: {{{\emph{The Concept}}}}{\emph{ of }}{{{\emph{Law}}}}}

Bib(La)TeX provides (by way of the knowledge @nickbart1980 brings in -- I really don't know Bib(La)TeX too well) a never-ending stream of edge cases, which BBT tries to decide algorithmically. I try to keep the resulting file as pretty as I can (I'm sensitive to the aesthetics myself), but the target is best described as "given reasonable input, generate well-rendering output", and reasonable in this case will have to include "follows Zotero recommendations for storing references".

Thanks for the explanation! Now I'll need to find myself an addon that automatically at least attempts to sentence case titles that don't conform, and eliminate the extra clicks!

I've taken stabs at it before, but the UI work to make it usable is not my
forte. More of a backend guy myself (as you'll see in the preferences pane)

If you find something that comes close, let me know.

Unfortunately, I couldn't find a plugin that did what I wanted, and I never learned Javascript. I do, however, know enough python to be dangerous, so I now handle the capitalization after its been synced to the server. Its brutally hacky and will fail occasionally, but it has enough extra logic for it not to demote words I want to keep capitalized and to demote words if the title is mostly capitalized.
fixzotero.txt

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings