在kable / kableExtra中包含脚注和repeat_header

时间:2017-09-18 21:16:18

标签: r kableextra kable

当我从kableExtra中添加repeat_header选项(kable_styling)时,我丢失了我的脚注。我在帮助文件中看到kable_styling“可能会有点棘手。”那是我正在经历的还是我缺少的东西?在下面的代码中,我没有得到脚注。如果我删除kable_styling,我会得到foonote。在我的实际情况中,我有一个很长的桌子,但最好的,据我所知,kable_styling是罪魁祸首。

我刚刚使用github版本更新了kableExtra(17/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"))
```

1 个答案:

答案 0 :(得分:0)

  

现在建议使用新的脚注函数而不是add_footnote来制作表脚注(参见Manual kableExtra,第18页)

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

  

脚注中有四种表示系统,即通用,数字,字母和符号。最后三种类型的脚注将标有相应的标记,而一般不会标记。

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

footnote(general = "This is my footnote")