找到解决方案了:
\begin{table}[!htbp]
\centering
\bicaption{中文题目}{English caption}
\label{tab:Tab1}
---
{r , echo = FALSE}
knitr::kable( head(iris), booktabs = TRUE)
---
\end{table}
这样pdf中没问题,gitbook不识别latex,所以应该有更好的方案,
{r tab1}
library(knitr)
if(is_latex_output()) {
eval(paste("\\begin{table}[!htp]",
"\\bicaption{中文题目}{English caption}",
"kable(head(iris), booktabs = TRUE)",
"\\end{table}", sep = "\n"))
} else{
kable(head(iris), booktabs = TRUE, caption = "中文题目")
}
gitbook正常,pdf失败,应该是代码哪写的不对,