繁体   English   中英

在 R markdown beamer 演示文稿中添加作者隶属关系

[英]Add author affiliation in R markdown beamer presentation

如何在 rmarkdown 投影仪演示文稿的新行中添加作者隶属关系?

---
title: "This is the title"
author: "Author"
date: "Thursday, April 09, 2015"
output: beamer_presentation
---
## Slide with Bullets

- Bullet 1
- Bullet 2
- Bullet 3

欲望标题幻灯片应该是

这是标题

作者

联系

2015 年 4 月 9 日,星期四

如果您使用管道| 您可以将作者行分成多行:

---
title: "The title"
author: | 
  | The author
  | The affiliation
date: "9 April 2015"
output: beamer_presentation
---

输出:

投影仪

编辑我们可以使用标题和作者/隶属关系字体吗? ):

如果您想更改不同的字体大小,我建议您使用演示文稿标题的includes: in_header选项(查看此 RStudio 链接了解详情)。

这指向您计算机上的一个简单的.tex文件,您可以在其中专门为演示文稿的序言添加 LaTeX 命令。 因此,您可以在桌面中有一个名为preamble.tex的文件,并使用\\setbeamerfont{XX}{size={\\fontsize{YY}{ZZ}}}命令,其中 XX 是您要更改的特定内容(标题, 作者); YY 是要应用的字体大小; ZZ 是跳线(在 pt 中)(有关更多详细信息,请参阅此链接)。

因此,对于您的示例,我们有:

preamble.tex文件在你的桌面(或你想要的任何地方)只包含两行:

\setbeamerfont{title}{size={\fontsize{30}{25}}}
\setbeamerfont{author}{size={\fontsize{5}{20}}}

你的foo.Rmd文件:

---
title: "The title"
author: | 
  | The author
  | The affiliation
output:
 beamer_presentation:
   includes:
     in_header: ~/Desktop/preamble.tex
---


## R Markdown

This is an R Markdown presentation. 
Markdown is a simple formatting syntax for 
authoring HTML, PDF, and MS Word documents.

输出将是:

投影仪字体已更改

并且您应该能够拥有多个作者和机构

title: This is the title
author: 
   - Author Juan$^1$
   - Author Tu$^2$
institute: 
   - $^1$Juans Casa
   - $^2$Tus Place
date: "Thursday, April 09, 2015"
output:
  beamer_presentation

以应对隶属关系的正确方式beamer是通过\\institute{}这个答案上tex.SE)。

当前解决方案(pandoc 版本 >= 1.17)

pandoc 1.17开始, institute字段出现在默认的 beamer 模板中,所以如果你有正确的版本,你需要做的就是:

---
title: "This is the title"
author: "Author"
institute: "Affiliation"
date: "Thursday, April 09, 2015"
---

旧答案

如果您使用较旧的 pandoc 版本(< 1.17)或 rmarkdown 的默认 Beamer 模板尚未更新,则可能需要。 要使用 pandoc 进行这项工作,您可以编辑您的投影仪模板。 如果您还没有编辑它,您可以使用以下命令创建它:

pandoc -D beamer > ~/.pandoc/templates/default.beamer

然后,打开文件并在作者信息后添加:

$if(institute)$
\institute[]{$institute$}
$endif$

最后,将 Institute 选项添加到您的 yaml 中:

---
title: "This is the title"
author: "Author"
institute: "Affiliation"
date: "Thursday, April 09, 2015"
---

如果您使用 rmarkdown,则可能需要指定模板:

---
title: "This is the title"
author: "Author"
institute: "Affiliation"
date: "Thursday, April 09, 2015"
output:
  beamer_presentation:
    template: ~/.pandoc/templates/default.beamer
---

与多行作者相比,使用它有两个优点。

  1. 一些投影仪主题使用作者字段和/或研究所字段,例如在每张幻灯片的底部重复它。 多行作者会把这搞砸。
  2. 这允许更好地控制标题幻灯片元素:您可以为作者和从属信息使用不同的字体系列和大小,例如:
\setbeamerfont{institute}{size={\fontsize{5}{20}}}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM