Potential BibLaTeX export bug

I have an entry in my bibliography with a filename that looks a bit fishy, and it seems Zotero does not export a proper BibLaTeX bibliography for it. The exported biblatex entry looks like:

@article{puglia2020,
title = {Electrostatic Control of Phase Slips in Ti Josephson Nanotransistors},
volume = {13},
url = {https://link.aps.org/doi/10.1103/PhysRevApplied.13.054026},
doi = {10.1103/PhysRevApplied.13.054026},
abstract = {The investigation of the switching-current probability distribution of a Josephson junction is a conventional tool to gain information on the dynamics of the phase slips as a function of the temperature. Here we adopt this well-established technique to probe the impact of an external static electric field on the occurrence of phase slips in gated all-metallic titanium (Ti) Josephson weak links. We show, in a temperature range between 20 and 420 {mK}, that the evolution of the dynamics of the phase slips as a function of the electrostatic field starkly differs from that observed as a function of the temperature. This fact demonstrates, on the one hand, that the electric field suppression of the critical current is not simply related to a conventional thermal-like quasiparticle overheating in the weak-link region. On the other hand, our results may open the way to operate an electrostatic-driven manipulation of phase slips in metallic Josephson nanojunctions, which can be pivotal for the control of decoherence in superconducting nanostructures.},
pages = {054026},
number = {5},
journaltitle = {Physical Review Applied},
shortjournal = {Phys. Rev. Applied},
author = {Puglia, C. and De Simoni, G. and Giazotto, F.},
urldate = {2021-04-28},
date = {2020-05-11},
note = {Publisher: American Physical Society},
file = {Full Text PDF:C\:\\Users\\xxx\\Zotero\\storage\\UANW98KE\\Puglia et al. - 2020 - Electrostatic Control of Phase Slips in \$mathrm\{T.pdf:application/pdf;APS Snapshot:C\:\\Users\\xxx\\Zotero\\storage\\IACJQ2VY\\PhysRevApplied.13.html:text/html},
}

Note how the file entry looks like. In particular troublesome is that a "}" is missing, making the record invalid as a biblatex entry. Let me know if I can provide more information.
  • Just to be sure: this is from the standard Zotero export, correct? Not BBT?
  • Yes, that is correct. Version 5.0.96.3
  • edited March 7, 2022
    I'm not sure what they feel should be the desirable behavior here (breakage vs data loss), but if you install BBT, this exports working biblatex code (although the { gets removed in the process).
  • What's the desired behavior? Is the "\{" actually invalid? (I found this — with appearances from two familiar names — asking the same question, but I'm a little clear on the answer.)

    The filename is fine — it just had the misfortune of being truncated in the middle of the "{Ti}", and I guess "\{" isn't properly escaped? If the filename is "C:\Users\xxx\Zotero\storage\UANW98KE\Puglia et al. - 2020 - Electrostatic Control of Phase Slips in $mathrm{T.pdf", how do you represent that in BibTeX without it being broken?

    If you just strip the "{" on export, you have a broken file entry. "{" is valid in filenames, so there's no reason to strip that when renaming the attachment file. ("\" is invalid and was stripped correctly.)
  • edited March 8, 2022
    What's the desired behavior? Is the "\{" actually invalid? (I found this — with appearances from two familiar names — asking the same question, but I'm a little clear on the answer.)
    It's invalid. file fields are parsed in verbatim mode, so the backslash is just a backslash, the brace is just a brace, and you end up with unbalanced braces as a result. The problem with removing the brace (which is what BBT does) is indeed that the filename will not actually point to an existing file, but from my pov that's better than an entry that will break compilation. You just can't have curly braces in filenames, no way around it.

    edit: there is another possible compromise which is to tell biblatex to not treat it as verbatim. Or at least I assume that this can be done, I don't know how. Mendeley makes this assumption and as a result file fields in Mendeley-generated bibtex must be parsed non-verbatim.
  • Meaning that we should just export the "{" without the backslash and it's up to the user to tell biblatex to parse it non-verbatim?
  • I mean... you could obviously, but I wouldn't know how the user would go about that, and it'd mean the result would be broken-by-default, for a niche problem. I'd advice against doing this.
  • I'm not really sure what you're saying here. You just said that was an option, and was what Mendeley does…
  • edited March 8, 2022
    And to be clear, what you're doing in BBT is broken-by-design, since you're stripping a character that's in the filename.

    But maybe your argument is that it's better to have valid BibTeX and maybe the rare broken attachment than the possibility of an entire BibTeX file that won't parse? I could agree with that, if there's no other option.
  • edited March 8, 2022
    Oh sorry, I thought you were proposing making the same mistake as Mendeley, and yes, the rare broken attachment is what I would recommend over the rare bibtex export breaking document compilation. Mendeley's bibtex export is atrocious and should only serve as an example of what happens when engineers don't care about their work.
    And to be clear, what you're doing in BBT is broken-by-design, since you're stripping a character that's in the filename.
    Nolo contendere, but in this case, something must break by necessity, and I will argue that this form of breakage is preferable over the other, since only a few people very well-versed in the workings of bibtex will know how to set up things such that it can be parsed at all. I wouldn't know where to begin myself.
  • I just thought that's what you were suggesting. But I mean, right, I was gonna say that generally we don't look to Mendeley for decisions about data quality…

    So if there's no other way to solve this, we can strip braces in file. Anything else we need to strip?
  • edited March 8, 2022
    Just tested, it's not necessary to strip all braces, only unbalanced braces, nothing else needs to be stripped. I had this wrong too.

    https://github.com/retorquere/zotero-better-bibtex/blob/master/translators/bibtex/entry.ts#L887-L904
  • edited March 9, 2022
    Looks like we already had a fix for this in BibTeX.js, but it just hasn't made it into BibLaTeX.js yet. And we can actually strip the braces in the saved attachment filenames as well, so this won't even result in breakage.
  • This should be fixed now.
Sign In or Register to comment.