在R markdown beamer演示文稿中添加作者联盟

Cro*_*ops 30 r beamer pandoc knitr r-markdown

如何在rmarkdown beamer演示文稿的新行中添加作者联盟?

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

- Bullet 1
- Bullet 2
- Bullet 3
Run Code Online (Sandbox Code Playgroud)

欲望标题幻灯片应该是

这是标题

作者

联系

2015年4月9日,星期四

Pet*_*mis 33

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

---
title: "The title"
author: | 
  | The author
  | The affiliation
date: "9 April 2015"
output: beamer_presentation
---
Run Code Online (Sandbox Code Playgroud)

输出:

投影仪

编辑(我们可以使用标题和作者/联盟字体吗?):

如果您想更改不同的字体大小,我建议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}}}
Run Code Online (Sandbox Code Playgroud)

你的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.
Run Code Online (Sandbox Code Playgroud)

输出将是:

beamer字体改变了


小智 15

你应该能够拥有多个作者和机构

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
Run Code Online (Sandbox Code Playgroud)


sco*_*coa 9

处理联系的正确方法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"
---
Run Code Online (Sandbox Code Playgroud)

老答案

如果您使用较旧的pandoc版本(<1.17)或者rmarkdown的默认beamer模板尚未更新,则可能需要.要使用pandoc工作,您可以编辑beamer模板.如果您尚未编辑它,可以使用以下命令创建它:

pandoc -D beamer > ~/.pandoc/templates/default.beamer
Run Code Online (Sandbox Code Playgroud)

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

$if(institute)$
\institute[]{$institute$}
$endif$
Run Code Online (Sandbox Code Playgroud)

最后,将the institute选项添加到您的yaml:

---
title: "This is the title"
author: "Author"
institute: "Affiliation"
date: "Thursday, April 09, 2015"
---
Run Code Online (Sandbox Code Playgroud)

如果您使用rmarkdown,则可能必须指定模板:

---
title: "This is the title"
author: "Author"
institute: "Affiliation"
date: "Thursday, April 09, 2015"
output:
  beamer_presentation:
    template: ~/.pandoc/templates/default.beamer
---
Run Code Online (Sandbox Code Playgroud)

在多线作者上使用它有两个优点.

  1. 一些beamer主题使用作者字段和/或研究所字段,例如在每张幻灯片的底部重复它.多线作者会搞砸了.
  2. 这样可以更好地控制标题幻灯片元素:例如,您可以为作者和联属信息设置不同的字体系列和大小:
\setbeamerfont{institute}{size={\fontsize{5}{20}}}
Run Code Online (Sandbox Code Playgroud)