在Rmarkdown和knitr中同时使用in_header和header_includes

弗洛里安

我有一个很长的.txt文件,其中包含要在Rmarkdown文件中使用的软件包和设置。我还想根据R计算的输出将语句添加到标题中。在这种特殊情况下,我想添加位于另一个目录中的标题图形,如下所示:

working directory
|--- reports
|----| my_report.Rmd
|--- www
|----| image.png

因此,Rmarkdown文件的标题如下所示:

output:
  beamer_presentation:
    keep_tex: true
    includes:
      in_header: header.txt
header-includes:
- \titlegraphic{\includegraphics[width=0.3\paperwidth]{`r paste0("dirname(getwd()),"image.png")`}}

如果仅包含其中一个语句(in_header或header-includes),则它们可以正常工作。但是当我同时使用它们时,header-includes的内容似乎被覆盖了下面的文件中给出了一个示例,在检查生成的.tex文件时,我发现该文件\usepackage{fancyhdr}位于标头中,但未提及`\ titlegraphic'表达式。


header.txt

\usepackage{fancyhdr}

例子.md

title: Example 1
output:
  beamer_presentation:
    keep_tex: true
    includes:
      in_header: header.txt
header-includes:
      \titlegraphic{\includegraphics[width=0.3\paperwidth]{`r paste0("just_an_example_","logo.png")`}}
---

### This is a test
F.私人

我认为您可以将所有内容放入header-includes

---
title: Example 1
output:
  beamer_presentation:
    keep_tex: true
header-includes:
  - \titlegraphic{\includegraphics[width=0.3\paperwidth]{`r paste0("just_an_example_","logo.png")`}}
  - \input{header.txt}
---

它行得通吗?我无法完全复制您的示例。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

在YAML in_header中包含多个文件:

如何同时抓取header和下载链接

使用rmarkdown和knitr将部分添加到Beamer演示中

如何使用knitr和RMarkdown在块中的多个页面上添加多个图形?

使用RMarkdown中的knitr和kableExtra包创建多个表的For循环

在rmarkdown / knitr中的块之前和之后插入html代码

在两个单独的变量中同时获取header和curl响应的主体吗?

如何在ReactNative的功能组件中同时包含Header和BottomTabNavigator?

如何在React Native中使用Animated API同时隐藏Header和Footer

带有knitr和Rmarkdown的Unicode

在rmarkdown和knitr中打印自定义对象(PDF和HTML)

使用 pyhton urllib.request 和 bs4 从 div 和 header 类中检索数据

rmarkdown中的循环,knitr和xtable在多个报告中创建唯一表

在Rmarkdown中从`for`循环使用`ggplotly`和`DT`

RMarkdown和Knitr转换为HTML:如何在TOC(目录)中隐藏项目符号?

Rmarkdown中带有Knitr和Latex的代码块字体大小

在sharedpreference中同时使用apply()和commit()

在pexpect中同时使用Expect()和interact()

在superCSV中同时使用CSVListReader和CSVBeanreader

在Java中同时使用InputStream和InputStreamReader

我们如何编程Statet以同时使用Knitr和pdflatex

R,knitr,xtable,同时使用add.to.row和hline.after

knitr / rmarkdown / Latex:如何交叉引用图形和表格?

<nav>和<header>之间的关系

框架中header和plist文件的作用是什么?

如何在WebApi中添加和获取Header值

在HTTP CORS规范中,Allow-Header和Expose-Header有什么区别?

结合使用Header和Gridlistlayout Blackberry qnx momentics IDE

如何使用p:multiSelectListbox的header和showHeaders属性