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.
@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.
Upgrade Storage
{gets removed in the process).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.)
filefields 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
filefields in Mendeley-generated bibtex must be parsed non-verbatim.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.
So if there's no other way to solve this, we can strip braces in
file. Anything else we need to strip?https://github.com/retorquere/zotero-better-bibtex/blob/master/translators/bibtex/entry.ts#L887-L904