Last active
October 4, 2020 00:39
-
-
Save Martins6/14e1997da5b6c6176f908dcf2142126d to your computer and use it in GitHub Desktop.
When you compile a document to PDF through TinyTex LaTex, you may run into errors, especially with the .Rnw files and .tex. This is a script that automatically uses TinyTex to install the missing dependencies to compile an Rnw file..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
knitr::knit2pdf('path\to\file.Rnw') | |
file_log <- read_file('path\to\file.log') | |
error_text <- | |
file_log %>% | |
stringr::str_split('\n') %>% | |
unlist %>% | |
enframe('Index', 'Text') %>% | |
filter(str_detect(Text, '! LaTeX')) %>% | |
pull(Text) | |
tinytex::parse_install( | |
text = error_text | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment