在 Rstudio 服务器中编译 Rmd 时 .tex 文件保存在哪里

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

这听起来像是一个愚蠢的问题,但我想知道当我使用 RStudio 服务器从 Rmd 文件编译 pdf 文档时,.tex 文件保存在哪里。 我添加了 keep_tex 选项,所以 Rmd 的 header 看起来像这样:

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

然后我编译的时候,输出是这样的

  |......................                                           |  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

我想找到中间 .tex 文件(或 test.knit.md),然后进行一些编辑。除了它无处可寻。不在工作目录中,或 /home/myusername/,或 /,或 /tmp/Rtmpb1x3Q0/。 如果有人有答案,我将不胜感激。

实际上,控制台的第一行

/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' 

告诉我们输出 .tex 文件在 /tmp/Rtmpb1x3Q0/preview-3bfe24922427.dir/test.tex 不知何故我上次没有找到该文件,但在最近的一次实例中,.tex 文件确实存在,所以这回答了问题。

问题的初始代码

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

为我抛出错误,而以下不会:

---
output:
  pdf_document: default
  keep_tex: T
---

但是,我仍然无法在控制台输出后找到 .tex 文件。看来还是没救。取而代之的是 运行 R studio 控制台中的以下行:

#install.packages(rmarkdown)
rmarkdown::render("FileName.Rmd", output_format = latex_document())

文件“FileName.Rmd”需要位于当前工作目录中 - 这是保存 .tex 文件的位置。