1

Is it possible to put a table in the footnote in bookdown? I tried the following code and the table can not be correctly rendered.

This is footnote^[
|A   |B   |C   |
|:---|:---|:---|
|1   |4   |1   |
|2   |5   |1   |
|3   |6   |0   |
].
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
DreamHunter
  • 65
  • 3
  • 8

1 Answers1

1

This is just a start. The examples below show how to get a table in a footnote using kable from knitr and using cat to generate a hard-coded markdown table as in your example. The formatting of the footnotes doesn't look all that great, and will require some tweaking.

---
title: "Untitled"
author: "eipi10"
date: "7/12/2017"
output: bookdown::pdf_document2
---

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

This is a footnote.[^1]

[^1]: `r kable(mtcars[1:3,1:4])`


Here's another footnote.[^2]

```{r, results="asis"}
cat("[^2]:","|A   |B   |C   |
|:---|:---|:---|
|1   |4   |1   |
|2   |5   |1   |
|3   |6   |0   |", sep="\n")
```

Here's the output document with some white space excluded:

enter image description here

enter image description here

And here's the output with with bookdown::html_book as the output type:

enter image description here

eipi10
  • 91,525
  • 24
  • 209
  • 285