【问题标题】:Add author affiliation in R markdown beamer presentation在 R markdown beamer 演示文稿中添加作者隶属关系
【发布时间】:2015-06-14 10:44:59
【问题描述】:

如何在 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

愿望标题幻灯片应该是

这是标题

作者

隶属关系

2015 年 4 月 9 日,星期四

【问题讨论】:

    标签: r knitr r-markdown pandoc beamer


    【解决方案1】:

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

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

    输出:

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

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

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

    所以对于你的例子,我们有:

    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.
    

    输出将是:

    【讨论】:

    • 可以把tilttle字体变大,把作者和单位变小吗??
    • 这不再起作用(可能更高版本的行为不同)
    【解决方案2】:

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

    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
    

    【讨论】:

      【解决方案3】:

      beamer 中处理从属关系的正确方法是通过\institute{}(参见tex.SE 上的this answer)。

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

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

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

      旧答案

      如果您使用较旧的 pandoc 版本 (

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

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

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

      最后,将机构选项添加到您的 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}}}
      

      【讨论】:

      • 不是 pandoc 1.17 吗?我试图编辑你的答案,但它不允许我做这么小的改变。
      猜你喜欢
      • 2020-08-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-15
      • 2016-01-16
      相关资源
      最近更新 更多