Show footnote only after a pause in beamer with R Markdown

I am making a Beamer presentation and I use pauses between contents of a single slide. I can't figure out how to show a footnote only after a pause.

Here's an example:

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

* one argument

\pause

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

# references

with 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}
}

In this example, the footnote should not appear when only the first point is shown, but instead when the second point is shown.

I tried to apply this answer from TeX StackExchange but without success.

How can I do that?

Edit: following @samcarter_is_at_topanswers.xyz's answer, I precise that I would prefer a solution that does not require to switch from markdown to LaTeX in the document depending on whether a slide has both pauses and footnotes. However, I'm okay with using a .tex file or adding pandoc arguments in YAML (because I think the solution has to be this way, but I may be wrong).

Edit #2: I would like to put references in these footnotes with @citationkey

Also asked on StackOverflow

Solved by @AnnaNevison on StackOverflow :

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

See the link above for the whole explanation. One drawback of this approach is that when two footnotes appear at the same time, the second one does not work but shows <.-> The content of the footnote in the body of the text (to see that, remove \pause between bullets 2 and 3 in the example).

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.