blob: d29bcaf233589ce84fd0df623ef7cca6b271f105 [file] [log] [blame]
Hao Zhue10cfd32017-02-21 16:41:14 -05001---
2title: add_footnote - PDF
3output: pdf_document
Hao Zhu94956582017-02-21 18:18:29 -05004vignette: >
5 %\VignetteIndexEntry{Use add_footnote in PDF document}
6 %\VignetteEngine{knitr::rmarkdown}
7 %\VignetteEncoding{UTF-8}
Hao Zhue10cfd32017-02-21 16:41:14 -05008---
9
10# Through Pandoc
11```{r through_pandoc}
12library(knitr)
13library(kableExtra)
14dt <- mtcars[1:5, 1:2]
15colnames(dt)[1] <- c("mpg[note]")
16rownames(dt)[2] <- c("Mazda RX4 Wag[note]")
17dt[3, 2] <- paste0(dt[3, 2], "[note]")
18
19kable(dt) %>%
20 add_footnote(c("footnote 1", "footnote 2", "footnote 3"))
21```
22
23# Through LaTeX
24## Plain LaTeX
25```{r through_latex_plain}
26kable(dt, format = "latex") %>%
27 add_footnote(c("footnote 1", "footnote 2", "footnote 3"))
28```
29
30## LaTeX + booktabs
31```{r through_latex_booktabs}
32kable(dt, format = "latex", booktabs = T) %>%
33 add_footnote(c("footnote 1", "footnote 2", "footnote 3"))
34```
35
Hao Zhuc5415632017-02-21 17:16:13 -050036## LaTeX + longtable + booktabs
37Centered Table + page footnotes
Hao Zhue10cfd32017-02-21 16:41:14 -050038```{r through_latex_longtable}
Hao Zhuc5415632017-02-21 17:16:13 -050039kable(dt, format = "latex", longtable = T, booktabs = T) %>%
40 add_footnote(c("footnote 1", "footnote 2", "footnote 3"))
Hao Zhue10cfd32017-02-21 16:41:14 -050041```