retorquere / zotero-better-bibtex

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

Clickable URLs again #169

Closed emelin closed 9 years ago

emelin commented 9 years ago

Hallo best bib(la)tex!

I'd like to use clickable URLs. However they are displayed in the bibliography with some escaped characters rubbisch most obvious for \ or { and }.

I guess this is related to #18 and I might have missed something discussed there. Also I suffer from not being able to read the full warning (being on osx and suffering from #159). The link in the generated .bib files looks like this:

  \verb{url}
  \verb %5Chref%7Bhttp://dx.doi.org/10.1162/comj.2008.32.3.25%7D%7Bhttp://dx.doi.org/10.1162/comj.2008.32.3.25%7D
  \endverb

and appears in the pdf as that:

%5Chref%7Bhttp://dx.doi.org/10.1162/comj.2008.32.3.25%7D%7Bhttp://dx.doi.org/10.1162/comj.2008.32.3.25%7D

I use xelatex, biblatex (style=ieee) and biber as preprocessor (which fetches the .bib file from url).

Thanks for your help.

retorquere commented 9 years ago

Can you right-click on the reference that export to this, select "Report ZotPlus Error", click continue until you see a red URL, and paste that here? I've never seen an entry generated like that, I'd like to try to reproduce it.

emelin commented 9 years ago

Yes, that would be my pleasure, if I only could! After pressing 'continue' I get:

 Error  Status: 403

So, sorry, but better than nothing, I past all the stuff that should probably have been sent silently right here below

preference data of lastSuccess is changed. preference data of lastSuccess is changed. preference data of lastSuccess is changed. timer inited with id: 41 good, got upload response text length: 2765 upload response: 12NxOh1g7APIQ3ftCQZ-n-9reUXNOYyYa24AwKc0XYf9F preference data of lastSuccess is changed. preference data of lastSuccess is changed. preference data of lastSuccess is changed. timer inited with id: 30 good, got upload response text length: 2765 upload response: 12NxOh1g7APIQ3ftCQZ-n-9reUXNOYyYa24AwKc0XYf9F preference data of lastSuccess is changed. preference data of lastSuccess is changed. preference data of lastSuccess is changed. timer inited with id: 29 [JavaScript Error: "TypeError: messageManager is undefined" {file: "resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///Users/admin2/Library/Application%20Support/Firefox/Profiles/vwpg5x22.default/extensions/%7Bb9db16a4-6edc-47ec-a1f4-b86292ed211d%7D.xpi!/bootstrap.js -> resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/context-menu.js" line: 690}] [JavaScript Error: "TypeError: messageManager is undefined" {file: "resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///Users/admin2/Library/Application%20Support/Firefox/Profiles/vwpg5x22.default/extensions/%7Bb9db16a4-6edc-47ec-a1f4-b86292ed211d%7D.xpi!/bootstrap.js -> resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/context-menu.js" line: 690}] [JavaScript Error: "TypeError: messageManager is undefined" {file: "resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///Users/admin2/Library/Application%20Support/Firefox/Profiles/vwpg5x22.default/extensions/%7Bb9db16a4-6edc-47ec-a1f4-b86292ed211d%7D.xpi!/bootstrap.js -> resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/context-menu.js" line: 690}] [JavaScript Error: "TypeError: messageManager is undefined" {file: "resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///Users/admin2/Library/Application%20Support/Firefox/Profiles/vwpg5x22.default/extensions/%7Bb9db16a4-6edc-47ec-a1f4-b86292ed211d%7D.xpi!/bootstrap.js -> resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/context-menu.js" line: 690}] [JavaScript Error: "TypeError: messageManager is undefined" {file: "resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///Users/admin2/Library/Application%20Support/Firefox/Profiles/vwpg5x22.default/extensions/%7Bb9db16a4-6edc-47ec-a1f4-b86292ed211d%7D.xpi!/bootstrap.js -> resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/context-menu.js" line: 690}] [JavaScript Error: "TypeError: messageManager is undefined" {file: "resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///Users/admin2/Library/Application%20Support/Firefox/Profiles/vwpg5x22.default/extensions/%7Bb9db16a4-6edc-47ec-a1f4-b86292ed211d%7D.xpi!/bootstrap.js -> resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/context-menu.js" line: 690}] [JavaScript Error: "TypeError: messageManager is undefined" {file: "resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///Users/admin2/Library/Application%20Support/Firefox/Profiles/vwpg5x22.default/extensions/%7Bb9db16a4-6edc-47ec-a1f4-b86292ed211d%7D.xpi!/bootstrap.js -> resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/context-menu.js" line: 690}] [JavaScript Error: "TypeError: messageManager is undefined" {file: "resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///Users/admin2/Library/Application%20Support/Firefox/Profiles/vwpg5x22.default/extensions/%7Bb9db16a4-6edc-47ec-a1f4-b86292ed211d%7D.xpi!/bootstrap.js -> resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/context-menu.js" line: 690}] [JavaScript Error: "failed to start socket: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIUDPSocket.init]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: resource://gre/modules/SimpleServiceDiscovery.jsm :: _search :: line 159" data: no]" {file: "resource://gre/modules/SimpleServiceDiscovery.jsm" line: 165}]

version => 4.0.26.2, platform => MacIntel, oscpu => Intel Mac OS X 10.10, locale => en-GB, appName => Firefox, appVersion => 36.0.1, extensions => keyconfig (20110522, extension), ZoteroQuickLook (1.3.1, extension), Apollo Sync for Firefox (2.0.1, extension), RTF/ODF Scan for Zotero (1.0.22, extension), Zotero Scholar Citations (1.8.8, extension), DownThemAll! (2.0.18, extension), Zotero automatic export (1.1.9.1, extension), ZotFile (4.1.3, extension), Firebug (2.0.8, extension), MozRepl (1.1.2, extension), zotxt (0.1.27, extension), Video DownloadHelper (5.0.1, extension), Zotero Better Bib(La)Tex (0.8.8, extension), 1Password (4.3.0, extension), OpenH264 Video Codec provided by Cisco Systems, Inc. (1.3, plugin), QuickTime Plug-in 7.7.3 (7.7.3, plugin), Default Browser Helper (600, plugin), AutoPager (0.8.0.10, extension, disabled), Extended Copy Menu (fix version) (1.6.1c, extension, disabled), Readability (2.4, extension, disabled), Download Youtube Videos + (12.9.6, extension, disabled), Zotero autotranslating (1.1.2, extension, disabled), YouTube quality manager (1.2, extension, disabled), SEASR Analytics for Zotero (0.4.7, extension, disabled), Garmin Communicator (4.1.0, extension, disabled), Torbutton (1.4.6.3, extension, disabled), Adobe Acrobat - Create PDF (1.1, extension, disabled), Zutilo Utility for Zotero (1.2.10, extension, disabled), Zotero LibreOffice Integration (3.5.9, extension, disabled), Zotero Plugin to get date from last-modified (0.0.8, extension, disabled), Zotero Storage Scanner Plugin (0.0.15, extension, disabled), Item History for Zotero (1.0.65, extension, disabled), Paper Machines (0.4.9, extension, disabled), Zotero-to-BibDesk auto-import utility (2.0.6, extension, disabled), Xmarks (4.3.5, extension, disabled), Extended Statusbar (2.0.3, extension, disabled), Zotero Bibliography Locale Switcher (1.0, extension, disabled), Context Search X (0.4.6.21, extension, disabled), Pocket (3.0.6, extension, disabled), Abbreviations for Zotero (1.0.201, extension, disabled), Adblock Plus (2.6.8, extension, disabled), Zotero Auto Index (0.0.36, extension, disabled), Zotero Report Customizer (0.2.13, extension, disabled), Flash Video Downloader - YouTube HD Download [4K](7.2.0, extension, disabled), Translator 3.1 Community Toolbar (3.21.0.1, extension, disabled), LogMeIn Plugin 1.0.0.660 (1.0.660, plugin, disabled), Adobe Acrobat NPAPI Plug-in, Version 11.0.0 (11.0.0, plugin, disabled), iPhotoPhotocast (7.0, plugin, disabled), Google Talk Plugin Video Renderer (5.3.1.18536, plugin, disabled), Google Talk Plugin (5.3.1.18536, plugin, disabled), Java Applet Plug-in (Java 7 Update 75, plugin, disabled), Shockwave Flash (16.0.0.305, plugin, disabled), Picasa (1.0, plugin, disabled), Conduit Plugin (1.0, plugin, disabled), Google Earth Plug-in (7.1, plugin, disabled)

{
"config": { "id": "82512813-9edb-471c-aebc-eeaaf40c6cf9", "label": "Zotero TestCase", "release": "0.8.7", "preferences": { "citeKeyFormat": "[auth][year]", "skipfields": [ "" ], "useprefix": false, "preserveCaps": "inner", "fancyURLs": true, "langid": "babel", "attachmentRelativePath": false, "auto-abbrev": true, "auto-abbrev.style": "http://www.zotero.org/styles/cell", "pin-citekeys": "manual", "raw-imports": false, "doi-and-url": "both", "attachmentsNoMetadata": false }, "options": { "exportFileData": false, "exportNotes": true, "Export Collections": true } }, "collections": [], "items": [ { "itemID": 1526, "itemType": "journalArticle", "url": "http://dx.doi.org/10.1162/comj.2008.32.3.25", "volume": "32", "issue": "3", "pages": "25-41", "publicationTitle": "Computer Music Journal", "ISSN": "0148-9267", "date": "August 15, 2008", "callNumber": "0015", "extra": "bibtex: Freeman2008", "journalAbbreviation": "Computer Music Journal", "DOI": "10.1162/comj.2008.32.3.25", "accessDate": "2012-11-02 20:56:05", "libraryCatalog": "MIT Press Journals", "title": "Extreme Sight-Reading, Mediated Expression, and Audience Participation: Real-Time Music Notation in Live Performance", "shortTitle": "Extreme Sight-Reading, Mediated Expression, and Audience Participation", "creators": [ { "creatorType": "author", "firstName": "Jason", "lastName": "Freeman", "fieldMode": "" } ], "notes": [], "attachments": [ { "path": "/Users/admin2/Zotero/storage/8U426WNZ/3.html", "title": "Computer Music Journal Snapshot", "mimeType": "text/html", "url": "http://www.mitpressjournals.org/toc/comj/32/3" }, { "path": "/Users/admin2/Zotero/storage/Z4STTD3N/Freeman - 2008 - Extreme Sight-Reading, Mediated Expression, and Au.pdf", "title": "Freeman - 2008 - Extreme Sight-Reading, Mediated Expression, and Au.pdf", "mimeType": "application/pdf", "url": "" } ], "tags": [], "related": [], "seeAlso": [] } ] }

retorquere commented 9 years ago

How on earth did this hit the Google rate limit? Ugh, time to look for a new error reporting tool. In any case, I could import from the above. Without clickable URLs, it looks like this:

@article{Freeman2008,
  title = {Extreme Sight-Reading, Mediated Expression, and Audience Participation: Real-Time Music Notation in Live Performance},
  volume = {32},
  issn = {0148-9267},
  url = {http://dx.doi.org/10.1162/comj.2008.32.3.25},
  doi = {10.1162/comj.2008.32.3.25},
  shorttitle = {Extreme Sight-Reading, Mediated Expression, and Audience Participation},
  timestamp = {2015-03-20 11:13:13},
  number = {3},
  journaltitle = {Computer Music Journal},
  shortjournal = {Computer Music Journal},
  author = {Freeman, Jason},
  urldate = {2012-11-02},
  date = {2008-08-15},
  pages = {25--41}
}

With clickable urls enabled, it looks like this:

@article{Freeman2008,
  title = {Extreme Sight-Reading, Mediated Expression, and Audience Participation: Real-Time Music Notation in Live Performance},
  volume = {32},
  issn = {0148-9267},
  url = {\href{http://dx.doi.org/10.1162/comj.2008.32.3.25}{http://dx.doi.org/10.1162/comj.2008.32.3.25}},
  doi = {10.1162/comj.2008.32.3.25},
  shorttitle = {Extreme Sight-Reading, Mediated Expression, and Audience Participation},
  timestamp = {2015-03-20 11:13:13},
  number = {3},
  journaltitle = {Computer Music Journal},
  shortjournal = {Computer Music Journal},
  author = {Freeman, Jason},
  urldate = {2012-11-02},
  date = {2008-08-15},
  pages = {25--41}
}

which is what I had expected. Where do you see the \verb{url} ... \endverb generated?

emelin commented 9 years ago

The entries are taken straight from the biber generated .bbl file. Generation happens by:

\usepackage[natbib, isbn=false, doi=false, date=year, style=ieee]{biblatex}
\addbibresource[location=remote]{http://localhost:23119/better-bibtex/collection?/0/AVBBZE2E.biblatex}

The .bbl files starts like this:

% $ biblatex auxiliary file $ % $ biblatex bbl format version 2.4 $ % Do not modify the above lines! % % This is an auxiliary file used by the 'biblatex' package. % This file may safely be deleted. It will be recreated by % biber as required. % \begingroup \makeatletter \@ifundefined{ver@biblatex.sty} {\@latex@error {Missing 'biblatex' package} {The bibliography requires the 'biblatex' package.} \aftergroup\endinput} {} \endgroup

\refsection{0} \sortlist{none}{none} ....

Then after some other entries there is our Freman2008 example as this:

\entry{Freeman2008}{article}{}
  \name{labelname}{1}{}{%
    {{hash=90e6d135eb94066477f416902a329276}{Freeman}{F\bibinitperiod}{Jason}{J\bibinitperiod}{}{}{}{}}%
  }
  \name{author}{1}{}{%
    {{hash=90e6d135eb94066477f416902a329276}{Freeman}{F\bibinitperiod}{Jason}{J\bibinitperiod}{}{}{}{}}%
  }
  \strng{namehash}{90e6d135eb94066477f416902a329276}
  \strng{fullhash}{90e6d135eb94066477f416902a329276}
  \field{sortinit}{0}
  \field{sortinithash}{a08a9549c5c2429f8cec5d1a581b26ca}
  \field{labeltitle}{Extreme Sight-Reading, Mediated Expression, and Audience Participation}
  \field{day}{15}
  \field{journaltitle}{Computer Music Journal}
  \field{month}{08}
  \field{number}{3}
  \field{shortjournal}{Computer Music Journal}
  \field{shorttitle}{Extreme Sight-Reading, Mediated Expression, and Audience Participation}
  \field{title}{Extreme Sight-Reading, Mediated Expression, and Audience Participation: Real-Time Music Notation in Live Performance}
  \field{volume}{32}
  \field{year}{2008}
  \field{pages}{25\bibrangedash 41}
  \verb{doi}
  \verb 10.1162/comj.2008.32.3.25
  \endverb
  \verb{file}
  \verb Computer Music Journal Snapshot:/Users/admin2/Zotero/storage/8U426WNZ/3.html:text/html;Freeman - 2008 - Extreme Sight-Reading, Mediated Expression, and Au.pdf:/Users/admin2/Zotero/storage/Z4STTD3N/Freeman - 2008 - Extreme Sight-Reading, Mediated Expression, and Au.pdf:application/pdf
  \endverb
  \verb{url}
  \verb %5Chref%7Bhttp://dx.doi.org/10.1162/comj.2008.32.3.25%7D%7Bhttp://dx.doi.org/10.1162/comj.2008.32.3.25%7D
  \endverb
\endentry
retorquere commented 9 years ago

Ah, it's in the bbl file! OK, so what would have to appear in the .bib file to get your desired output?

retorquere commented 9 years ago

BTW, the following automatically adds clickable URLs, without "clickable URLs" enabled in BBT:

\documentclass{scrartcl}
\usepackage{url,hyperref}
\usepackage[
useprefix=true,
backend=biber,
natbib,
style=authoryear-icomp,
bibstyle=authoryear-comp,
dashed=false,
firstinits,
isbn=false,
doi=false
]{biblatex}
\hypersetup{colorlinks,allcolors=blue}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Article{Schwamb2010,
Title                    = {Properties of the Distant Kuiper Belt: Results from the Palomar Distant Solar System Survey},
Author                   = {(Megan E.) Schwamb and (Michael E.) Brown and (David L.) Rabinowitz and Darin Ragozzine},
Journal                  = {The Astrophysical Journal},
Year                     = {2010},

Month                    = {September},

Number                   = {2},
Pages                    = {1691},
Volume                   = {720},

Doi                      = {http://dx.doi.org/10.1088/0004-637X/720/2/1691},
Timestamp                = {2014.09.21},
Url                      = {http://m.iopscience.iop.org/0004-637X/720/2/1691/pdf/0004-637X_720_2_1691.pdf}
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\begin{document}
\cite{Schwamb2010}
\printbibliography
\bibliography{\jobname}
\end{document}
retorquere commented 9 years ago

doesn't that already do what you want? I'm sort of sorry I added the feature -- biblatex can handle this without problem.

emelin commented 9 years ago

Thanks for the proposal. I'll check that as soon as possible which means as late as Monday.

The last thing I could discover, however, is maybe a more general path-problem and finally not even related to clickable URLs, since I cannot even find a .bib file!!!

[...]
Running 'biber  "abc"'
------------

INFO - This is Biber 1.9 INFO - Logfile is 'abc.blg' INFO - Reading 'abc.bcf' INFO - Found 34 citekeys in bib section 0 INFO - Processing section 0 INFO - Looking for bibtex format file 'http://localhost:23119/better-bibtex/collection?/0/AVBBZE2E.biblatex' for section 0 INFO - Data source 'http://localhost:23119/better-bibtex/collection?/0/AVBBZE2E.biblatex' is a remote BibTeX data source - fetching ... INFO - Decoding LaTeX character macros into UTF-8 INFO - Found BibTeX data source '/var/folders/cl/lngs41x17psgnb7nzymnxgg40000gp/T/dihIBfUlxL/biber_remote_data_source_Wjdyq.bib' INFO - Overriding locale 'en-US' defaults 'variable = shifted' with 'variable = non-ignorable' INFO - Overriding locale 'en-US' defaults 'normalization = NFD' with 'normalization = prenormalized' INFO - Sorting list 'none' of type 'entry' with scheme 'none' and locale 'en-US' INFO - No sort tailoring available for locale 'en-US' INFO - Writing 'abc.bbl' with encoding 'UTF-8' INFO - Output to abc.bbl Latexmk: Biber did't find bib file [/var/folders/cl/lngs41x17psgnb7nzymnxgg40000gp/T/dihIBfUlxL/biber_remote_data_source_Wjdyq.bib] Latexmk: applying rule 'pdflatex'...

In my understanding of this error, biber tries to write to the tmp dir on osx but somehow either cannot actually write or the file gets immediately deleted again, as I also cannot find the .bib file manually at the announced location. On the other hand it seems that biblatex finds the .bib file once but latexmk cannot later on??!! I am stuck here.

Maybe there is an option to latexmk or otherwise to cause the .bib file to be written to the dir where the .tex files resides?

The comand with options I currently use is:

latexmk -xelatex --shell-escape -bibtex-cond abc
retorquere commented 9 years ago

You're fetching the bib file through the pull export (from http://localhost:23119/better-bibtex/collection?/0/AVBBZE2E.biblatex), it is processed directly by biber, it never hits the disk.

emelin commented 9 years ago

Thanks for clarifying! That I don't get a persistent bib file is fine with me :)). However, the href encoding problem remains.

On 20.03.2015, at 23:33, AllThatIsTheCase notifications@github.com wrote:

You're fetching the bib file through the pull export (from http://localhost:23119/better-bibtex/collection?/0/AVBBZE2E.biblatex), it is processed directly by biber, it never hits the disk.

— Reply to this email directly or view it on GitHub.

retorquere commented 9 years ago

But I can't do anything about that unless I know what you expect in bibtex.

On Fri, Mar 20, 2015, 22:40 emelin notifications@github.com wrote:

Thanks for clarifying! That I don't get a persistent bib file is fine with me :)). However, the href encoding problem remains.

On 20.03.2015, at 23:33, AllThatIsTheCase notifications@github.com wrote:

You're fetching the bib file through the pull export (from http://localhost:23119/better-bibtex/collection?/0/AVBBZE2E.biblatex), it is processed directly by biber, it never hits the disk.

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub https://github.com/ZotPlus/zotero-better-bibtex/issues/169#issuecomment-84157668 .

emelin commented 9 years ago

All right. Thank you so much this far. Coming back on Monday.

On 20.03.2015, at 23:48, AllThatIsTheCase notifications@github.com wrote:

But I can't do anything about that unless I know what you expect in bibtex.

On Fri, Mar 20, 2015, 22:40 emelin notifications@github.com wrote:

Thanks for clarifying! That I don't get a persistent bib file is fine with me :)). However, the href encoding problem remains.

On 20.03.2015, at 23:33, AllThatIsTheCase notifications@github.com wrote:

You're fetching the bib file through the pull export (from http://localhost:23119/better-bibtex/collection?/0/AVBBZE2E.biblatex), it is processed directly by biber, it never hits the disk.

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub https://github.com/ZotPlus/zotero-better-bibtex/issues/169#issuecomment-84157668 .

— Reply to this email directly or view it on GitHub.

emelin commented 9 years ago

Back as promissed, I now fully understand your sigh about introducing the 'clickable url' feature. It's true biblatex already does what I want as your concise example above just proved once more. I got simply confused seeing the 'clickable url' feature on the preferences pane in thinking that this would be mandatory while completely forgetting about the fact that everthing had work well for me, before that feature even existed. So, after all, a big SORRY for the noise.

retorquere commented 9 years ago

Oh, hey, please don't apologize! The sigh was for me, I put that feature in place before I understood biblatex properly. I would much rather deal with ten "noise" issues then miss one question not asked because someone was discouraged from asking! If anything doesn't work as expected, feel free to assume that that's my doing, not yours. On Mar 23, 2015 5:18 PM, "emelin" notifications@github.com wrote:

Back as promissed, I now fully understand your sigh about introducing the 'clickable url' feature. It's true biblatex already does what I want as your concise example above just proved once more. I got simply confused seeing the 'clickable url' feature on the preferences pane in thinking that this would be mandatory while completely forgetting about the fact that everthing had work well for me, before that feature even existed. So, after all, a big SORRY for the noise.

— Reply to this email directly or view it on GitHub https://github.com/ZotPlus/zotero-better-bibtex/issues/169#issuecomment-85072749 .