16

I have the following document, that I am trying to compile with Rstudio:

---
title:
shorttitle:
author: 

bibliography:
  - library.bib

output: papaja::apa6_pdf
---

```{r message = FALSE, warning = FALSE}
library("papaja")
apa_prepare_doc() # Prepare document for rendering
```
# Introduction

@Bakan1966

# References
```{r create_r-references}
r_refs(file = "r-references.bib")
```

When I run knit, it compiles the .md file, but pandoc gives an error:

pandoc-citeproc: "stdin" (line 232, column 2):
unexpected "a"
expecting "c", "C", "p", "P", "s" or "S"
pandoc: Error running filter /Applications/RStudio.app/Contents/MacOS/pandoc/pandoc-citeproc
Error: pandoc document conversion failed with error 83
In addition: Warning messages:
1: In yaml::yaml.load(enc2utf8(string), ...) :
  NAs introduced by coercion: 1,2,3 is not an integer
2: In yaml::yaml.load(enc2utf8(string), ...) :
  NAs introduced by coercion: 1,2,3 is not an integer
Execution halted

I have found similar problems on different topics around but none of the proposed solutions worked for me...

neilfws
  • 32,751
  • 5
  • 50
  • 63
Ladislas Nalborczyk
  • 725
  • 2
  • 5
  • 20
  • RStudio has a built inversion of pandoc. I had upgraded my pandoc installation and it started throwing errors. Have you installed pandoc separately? – Mallick Hossain Nov 10 '18 at 15:32

5 Answers5

16

"Solved".

The problem comes from my library.bib file.

I have generated it using Mendeley, which has inserted a lot of special characters that are not supported by pandoc-citeproc...

Ladislas Nalborczyk
  • 725
  • 2
  • 5
  • 20
  • I can get the base, Chicago style, citations to work : http://rmarkdown.rstudio.com/authoring_bibliographies_and_citations.html#citation_styles, but cannot get any of the additional .csl files to work. Have you had any luck getting the .csl to work? – symbiotic Dec 13 '16 at 15:54
  • 1
    Personally, I had a missing comma separating tag entries on one of my citations -- broader lesson is it's probably a syntax error in your .bib file. You can narrow down which is the source of the error by [removing the `@`s in your .bib file](https://tex.stackexchange.com/questions/21709/comments-in-bibtex) and re-compiling (`pandoc` will throw an unfound citation warning, but no error) iteratively – MichaelChirico Apr 23 '17 at 21:11
  • 1
    Just to give another example: I had the same issue and it was an automatically generated BibTeX key (which I didn't even use!). pandoc-citeproc doesn't seem to like a key like `Marten-Rodriguez` because of the hyphen. So just keep in mind ;) – bamphe Apr 11 '18 at 15:05
  • 1
    hi, I have a .yaml style bibliography and it didn't work with I upgraded from pandoc 1.2 to 2.3.1. Is yaml bibliography not compatible with the new pandoc-citeproc? – Courvoisier Oct 30 '18 at 09:19
4

This is likely to be pandoc-citeproc problem. To diagnose, run rmarkdown::render manually, e.g.: rmarkdown::render(output_format = "html_document", input = your_vignette, clean = FALSE)

In my case, I needed to add the .bib to the bibliography: bibfile rows in the YAML header of the vignette.

Jack Wasey
  • 3,360
  • 24
  • 43
1

I faced the error 83 when knit a rmarkdown file which apply arules::apriori().

---
title: "[**Pattern Discovery in Data Mining** *Programming Assignment: Frequent Itemset Mining Using Apriori*](https://www.coursera.org/learn/data-patterns)"
subtitle: "[**Data Mining** *by University of Illinois at Urbana-Champaign*](https://www.coursera.org/specializations/data-mining)"
author: "[®γσ, Eng Lian Hu](http://englianhu.wordpress.com) <img src='figure/ShirotoNorimichi2.jpg' width='24'> 白戸則道®"
date: "`r Sys.Date()`"
output:
  tufte::tufte_html:
    toc: yes
  tufte::tufte_handout:
    citation_package: natbib
    latex_engine: xelatex
  tufte::tufte_book:
    citation_package: natbib
    latex_engine: xelatex
bibliography: skeleton.bib
link-citations: yes
---

Its working fine after I removed the line : bibliography: skeleton.bib.

1

I faced the same error when rendering a HTML file but the solution to my problem was different:

I had specified csl: nature.csl in the YAML header. What I didn't know was that I had to also download the nature.csl file and specify the path to it in the YAML header. So instead of having:

bibliography: references/library.bib
csl: nature.csl

I downloaded the nature.csl file and put in in the same folder as the library.bib. The correct YAML header looks like this

bibliography: references/library.bib
csl: references/nature.csl
Frederick
  • 810
  • 8
  • 28
1

I get Error: pandoc document conversion failed with error 83 in empty environments as exemplified below.

Wrong way

```{example}

```

Right way

```{example}
Some content.
```
zabala
  • 103
  • 1
  • 7