Search code examples
knitrrstudio-server

Where is the .tex file kept when compiling Rmd in Rstudio server


This may sound like a dumb question, but I'd like to know where is the .tex file saved, when I compile a pdf document from a Rmd file, using RStudio server. I added the keep_tex option, so the header of Rmd looks like this :

---
output:
  pdf_document:
    keep_tex: yes
---

Then when I compiled, the output looks like this

  |......................                                           |  33%
  ordinary text without R code

  |...........................................                      |  67%
label: plot


processing file: test.Rmd
cropping /tmp/Rtmpb1x3Q0/preview-3bfe24922427.dir/test_files/figure-latex/plot-1.pdf
PDFCROP 1.33, 2012/02/01 - Copyright (c) 2002-2012 by Heiko Oberdiek.
==> 1 page written on `/tmp/Rtmpb1x3Q0/preview-3bfe24922427.dir/test_files/figure-latex/plot-1.pdf'.
  |.................................................................| 100%
  ordinary text without R code


/usr/lib/rstudio-server/bin/pandoc/pandoc test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output /tmp/Rtmpb1x3Q0/preview-3bfe24922427.dir/test.tex --template /home/myusername/R/x86_64-pc-linux-gnu-library/3.1/rmarkdown/rmd/latex/default.tex --highlight-style tango --latex-engine pdflatex --variable 'geometry:margin=1in' 
output file: test.knit.md

/usr/lib/rstudio-server/bin/pandoc/pandoc test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output /tmp/Rtmpb1x3Q0/preview-3bfe24922427.dir/test.pdf --template /home/myusername/R/x86_64-pc-linux-gnu-library/3.1/rmarkdown/rmd/latex/default.tex --highlight-style tango --latex-engine pdflatex --variable 'geometry:margin=1in' 

Output created: /tmp/Rtmpb1x3Q0/preview-3bfe24922427.dir/test.pdf

I'd like to find the intermediate .tex file (or test.knit.md), and do a bit of editing. Except it is no where to be found. Not in the working directory, or /home/myusername/, or /, or /tmp/Rtmpb1x3Q0/. I'd really appreciate it if someone has the answer.


Solution

  • Actually, this first line in the console

    /usr/lib/rstudio-server/bin/pandoc/pandoc test.utf8.md --to latex --from       markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output /tmp/Rtmpb1x3Q0/preview-3bfe24922427.dir/test.tex --template /home/myusername/R/x86_64-pc-linux-gnu-library/3.1/rmarkdown/rmd/latex/default.tex --highlight-style tango --latex-engine pdflatex --variable 'geometry:margin=1in' 
    

    told us that the output .tex file is in /tmp/Rtmpb1x3Q0/preview-3bfe24922427.dir/test.tex Somehow I did not find the file last time, but on a recent instance, the .tex file is actually there, so that answers the question.