Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RStudio creates PDF file from Rmarkdown in temporary directory

I use RStudio with Rmarkdown to create reports. For some reason using the “Knit” button results in it being created in some temporary directory only. From the command output it seems that pandoc itself is instructed to do so, which I find very strange.

/usr/lib/rstudio/bin/pandoc/pandoc +RTS -K512m -RTS 31_effective_masses.utf8.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/RtmppeovW9/preview-2c001154ef6d2e.dir/31_effective_masses.tex --table-of-contents --toc-depth 3 --template /hadron/ueding/R/x86_64-pc-linux-gnu-library/3.6/rmarkdown/rmd/latex/default-1.17.0.2.tex --number-sections --highlight-style tango --pdf-engine lualatex --variable graphics=yes --lua-filter /hadron/ueding/R/x86_64-pc-linux-gnu-library/3.6/rmarkdown/rmd/lua/pagebreak.lua --lua-filter /hadron/ueding/R/x86_64-pc-linux-gnu-library/3.6/rmarkdown/rmd/lua/latex-div.lua --variable 'geometry:margin=1in' --variable 'compact-title:yes' 
output file: 31_effective_masses.knit.md


Output created: /tmp/RtmppeovW9/preview-2c001154ef6d2e.dir/31_effective_masses.pdf

But when I do it on the command line with Rscript -e "rmarkdown::render('vignettes/3pi/31_effective_masses.Rmd')", it creates the output in the correct directory:

/usr/bin/pandoc +RTS -K512m -RTS 31_effective_masses.utf8.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output 31_effective_masses.tex --table-of-contents --toc-depth 3 --template /hadron/ueding/R/x86_64-pc-linux-gnu-library/3.6/rmarkdown/rmd/latex/default-1.17.0.2.tex --number-sections --highlight-style tango --latex-engine lualatex --variable graphics=yes --variable 'geometry:margin=1in' --variable 'compact-title:yes' 

Output created: 31_effective_masses.pdf

I am using RStudio 1.2.5001 on Debian 9.

like image 423
Martin Ueding Avatar asked Dec 02 '25 03:12

Martin Ueding


1 Answers

In RStudio, where is knitr markdown output located?

explains some reasons for this behaviour. I had the same issue due to working in the "vignettes" directory with the Sweave global option "PDF preview" set to "no preview". Setting a preview option displayed the output, avoiding having to navigate to a temporary directory.

like image 98
J C Nash Avatar answered Dec 04 '25 22:12

J C Nash