blob: b2f9e5ebfb6e48bb4f53e1fd70068123625ca495 [file] [log] [blame]
Hao Zhu8dd65a92018-01-05 20:40:27 -05001---
2title: "add_footnote_adv"
3author: "Hao"
4date: "1/5/2018"
Hao Zhu19c4fa52018-01-09 12:01:14 -05005output: pdf_document
Hao Zhu8dd65a92018-01-05 20:40:27 -05006---
7
8```{r}
9library(knitr)
10library(kableExtra)
11
Hao Zhud57ba6d2018-01-09 14:17:02 -050012dt <- mtcars[, 1:2]
Hao Zhu19c4fa52018-01-09 12:01:14 -050013colnames(dt)[1] <- paste0("mpg", footnote_marker_alphabet(2, "latex"))
Hao Zhud57ba6d2018-01-09 14:17:02 -050014```
Hao Zhu19c4fa52018-01-09 12:01:14 -050015
Hao Zhud57ba6d2018-01-09 14:17:02 -050016
17```{r}
Hao Zhu19c4fa52018-01-09 12:01:14 -050018dt %>%
19 kable("latex", caption = paste0("test", footnote_marker_symbol(1, "latex")),
Hao Zhud57ba6d2018-01-09 14:17:02 -050020 booktabs = T, escape = F, longtable = T) %>%
Hao Zhu19c4fa52018-01-09 12:01:14 -050021 footnote(NULL, c("number 1; ", "number 2. "), c("a 1; ", "a 2."), c("s 1; ", "s 2."),
22 number_title = "special: ", alphabet_title = "abc: ",
23 footnote_as_chunk = T)
Hao Zhu8dd65a92018-01-05 20:40:27 -050024```
Hao Zhubab692d2018-01-09 17:49:55 -050025
26```{r}
27mtcars[1:5, 1:5] %>%
28 kable("latex", booktabs = T) %>%
Hao Zhu17814c72018-01-10 11:32:14 -050029 footnote(number = c("For this particular use (i.e. a general note) the comments above are adequate. For proper footnotes in tables you should probably use the threeparttable package. You should also probably be using the booktabs package. See this answer to this question", "Note 2"),
30 number_title = "Note: ", threeparttable = T, footnote_as_chunk = T)
Hao Zhubab692d2018-01-09 17:49:55 -050031```