Ask questionsUse tinytex to compile LaTeX documents
I think the tinytex package is mature enough now (it has been on CRAN for about half a year), so we may consider using it to compile LaTeX documents (including Rnw documents https://github.com/yihui/tinytex/issues/10). Note that the rmarkdown package has already used it to compile the intermediate
.tex files to PDF in
rmarkdown::render(). Some tips on how the IDE options should be passed to tinytex:
The main function to call is
The LaTeX engine (
lualatex) is passed to the
engine argument of
Clean auxiliary output option is passed to the
clean argument of
Enable shell escape option is passed to
latexmk(engine_args = '-shell-escape').
The main advantages of using tinytex is that it will process bibliographies and resolve other cross-references correctly (compile the .tex for a correct number of times). If the user has installed TinyTeX (
tinytex::install_tinytex()), missing LaTeX packages can also be installed automatically.
Let me know if you need any other information.
Answer questions yihui
I just realized that #5608 only made it possible to compile .tex files via
tinytex::latexmk(), but not
.Rnw documents. And I was hoping the intermediate
.Rnw could be compiled through tinytex as well (yihui/tinytex#10). I'm not familiar with
rnw_weave::runWeave below, but it sounds like it does the two steps together ("weave" + "compile to pdf"):
So somewhere inside
rnw_weave::runWeave, we need to call
tinytex::latexmk() if the preference
use_tinytex is true.
I was just about to tell the user who asked the question https://stackoverflow.com/q/61029677/559676 to try the daily build, but after I tested it, I realized
.Rnw was not compiled through tinytex, so it won't work for this user (references won't be correctly resolved).