【问题标题】:Automating adding .tex file content to .Rnw files自动将 .tex 文件内容添加到 .Rnw 文件
【发布时间】:2018-04-19 16:46:50
【问题描述】:

我使用一个程序来生成一系列 .tex 文件。然后我手动复制 .tex 文件的内容并将其添加到 .Rnw 文件(Sweave,在 RStudio IDE 中编译)。有没有办法在 .Rnw 文件中自动包含 .tex 文件的内容,以便 .tex 文件自动编译并生成漂亮的文本/图形/表格,而不需要复制?像下面这样的东西在编译时似乎不会产生我想要的东西。

<<>>=
# file.tex contains the code for a pretty LaTeX table
source("file.tex")
@

【问题讨论】:

    标签: r latex tex sweave rnw


    【解决方案1】:

    source 是错误的,那是为了运行 R 代码。相反,如果您使用的是 knitr,则可以在 knitr 块中使用 child 标记,例如:

    <<my-child-document, child="file.tex">>=
    @
    

    【讨论】:

      猜你喜欢
      • 2017-02-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-01
      • 2021-12-10
      相关资源
      最近更新 更多