Jens
Jens

Reputation: 35

knitting a figure to word using papaja fails

I am able to knit the following code to PDF. However, it always fails when trying to knit the output to Word (win 10, Rstudio 1.2.5033, R 3.6.2, papaja 0.1.0.9942). I had to delete the papaja header for posting (too much code).

```{r setup, include = FALSE}
library("papaja")
```

# Methods

```{r figure}
plot(cars)
```

The error message reads

Error running filter D:/Boelte/R_library/papaja/rmd/docx_fixes.lua: [string "--[[..."]:227: Constructor for Emph failed: [string "--[[..."]:258: attempt to index a nil value (local 'x') stack traceback: [C]: in function 'error' ..."]:227: in field 'Emph' D:/Boelte/R_library/papaja/rmd/docx_fixes.lua:14: in function 'Image' Fehler: pandoc document conversion failed with error 83

Is there any way to correct this error? It is a papaja or a pandoc error?

Upvotes: 2

Views: 252

Answers (1)

crsh
crsh

Reputation: 1716

This is a papaja error related to post-processing of the document (in this case styling figure captions) via the docx_fixes.lua-filter. I will try to fix this as soon as possible. For the time being, you should be able to resolve this problem by specifying a figure caption in the chunk options.

```{r setup, include = FALSE}
library("papaja")
```

# Methods

(ref:fig-cap) This is the figure caption.

```{r figure, fig.cap = "(ref:fig-cap)"}
plot(cars)
```

Upvotes: 2

Related Questions