retorquere / zotero-better-bibtex

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

{ in filename makes Bibdesk and Bibtex cry #72

Closed luukvandervelden closed 10 years ago

luukvandervelden commented 10 years ago

I had the following entry in my library:

% Better BibLaTeX: pinned @article{deOliveira2010Liquid, abstract = {(Liquid + liquid) equilibrium (LLE) and binodal curve data were determined for the systems (water + phenol + tert-butanol) at T = 298.15 K, (water + phenol + 2-butanol) and (water + phenol + 1-butanol) at T = 298.15 K and T = 313.15 K by the combined techniques of densimetry and refractometry. Type I curve (for tert-butanol) and Type II curves (for 1- and 2-butanol) were found. The data were correlated with the NRTL model and the parameters estimated present root mean square deviations below 2\% for the system with tert-butanol and lower than 0.8\% for the other systems.}, doi = {10.1016/j.jct.2010.06.007}, issn = {0021-9614}, pages = {1379-1385}, title = {{(Liquid + liquid) equilibrium of {water + phenol + (1-butanol, or 2-butanol, or tert-butanol)} systems}}, url = {http://www.sciencedirect.com/science/article/pii/S0021961410002107}, volume = {{42}}, options = {useprefix}, number = {11}, journaltitle = {{The Journal of Chemical Thermodynamics}}, shortjournal = {{The Journal of Chemical Thermodynamics}}, author = {de Oliveira, Leonardo Hadlich and Aznar, Martín}, urldate = {2013-04-01}, date = {2010-11}, year = {2010}, keywords = {(Liquid + liquid) equilibrium,Experimental,NRTL,Phenol}, file = {de Oliveira and Aznar - 2010 - (Liquid + liquid) equilibrium of {water + phenol +.pdf:/Users/luuk/Documents/Literature/Zotero/de Oliveira and Aznar - 2010 - (Liquid + liquid) equilibrium of {water + phenol +.pdf:application/pdf} }

I use Zotfile to rename the file, which ends up not in the Zotero base folder but somewhere else (so Devonthink can index it etc :)).

After I've renamed the entry's title in Zotero to something without { and }, the problem with Bibdesk/Bibtex still exist. After I've let Zotero rename the file accordingly (so the { and } are not in the filename anymore), the problem was gone.

So:

retorquere commented 10 years ago

Can you make a "Zotero TestCase" export of the entry with the braces in the filename, and put it in a gist?

retorquere commented 10 years ago

When I have braces in the filename, they get escaped to '{' and '}'.

luukvandervelden commented 10 years ago

https://gist.github.com/awesomeindustries/86205ff838677a2b2976

doeswork.bib is without {} in filename, exported from Zotero.

doesnotwork.bib is with {} in filename.

retorquere commented 10 years ago

I need an export done with the "Zotero TestCase" translator, not with the "Better Bib(La)TeX" translator.

retorquere commented 10 years ago

If you add a file that has braces in the name to a reference using BibDesk itself, how does it encode the path? I cannot test myself as I have no access to a Mac.

retorquere commented 10 years ago

If I try to add a file with unbalanced braces using JabRef, it simply won't allow me. If this is valid behavior, there is nothing much I can do about this except perhaps silently drop such files from the export.

luukvandervelden commented 10 years ago

Sorry, did not read carefully. https://gist.github.com/awesomeindustries/480082e07ce132adbd78

luukvandervelden commented 10 years ago

This is an Bibtex entry made from BibDesk itself. The filename has a {} in it. https://gist.github.com/awesomeindustries/884a2c6e5d2e084a2fd4

"What are all these Bdsk-File-* and Bdsk-Url-* fields that appear in my bibtex file? BibDesk uses the Bdsk-File-* and Bdsk-Url-*fields to save location information for linked files and linked URLs, respectively. These are the linked files and URLs that appear as icons on the right-hand side pane of the main window and the detail window. Files are now stored using Mac OS aliases, so you can move them in the Finder without breaking BibDesk's links."

retorquere commented 10 years ago

No problem. I see now that the translator does what I expected it to do, but I'm don't know what BibDesk does with braces in file names (I can't test).

Edit: Nice, non-standard bibtex :( I'll see what I can do.

It also means that BibDesk bibtex files are inherently non-portable. Ugh.

retorquere commented 10 years ago

OK, so these aliases are some sort of symlink. There's no way for me to generate those from a translator, alas (translators are sandboxed by Zotero). The best I can do is the drop filenames with braces.

luukvandervelden commented 10 years ago

Perfect option. Braces in a filename (or title) or not common. Dropping the filename and noting in the 'how to guide' to avoid braces is good enough right? Thanks for your effort, I'll close this Issue!

retorquere commented 10 years ago

It ain't closed until the tests pass :) I've started a while ago ading a test for each issue report, and it's been a tremendous help in preventing regression. Can you test whether the entra at https://gist.github.com/AllThatIsTheCase/7b2d4351d4aa12595ffc is correctly parsed by BibDesk?

luukvandervelden commented 10 years ago

I've pulled the .bib file, but what pdf-filename should it link to?

retorquere commented 10 years ago

None; it can't. As long as it imports without error, it's fine; if you look in the bib file the filename is there but in a field BibDesk will ignore