Show footnote only after a pause in beamer with R Markdown
Edit: update- to include @citationkey
:
The issue is with how pandoc is translating the ^[] into \footnote
in the output tex file.
This in the markdown:
another argument ^[This citation should appear only with point 2: @fargues2006]
Compiles into this in latex:
another argument\footnote<.->{This citation should appear only
with point 2: Fargues (2006)}
In order to get the footnotes to show up only the slides your point appears on you really need this latex translation:
another argument\footnote\only<+->{This citation should appear only with point 2: Fargues (2006)}
In only<+->
, the +
is a special symbol to mean the current overlay.
To get this to work, you can redefine the \footnote
command so when pandoc translates it it actually calls: \only<+->\footnote
.
NOTE:
The the full command is \only<+->\footnote<.->
which could cause the itemized slides to duplicate because there is two pointers to where the footnotes should appear (\only<+->
and <.->
) and since pandoc is auto-inserting one, I am not sure of a way to get rid of that.
This duplication could also be the result of using *
and \pause
and pandoc translating that to each item appearing in its own itemize
environment- which also has setting options for where the footnotes need to appear and again is also a pandoc thing.
I haven't done enough digging to know which of these is the true culprit for the duplicates..But either way, latex should apply the first pointer formatting for the \footnotes
command and the "most local" setting within an environment (i.e. it will take the footnotes over the itemize).. so each duplicate slide so you'll get the proper formatting at least with this method, but you will have to remove duplicates. If someone knows a way to prevent this- I would be interested to hear about it.
To use: Include this at the beginning of your markdown:
\let\oldfootnote\footnote
\renewcommand{\footnote}{\only<+->\oldfootnote}
Your full markdown:
---
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]
The output: