Hi!
I am working on automatically generating pdf documents with R- I was handed a solution that generates a pdf document when I click Knit in Rstudio, but doesn't when I call rmarkdown::render("New.Rmd")
.
The error I receive in console: `I was unable to find any missing LaTeX packages from the error log New.log.
! Undefined control sequence.
>{\raggedright \arraybackslash
}p{12em}>{\raggedright \arraybacks...
l.76 ...2em}>{\raggedright\arraybackslash}p{12em}}
Error: LaTeX failed to compile New.tex. See The R package tinytex - Helper Functions to Manage TinyTeX, and Compile LaTeX Documents - Yihui Xie | 谢益辉 for debugging tips. See New.log for more info.`
I have naively chased down the difference in execution to:
Knit in R:
"E:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS New.knit.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output New.tex --lua-filter "E:\Program Files\R\R-4.1.1\library\rmarkdown\rmarkdown\lua\pagebreak.lua" --lua-filter "E:\Program Files\R\R-4.1.1\library\rmarkdown\rmarkdown\lua\latex-div.lua" --self-contained --highlight-style tango --pdf-engine pdflatex --variable graphics --variable "geometry:margin=1in" --include-in-header "C:\Users\Brook\AppData\Local\Temp\RtmpA9iAAO\rmarkdown-str1810317f2cc7.html"
and
rmarkdown:render("New.Rmd")
:
"E:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS New.knit.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output New.tex --lua-filter "E:\Program Files\R\R-4.1.1\library\rmarkdown\rmarkdown\lua\pagebreak.lua" --lua-filter "E:\Program Files\R\R-4.1.1\library\rmarkdown\rmarkdown\lua\latex-div.lua" --self-contained --highlight-style tango --pdf-engine pdflatex --variable graphics --variable "geometry:margin=1in"
Where the difference is the missing temporary html file param : --include-in-header "C:\Users\Brook\AppData\Local\Temp\RtmpA9iAAO\rmarkdown-str1810317f2cc7.html"
From my understanding RStudio just calls rmarkdown::render, so I'm wondering if I have missed some magic in my YAML headers:
`output:
pdf_document: default
always_allow_html: yes
header-includes:
- \usepackage{sectsty}
- \allsectionsfont{\color{red}}
options(tinytex.verbose = TRUE)
library(dplyr)
library(knitr)
library(kableExtra)
library(ggplot2)
library(stringr)
library(readr)
library(psych)
knitr::opts_chunk$set(echo = TRUE)
`
Or if there is something else that I am doing incorrectly.
Thanks for your time!
Brook