R markdown版本2中的YAML前端问题:添加机构和徽标

Joa*_*ler 6 yaml r pandoc r-markdown

是否可以在R markdown版本2中为YAML前端添加机构和徽标?

我正在寻找这样的东西

---
title:       "My report"
author:      "me"
institution: "Swansea University"
logo:        "logo.png"
output:
   pdf_document:
   toc: yes
---
Run Code Online (Sandbox Code Playgroud)

Joa*_*ler 1

答案是使用模板文件,但需要对徽标位进行一些调整:

---
title:       "My report"
author:      "me"
output:
   pdf_document:
   toc: yes
   includes:
     in_header: style.tex
---
Run Code Online (Sandbox Code Playgroud)

在与 Markdown 文件相同的文件夹中准备文档“style.tex”,并确保已将 R 中的工作目录更改为该文件夹。

将以下行添加到“style.tex”文件中:

\institute{My institute}
\pgfdeclareimage[width=2cm]{logo}{logo.png}
\usebackgroundtemplate{\pgfuseimage{logo}}
Run Code Online (Sandbox Code Playgroud)

感谢: 使用 R Markdown 将徽标插入投影仪演示文稿