仅在使用 R Markdown 在投影仪中暂停后才显示脚注

bre*_*auv 8 r beamer 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
Run Code Online (Sandbox Code Playgroud)

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

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

我试图从 TeX StackExchange应用这个答案,但没有成功。

我怎样才能做到这一点?

编辑:按照@samcarter_is_at_topanswers.xyz 的回答,我确切地说我更喜欢一种不需要根据幻灯片是否同时具有停顿和脚注而在文档中从降价切换到 LaTeX 的解决方案。但是,我可以.tex在 YAML 中使用文件或添加 pandoc 参数(因为我认为解决方案必须是这种方式,但我可能错了)。

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

也在RStudio 社区上问过

Ann*_*son 4

编辑:更新-包括@citationkey:

问题在于 pandoc 如何将 ^[] 翻译成\footnote输出 tex 文件。

这在降价中:

another argument ^[This citation should appear only with point 2: @fargues2006]
Run Code Online (Sandbox Code Playgroud)

在 Latex 中编译成这样:

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

为了让脚注只显示您的观点所在的幻灯片,您确实需要这个乳胶翻译:

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

在 中only<+->,+是一个特殊符号,表示当前叠加层。

要使其正常工作,您可以重新定义\footnote命令,以便当 pandoc 翻译它时,它实际上调用:\only<+->\footnote。

笔记:

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

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

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

使用方法: 将其包含在 Markdown 的开头:

\let\oldfootnote\footnote
\renewcommand{\footnote}{\only<+->\oldfootnote}
Run Code Online (Sandbox Code Playgroud)

您的完整降价:

---
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]

Run Code Online (Sandbox Code Playgroud)

输出:

在此输入图像描述