在YAML`in_header:`中包含多个文件

问题描述 投票:2回答:1

在.rmd文档中,用于与YAML行完全编译,

output:
  pdf_document:
    fig_caption: yes
    keep_tex: yes
    number_sections: yes
    includes:
        in_header: mystyles.tex spacing.tex
 ...

我现在得到像mystyles.tex spacing.tex cannot be found这样的pandoc错误我现在正在使用R 3.3.2和R Studio 1.0.153。我还尝试了其他几种形式(给出了不同的错误):

        in_header: "mystyles.tex" "spacing.tex"

        in_header: mystyles.tex
        in_header: spacing.tex

如果我合并到两个文件中的LateX代码,它就可以使用了

        in_header: mystyles.tex

in_header行中多个文件的语法是什么?它改变了吗?

r knitr r-markdown pandoc
1个回答
6
投票

您必须将YAML语法用于向量(数组)。或

includes:
  in_header: ["mystyles.tex", "spacing.tex"]

要么

includes:
  in_header: 
    - mystyles.tex
    - spacing.tex

应该没事。在后一种情况下,请记住在in_header下正确缩进列表。

© www.soinside.com 2019 - 2024. All rights reserved.