0
votes

When I include the repeat_header option (kable_styling) from kableExtra, I lose my footnote. I see in the help files that kable_styling "can get a bit tricky." Is that what I'm experiencing or is there something I'm missing? In the code below, I get no footnote. If I remove the kable_styling, I get the foonote. In my real situation, I have a long table, but best as I can tell, kable_styling is the culprit.

I just updated kableExtra with the github version today (9/18/17)

Thanks!

---
title: "Untitled"
output: 
pdf_document: 
latex_engine: xelatex
---

```{r setup, include=FALSE}
library(knitr)
library(kableExtra)
```

```{r cars,results='asis'}
kable(mtcars,format='latex',booktabs=TRUE,col.names=c("mpg","cyl[note]","disp","hp","drat","wt","qsec","vs","am","gear","carb"),
longtable=T,caption="This is my table caption") %>% 
 add_footnote(c("This is my footnote")) %>% 
 kable_styling(latex_options = c("repeat_header"))
```
1
Hi @Jordan, I briefly looked into it and it seems like a bug/limitation in longtable (I could be wrong). Also, for such package specific things like this, I would recommend you make an issue on github github.com/haozhu233/kableExtra. I'm trying to check SO to help people out but I may miss 1 or 2 when I'm busy. thanks :)Hao
Thanks @Hao. As you saw, I posted a different one to github, but I often hesitate to do so because I usually assume I'm simply doing something wrong. I appreciate the quick response - I'm making a large markdown report and kableExtra has been amazing!Jordan
Ha, I didn't recognize it was you on github. Shameful to admit that because our github/SO username actually follow the same logic. :PHao

1 Answers

3
votes

Now it’s recommended to use the new footnote function instead of add_footnote to make table footnotes (see Manual kableExtra, p.18)

The new footnote function has more possibilities:

There are four notation systems in footnote, namely general, number, alphabet and symbol. The last three types of footnotes will be labeled with corresponding marks while general won’t be labeled.

instead of add_footnote(c("This is my footnote")) you could write now e.g.

footnote(general = "This is my footnote")