I noticed this in the changes of R 2.14:
R CMD Sweave now has a --pdf option to produce a PDF version of the processed Sweave document.
Trying it out, I noticed that it not only ran pdfLaTeX on the resulting tex but also correctly included bibTeX references and cleaned up afterwards. Seems like a very very nice way of using Sweave now (not to mention how easy it now is to implement the whole routine in editors).
But what exactly is this now running? I couldn't find any more details on it. It seems Sweave -> pdflatex -> bibtex -> pdflatex -> pdflatex at least?
Thanks for the question. I had wondered myself about the code behind that 'automagical' process.
R CMD Sweave --pdf
ultimately calls tools::texi2dvi
, which:
Run[s] latex and bibtex until all cross-references are resolved and create[s] either a dvi or PDF file.
(See here for more texi2dvi
details).
Here is the chain of events set into motion by an R CMD Sweave --pdf
call:
The source file rcmdfn.c
has code that instructs R CMD Sweave
to run utils:::.Sweave() --args"
through Rterm.exe
.
If --pdf
is set, utils:::.Sweave()
calls tools::texi2pdf()
to process the Sweave file.
texi2pdf()
in turn calls tools::texi2dvi()
.
Finally, texi2dvi()
looks at the environment to learn which tools are available to it, and does the work described in the help file linked above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With