运行knit2pdf()
时,在R控制台中使用quiet = TRUE
时,它不会抑制LaTeX输出。我正在运行knitr v1.11
。一个简单的例子是:
\documentclass[a4paper,12pt]{article}
\begin{document}
some stuff
\end{document}
knitr::knit2pdf(input = "./test.Rnw", quiet = TRUE)
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (MiKTeX 2.9 64-bit)
entering extended mode
(test.tex
LaTeX2e <2015/01/01> patch level 2
Babel <3.9m> and hyphenation patterns for 69 languages loaded.
(C:\MiKTeX\tex\latex\base\article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(C:\MiKTeX\tex\latex\base\size12.clo))
(C:\MiKTeX\tex\latex\graphics\graphicx.sty
(C:\MiKTeX\tex\latex\graphics\keyval.sty)
(C:\MiKTeX\tex\latex\graphics\graphics.sty
(C:\MiKTeX\tex\latex\graphics\trig.sty)
(C:\MiKTeX\tex\latex\00miktex\graphics.cfg)
(C:\MiKTeX\tex\latex\pdftex-def\pdftex.def
(C:\MiKTeX\tex\generic\oberdiek\infwarerr.sty)
(C:\MiKTeX\tex\generic\oberdiek\ltxcmds.sty))))
(C:\MiKTeX\tex\latex\graphics\color.sty (C:\MiKTeX\tex\latex\00miktex\color.cfg
)) (C:\MiKTeX\tex\latex\framed\framed.sty) (C:\MiKTeX\tex\latex\base\alltt.sty)
(C:\MiKTeX\tex\latex\upquote\upquote.sty) (test.aux)
(C:\MiKTeX\tex\context\base\supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) [1{C:/Users/neastwood1/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map}]
(test.aux) )<C:/MiKTeX/fonts/type1/public/amsfonts/cm/cmr12.pfb>
Output written on test.pdf (1 page, 10374 bytes).
Transcript written on test.log.
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (MiKTeX 2.9 64-bit)
entering extended mode
(test.tex
LaTeX2e <2015/01/01> patch level 2
Babel <3.9m> and hyphenation patterns for 69 languages loaded.
(C:\MiKTeX\tex\latex\base\article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(C:\MiKTeX\tex\latex\base\size12.clo))
(C:\MiKTeX\tex\latex\graphics\graphicx.sty
(C:\MiKTeX\tex\latex\graphics\keyval.sty)
(C:\MiKTeX\tex\latex\graphics\graphics.sty
(C:\MiKTeX\tex\latex\graphics\trig.sty)
(C:\MiKTeX\tex\latex\00miktex\graphics.cfg)
(C:\MiKTeX\tex\latex\pdftex-def\pdftex.def
(C:\MiKTeX\tex\generic\oberdiek\infwarerr.sty)
(C:\MiKTeX\tex\generic\oberdiek\ltxcmds.sty))))
(C:\MiKTeX\tex\latex\graphics\color.sty (C:\MiKTeX\tex\latex\00miktex\color.cfg
)) (C:\MiKTeX\tex\latex\framed\framed.sty) (C:\MiKTeX\tex\latex\base\alltt.sty)
(C:\MiKTeX\tex\latex\upquote\upquote.sty) (test.aux)
(C:\MiKTeX\tex\context\base\supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) [1{C:/Users/neastwood1/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map}]
(test.aux) )<C:/MiKTeX/fonts/type1/public/amsfonts/cm/cmr12.pfb>
Output written on test.pdf (1 page, 10374 bytes).
Transcript written on test.log.
[1] "test.pdf"
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] knitr_1.11
loaded via a namespace (and not attached):
[1] tools_3.2.2 RODBC_1.3-12
我希望停止此输出返回控制台。我想过可能使用shell命令调用knit2pdf
并将输出汇总到>NUL
,但我不确定这是否明智或容易做到?