Can't knit Rmd to pdf when contains flextable

28 views Asked by At

When I try to knit an Rmarkdown document containing a flextable to pdf it just stalls. No issues knitting to html or with other types of tables like kable. Min reprex below.

When rendering it will just freeze on 'output file: example.knit.md' and never finish rendering.

---
title: "Untitled"
output: pdf_document
date: "2024-03-08"
---

```{r}
flextable::flextable(cars)
```

I installed tiny_tex and can successfully knit pdfs that do not have any flextables in them.

After reading getting-flextable-to-knit-to-pdf I discovered this was a known issue with earlier versions of flextable. However, following the solution I added 'latex_engine: xelatex' but still no luck.

I'm running flextable 0.8.3. pandoc 2.19.2

When rendering:

processing file: flextable_example.Rmd |................................... | 50% ordinary text without R code

|......................................................................| 100% label: unnamed-chunk-1

"C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/pandoc" +RTS -K512m -RTS flextable_example.knit.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output flextable_example.tex --lua-filter "C:\Users\a0778291\AppData\Local\R\win-library\4.2\rmarkdown\rmarkdown\lua\pagebreak.lua" --lua-filter "C:\Users\a0778291\AppData\Local\R\win-library\4.2\rmarkdown\rmarkdown\lua\latex-div.lua" --embed-resources --standalone --highlight-style tango --pdf-engine pdflatex --variable graphics --variable "geometry:margin=1in" --include-in-header "C:\Users\a0778291\AppData\Local\Temp\RtmpoJlm1X\rmarkdown-str7d047674de6.html" output file: flextable_example.knit.md freezes here

Session info below.

R version 4.2.2 (2022-10-31 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 22621)

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] flextable_0.8.3

loaded via a namespace (and not attached): [1] Rcpp_1.0.9 lattice_0.20-45 png_0.1-8 digest_0.6.31 R6_2.5.1 grid_4.2.2 jsonlite_1.8.4 evaluate_0.19 zip_2.2.2 cli_3.6.1
[11] rlang_1.1.1 gdtools_0.2.4 uuid_1.1-0 data.table_1.14.6 rstudioapi_0.14 xml2_1.3.3 Matrix_1.5-1 reticulate_1.26.9000 rmarkdown_2.19 tools_4.2.2
[21] officer_0.5.0 xfun_0.36 fastmap_1.1.0 compiler_4.2.2 systemfonts_1.0.4 base64enc_0.1-3 htmltools_0.5.4 knitr_1.41

0

There are 0 answers