kableExtra
kableExtra copied to clipboard
show footnotes every page (with partial solution)
I'm using
- kbl with longtable and booktabs
- kable_styling with latex_options
- footnote with threeparttable to create a long table with footnotes for a pdf
I'd like the footnotes to show on every page
ideally there'd be an every_page
boolean argument for footnote
looks like the change would go in footnote.R, in the section starting line 287
can't create a pull because I'm not sure where bottomrule_regexp
comes from
here's a mre with a partial solution:
set up
knitr::opts_chunk$set(echo = TRUE)
library(kableExtra)
dat <- data.frame(
A = LETTERS[rep(1:26, each = 2)],
B = letters[rep(1:26, 2)],
n = 0:51
)
names(dat)[3] <- paste0(names(dat)[3], "\\tnote{1}")
current
dat_kbl <- dat |>
kbl(format = "latex", caption = "Caption",
escape = FALSE, booktabs = TRUE, longtable = TRUE) |>
kable_styling(
latex_options = "repeat_header") |>
footnote(
number = c(
"rows with n = 0 may be deleted in the final table"),
threeparttable = TRUE)
dat_kbl
modification
dat_kbl_mod <- sub(pattern = "\n\\endfoot",
replacement = "\n\\midrule\n\\insertTableNotes\n\\endfoot", x = dat_kbl,
fixed = TRUE)
dat_kbl_mod