How to embed footnotes in views for ioslides using RMarkdown

I created an ioslides presentation using the package knitrand it works well. Now I want to embed footnotes on slides. I did not find useful posts on SO. Can someone show me how to add footnotes on R slides? Any idea?

Here is a piece of dummy code:

---
title: "R presentation"
author: "me"
date: "March 9, 2017"
output: 
    ioslides_presentation
---

## slides one
 * content
 * introduction
## Content
- Bullet 1
- Bullet 2
- Bullet 3
+4
source share
2 answers

Here is a workaround. This may not be bullet proof and need further improvements:


Start with a fully reproducible example:

---
title: "Footnotes"
author: "Martin Schmelzer"
date: "9 3 2017"
output: ioslides_presentation
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```

<style>
div.footnotes {
  position: absolute;
  bottom: 0;
  margin-bottom: 10px;
  width: 80%;
  font-size: 0.6em;
}
</style>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

<script>
  $(document).ready(function() {
    $('slide:not(.backdrop):not(.title-slide)').append('<div class=\"footnotes\">');

    $('footnote').each(function(index) {
      var text  = $(this).html();
      var fnNum = (index+1).toString().sup();
      $(this).html(text + fnNum);

      var footnote   = fnNum + ': ' + $(this).attr('content') + '<br/>';
      var oldContent = $(this).parents('slide').children('div.footnotes').html();
      var newContent = oldContent + footnote;
      $(this).parents('slide').children('div.footnotes').html(newContent);
    });
  });
</script>



## Try out some footnotes

Lets assume I have a footnote <footnote content="The first awesoem footnote!">here</footnote>. And here we are going to have another one: <footnote content="This is my second footnote!">#secFN</footnote>


## The Second Topic

See auto numbering for <footnote content = "The counter is not set back and continues on the next slide.">footnotes</footnote>

Now let's see what I did here:

1. We add several styles to our footer container at the bottom of each slide.

2. jQuery.

3. script:

(document.ready()), , . (<div class="footnotes"></div>) .

, :

<footnote content="What should be written at the bottom?">Text</footnote>

, footnote . autonumbered, sup().


:

enter image description here enter image description here

+4

Martin Schmelzers , (.. ).

, . . . :

<footnote>A *footnote* with **formatting**</footnote>

enter image description here

---
title: "New footnotes"
author: "Emil Tveden Bjerglund"
date: "August 8, 2017"
subtitle: "Inspired by Martin Schmelzer"
output: ioslides_presentation
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
<style>
div.footnotes {
  position: absolute;
  bottom: 0;
  margin-bottom: 10px;
  width: 80%;
  font-size: 0.6em;
}
</style>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
  $('slide:not(.backdrop):not(.title-slide)').append('<div class=\"footnotes\">');

  $('footnote').each(function(index) {
    var text  = $(this).html();
    var fnNum = (index+1).toString();
    $(this).html(fnNum.sup());

    var footnote   = fnNum + '. ' + text + '<br/>';
    var oldContent = $(this).parents('slide').children('div.footnotes').html();
    var newContent = oldContent + footnote;
    $(this).parents('slide').children('div.footnotes').html(newContent);
  });
});
</script>

## Testing footnotes
Some text.<footnote>And a footnote. http://stackoverflow.com</footnote>

Some more text.<footnote>And *another* **footnote**</footnote>
+2

Source: https://habr.com/ru/post/1671864/


All Articles