【问题标题】:R markdown - set options for LaTeX packagesR markdown - 为 LaTeX 包设置选项
【发布时间】:2017-02-23 13:19:05
【问题描述】:

如果我通过以下方式在 .Rmd 文件中设置输出参数:

output:
   bookdown::pdf_book:
    base_format: rticles::elsevier_article
    keep_tex: true

在生成的 .tex 文件中,endfloat 包将与选项“nomarkers”一起使用。换句话说,以下行将包含在生成的 .tex 文件中:

\usepackage[nomarkers]{endfloat}

如何为输出使用的 LaTeX 包设置选项?

在我的示例中,我希望将 endfloat 选项设置为“标记”,因此 .tex 文件中提到的行将如下所示:

\usepackage[markers]{endfloat}

【问题讨论】:

    标签: r knitr bookdown


    【解决方案1】:

    简单的解决方案

    header-includes:
       - \usepackage[markers]{endfloat}
    output:
       bookdown::pdf_book:
        base_format: rticles::elsevier_article
        keep_tex: true
    

    不起作用,因为存在包冲突。我尝试并工作的另一个解决方案是从 GitHub https://github.com/rstudio/rticles 下载包并将文件 template.tex 更改为您的需要。该文件位于/inst/rmarkdown/templates/elsevier_article/resources/。对我来说,这很有效,并且 .tex 文件具有您期望的所需输出。

    【讨论】:

    • 是否可以在不同的位置存储模板的修改副本,这样我就不会碰原件了?我怎么能告诉R!使用我的本地副本?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多