仅在使用 R Markdown 的 beamer 中暂停后显示脚注

Show footnote only after a pause in beamer with R Markdown

我正在制作 Beamer 演示文稿,我在单张幻灯片的内容之间使用停顿。我不知道如何在暂停后才显示脚注。

这是一个例子:

---
title: ""
author: ""
date: ""
output:
  beamer_presentation
bibliography: test.bib
---

* one argument

\pause

* another argument^[This citation should appear only with point 2: @fargues2006]

# references

test.bib:

@article{fargues2006,
  title = {The {{Demographic Benefit}} of {{International Migration}}: {{Hypothesis}} and {{Application}} to {{Middle Eastern}} and {{North African Contexts}}},
  author = {Fargues, Philippe},
  date = {2006},
  journaltitle = {World Bank Policy Research Paper},
  url = {http://documents.worldbank.org/curated/en/508301468280735279/pdf/wps4050.pdf},
  number = {4050}
}

在此示例中,当仅显示第一个点时不应出现脚注,而应在显示第二个点时出现。

我尝试申请 this answer from TeX StackExchange 但没有成功。

我该怎么做?

编辑: 按照@samcarter_is_at_topanswers.xyz的回答,我明确表示我更喜欢一种不需要在文档中从 markdown 切换到 LaTeX 的解决方案,具体取决于关于幻灯片是否有停顿和脚注。但是,我可以使用 .tex 文件或在 YAML 中添加 pandoc 参数(因为我认为解决方案必须这样,但我可能错了)。

编辑 #2: 我想在这些脚注中添加参考 @citationkey

也问了on RStudio Community

您可以使用正确的 Latex 语法来解决此问题:

---
title: ""
author: ""
date: ""
output:
  beamer_presentation
---

* one argument

\pause

* ```{=latex}
another argument\footnote<.(1)->{This should appear only with point 2}
```

或隐藏脚注规则:

---
title: ""
author: ""
date: ""
output:
  beamer_presentation:
    keep_tex: true
---

##  {.t}


* one argument

\pause

* ```{=latex}
another argument\only<.(1)->{\footnote{This should appear only with point 2}}
```

(顶对齐是为了避免跳n)

编辑:更新-包括@citationkey

问题在于 pandoc 如何将输出 tex 文件中的 ^[] 转换为 \footnote

降价中的这个:

another argument ^[This citation should appear only with point 2: @fargues2006]

在 latex 中编译成这样:

another argument\footnote<.->{This citation should appear only
    with point 2: Fargues (2006)}

为了让脚注只显示你的观点出现在幻灯片上,你真的需要这个乳胶翻译:

another argument\footnote\only<+->{This citation should appear only with point 2: Fargues (2006)}

only<+->中,+是表示当前覆盖的特殊符号

为了让它工作,你可以重新定义 \footnote 命令,这样当 pandoc 翻译它时它实际上调用:\only<+->\footnote.

注意:

完整的命令是 \only<+->\footnote<.-> 这可能会导致逐项幻灯片重复,因为有两个指向脚注应该出现的位置的指针(\only<+-><.->)并且因为 pandoc是自动插入的,我不确定有什么方法可以摆脱它。

这种重复也可能是使用 *\pause 以及 pandoc 将其翻译成出现在它自己的 itemize 环境中的每个项目的结果——它也有设置选项在哪里脚注需要出现,这也是 pandoc 的事情。

我没有做足够的挖掘来知道其中哪一个是重复的真正罪魁祸首..但是无论哪种方式,乳胶应该为 \footnotes 命令和“最本地的”应用第一个指针格式" 在一个环境中设置(即它会将脚注放在分项上).. 所以每张重复的幻灯片,这样你至少可以使用这种方法获得正确的格式,但你必须删除重复项。如果有人知道防止这种情况的方法-我很想听听。

使用: 在你的降价开始时包括这个:

\let\oldfootnote\footnote
\renewcommand{\footnote}{\only<+->\oldfootnote}

您的完整降价:

---
title: ""
author: ""
date: ""
output:
  beamer_presentation:
    keep_tex: true
bibliography: test.bib
header-includes:
  - \let\oldfootnote\footnote
  - \renewcommand{\footnote}{\only<+->\oldfootnote}


---


* one argument

\pause

* another argument ^[This citation should appear only with point 2: @fargues2006]

\pause 

* and another argument ^[This citation should appear only with point 3]

输出: