繁体   English   中英

包含RNW文件

[英]Include RNW file

\input{./A1_sample/sample.Rnw}

如何包含Rnw文件,以便执行文件中的R代码? 使用\\input不起作用。

命令是\\SweaveInput

用法:

\\ begin {document}

\\ SweaveInput {PATH_TO_RNW_FILE / RNW_FILE.Rnw}

\\ end {document}

有关更多信息,请参见: https : //support.rstudio.com/hc/en-us/articles/200486298-Working-with-Multiple-Rnw-Files

patchDVI软件包提供了用于处理多个文件文档的各种项目管理工具。 它需要一些设置,但是在TeXShop或TeXworks中可以很好地工作。 不幸的是,我不认为RStudio可以轻松定制以使用它。

您的文档main.Rnw看起来像这样:

\documentclass{article}
<<echo=FALSE,results="asis">>=
# .SweaveMake <- 2  # For complete make, uncomment this
.SweaveFiles <- c("file1.Rnw", "file2.Rnw", "file3.Rnw")
.TexRoot <- "main.tex"
@
\begin{document}
\input{file1}
\input{file2}
\input{file3}
\end{document}

每个file*.Rnw文件都将具有相似的头,将main.Rnw和其他相关文件列出为.SweaveFiles 然后,当编译器处理文件时,可以告诉编译器在所有更改的文件上运行Sweave,在main.tex上运行LaTeX。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM