citr icon indicating copy to clipboard operation
citr copied to clipboard

Losing reference to the local .bib file after connecting to Zotero

Open dmi3kno opened this issue 4 years ago • 2 comments

First of all thank you for the awesome package! It changed the way I write academic papers and I am looking forward to converting my colleagues to the workflow involving citr/rmd and Zotero.

Describe the bug After connecting to Zotero library, citr is losing reference to the local .bib file described in YAML and instead proceeds to create new references.bib in the working directory.

To Reproduce Open new RMD document (I am using rticles template) with custom bib file defined in YAML. Launch Zotero in the background. Call citr Rstudio addin. It correctly identifies YAML's .bib file and suggests that Zotero is running, so it is possible to "connect and load" libraries. Click "connect and load", Zotero is now connected, but the reference to original .bib file is lost (it says "references are added to references.bib"). In order to cure it, switch temporarily to "Settings" tab, where reference to original .bib file is still stored. Do nothing and switch back to "Insert citation" tab. The local .bib is now recognized and properly linked.

Expected behavior There should be no need to switch to "Settings" tab to correct the reference to .bib file

Screenshots Open citr. YAML reference to ./intro_paper.bib is correctly recognized. Screenshot 1 from 2020-02-05 09-35-08 Zotero library loaded and reference to ./intro_paper.bib is lost Screenshot 2 from 2020-02-05 09-35-37 Flip to "Settings" tab. Everything looks like expected. Screenshot 3 from 2020-02-05 09-36-12 Flip back to "Insert citation" tab. Reference to local .bib file is cured. Screenshot 4 from 2020-02-05 09-36-33

dmi3kno avatar Feb 05 '20 08:02 dmi3kno

Thanks for taking the time to report this. I'll look into it the next chance I get.

crsh avatar Feb 11 '20 08:02 crsh

I am not quite sure if this is connected to this, but I experience the following related problem.

In the YAML reference I need to provide the entire path for RStudio to correctly render the citations. citr on the other hand produces the following result when I do that:

> citr:::insert_citation()
Error in FUN(X[[i]], ...) : 
  file '/Users/jrennstich/Dropbox/websites/rennstich_com_v2/content/de/tutorials/online-lehre-praxis//Users/jrennstich/Dropbox/websites/rennstich_com_v2/references.bib' does not exist

Here's the odd thing. My workaround is as follows: I have two lines in the YAML

When I want to render the references, I comment-out the first one.

# bibliography: references.bib
bibliography:  /Users/jrennstich/Dropbox/websites/rennstich_com_v2/references.bib

Whenever I need to add citations using citr, I comment-out the second line.

bibliography: references.bib
# bibliography:  /Users/jrennstich/Dropbox/websites/rennstich_com_v2/references.bib

This won't allow me to render the references. As my set-up is correct according to the Settings:

screenshot_247

all the added references are being added to said .bib file, even though in YAML I only specify bibliography: references.bib

The problem is, that when I use the correct full .bib file path YAML, I get the following error:

> citr:::insert_citation()
Error in FUN(X[[i]], ...) : 
  file '/Users/jrennstich/Dropbox/websites/rennstich_com_v2/content/de/tutorials/online-lehre-praxis//Users/jrennstich/Dropbox/websites/rennstich_com_v2/references.bib' does not exist

Is this related to this bug? Or should I open up a new case? And is there a way for me to avoid the workaround I am using now?

Thanks for your incredible work on this and the other packages!

jrennstich avatar Mar 30 '20 11:03 jrennstich