Jake
Jake

Reputation: 187

Knitting .Rmd file in Rstudio hangs when using a custom .csl file for bibliography

I am writing a manuscript using R Markdown and am trying to knit the document with a custom csl that I got from the Zotero Style Repository (for the journal Environmental Entomology). When I try to knit, the R Markdown pane shows that it progresses through all the code chunks adequately, then it gets to the point where it says "output file: Mytitle.knit.md" but it hangs there and never finishes. If I take out the custom csl portion of the YAML header, the document knits no problem. It produces the .md file and I tried opening that and hitting the "Preview" button, but that hangs as well.

I've tried a few things to reproduce the problem but I can't nail down what's causing it. I went into another manuscript I wrote using the same custom csl. That document knit with the custom csl fine. I tried creating a new document with just the template text and the custom csl, that worked fine. I thought it might have something to do with my .bib file, so I copied the .bib file from the current manuscript to a different one using the same .csl and that knit fine.

Here is what my YAML looks like:

title: ""
output: 
   bookdown::word_document2:
      reference_docx: "template.docx"
bibliography: references.bib
csl: "environmental_entomology.csl"
link-citations: true

I'm using R v4.0.3 and RStudio 1.4.999 on a Windows 10 Home machine.

Upvotes: 0

Views: 151

Answers (1)

Jake
Jake

Reputation: 187

I found out the issue was related to a single bad entry in the .bib file. I'm not sure what about it caused the hang, but once I removed it the file knit fine.

This is the culprit:

@book{lowtemp2009,
    title = {Low Temperature Biology of Insects},
    editor = {{Denlinger}, {David L.} and {Lee}, {Richard E. Jr}},
    year = {2009},
    date = {2009},
    publisher = {Cambridge University Press},
    doi = {10.1017/cbo9780511675997},
    url = {http://dx.doi.org/10.1017/CBO9780511675997}
}

I'm not super familiar with bibtex entries so I'm not sure what caused the problem. Changing it to the below entry caused the file to knit successfully.

@book{denlinger2010low,
  title = {Low temperature biology of insects},
  author = {Denlinger, David L and Lee Jr, Richard E},
  year = {2010},
  publisher = {Cambridge University Press}
}

Upvotes: 1

Related Questions