blob: 54aa8442ed71d34c74ebe825d141b8be031d1af5 [file] [log] [blame]
Hao Zhue10cfd32017-02-21 16:41:14 -05001---
Hao Zhua3fc0c42017-02-27 12:04:59 -05002title: "add_footnote - PDF"
Hao Zhue10cfd32017-02-21 16:41:14 -05003output: pdf_document
4---
5
6# Through Pandoc
7```{r through_pandoc}
8library(knitr)
9library(kableExtra)
10dt <- mtcars[1:5, 1:2]
11colnames(dt)[1] <- c("mpg[note]")
12rownames(dt)[2] <- c("Mazda RX4 Wag[note]")
13dt[3, 2] <- paste0(dt[3, 2], "[note]")
14
15kable(dt) %>%
16 add_footnote(c("footnote 1", "footnote 2", "footnote 3"))
17```
18
19# Through LaTeX
20## Plain LaTeX
21```{r through_latex_plain}
22kable(dt, format = "latex") %>%
23 add_footnote(c("footnote 1", "footnote 2", "footnote 3"))
24```
25
26## LaTeX + booktabs
27```{r through_latex_booktabs}
28kable(dt, format = "latex", booktabs = T) %>%
29 add_footnote(c("footnote 1", "footnote 2", "footnote 3"))
30```
31
Hao Zhuc5415632017-02-21 17:16:13 -050032## LaTeX + longtable + booktabs
33Centered Table + page footnotes
Hao Zhue10cfd32017-02-21 16:41:14 -050034```{r through_latex_longtable}
Hao Zhuc5415632017-02-21 17:16:13 -050035kable(dt, format = "latex", longtable = T, booktabs = T) %>%
36 add_footnote(c("footnote 1", "footnote 2", "footnote 3"))
Hao Zhue10cfd32017-02-21 16:41:14 -050037```
Hao Zhu8dd65a92018-01-05 20:40:27 -050038
39## LaTeX + longtable
40Centered Table + page footnotes
41```{r}
42kable(dt, format = "latex", longtable = T) %>%
43 add_footnote(c("footnote 1", "footnote 2", "footnote 3"))
44```
45
46```{r}
Hao Zhu19c4fa52018-01-09 12:01:14 -050047kable(dt, format = "latex", booktabs = T) %>%
48 kable_styling(full_width = T) %>%
49 add_footnote(c("Footnote 1", "Have a good day.", "sss"), notation = "alphabet")
Hao Zhu8dd65a92018-01-05 20:40:27 -050050```