2

When rendering a flextable in a papaja document the following error is produced:

55 words in text body
0 words in reference section
tlmgr: package repository https://ftp.snt.utwente.nl/pub/software/tex/systems/texlive/tlnet (verified)
tlmgr install: package already present: bookmark
! Undefined control sequence.
<argument> \Oldarrayrulewidth 

when running a minimal example with:

---
title             : "Flextable & papaja"

classoption       : "man"
output            : papaja::apa6_pdf
#output            : pdf_document
---

# Intro

Flextable in apa6_pdf 

```{r setup, include = TRUE}
knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE)
library("papaja")
require(flextable)
data("mtcars")
flextable(head(mtcars))

The document renders properly when the normal pdf output format is used.

3
  • 3
    Welcome to SO! See this answer related to beamer_presentations. I think the answer applies to your case as well and with the offered fix I was at least able to compile your document. Commented Apr 21 at 21:28
  • 1
    @stefan great find! There is an ongoing issue on this. It would help to look at the raw LaTeX to see which sort of packages are used and then to include them in the yaml header. Like header-includes: - \providecommand{\Oldarrayrulewidth}{\arrayrulewidth} or consider using kableextra instead. Commented Apr 21 at 21:32
  • @stefan I encourage you to write an answer for this. Your linked question uses Beamer presentation + flextable and by writing one here for flextable + papaja::apa6_pdf we could increase the chance of people finding this great fix - these comments might be deleted. Commented Apr 22 at 7:58

1 Answer 1

1

It appears that the addition to the LaTeX preamble added by flextable are ignored by papaja::apa6_pdf. You can work around the problem by adding them manually in the YAML front matter:

header-includes:
  # - \usepackage{multicol}
  - \usepackage{colortbl}
  # - \usepackage{hhline}
  # - \usepackage{array}
  # - \usepackage{wrapfig}
  - \newlength\Oldarrayrulewidth
  - \newlength\Oldtabcolsep

I have commented out all lines that are not necessary to render you example.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.