在 kable / kableExtra 中包含脚注和重复标题

Jor*_*dan 1 r kableextra kable

当我包含kableExtra 中的repeat_header选项 ( kable_styling) 时,我丢失了脚注。我在帮助文件中看到kable_styling“可能有点棘手”。这是我正在经历的事情还是我缺少什么?在下面的代码中,我没有得到脚注。如果我删除 kable_styling,我会得到脚注。在我的真实情况中,我有一张长桌子,但据我所知, kable_styling 是罪魁祸首。

我今天刚刚用 github 版本更新了 kableExtra (9/18/17)

谢谢!

---
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"))
```
Run Code Online (Sandbox Code Playgroud)

pet*_*tzi 6

\n

现在\xe2\x80\x99s建议使用新的脚注函数而不是add_footnote来制作表格脚注(参见手册kableExtra,p.18)

\n
\n\n

新的脚注功能有更多的可能性:

\n\n
\n

脚注有四种表示法,即一般、数字、字母和符号。后三类脚注会标注相应的标记,一般的脚注不标注\xe2\x80\x99。

\n
\n\n

而不是add_footnote(c("This is my footnote"))你现在可以写例如

\n\n

footnote(general = "This is my footnote")

\n