我想在功能中使用LaTeX
命令add_header_above
kableExtra
library(kableExtra)
x1 <- knitr::kable(head(mtcars), "html")
add_header_above(x1, c(" ", "Group 1" = 5, "Group 2" = 6))
add_header_above(x1, c(" ", "\\alpha" = 5, "Group 2" = 6))
x2 <- knitr::kable(head(mtcars), "latex")
add_header_above(x2, c(" ", "Group 1" = 5, "Group 2" = 6))
add_header_above(x2, c(" ", "\\alpha" = 5, "Group 2" = 6))
但是,该LaTeX
命令\\alpha
未正确呈现。任何解决方案,请。
已编辑
Test2 <- c(" ", مواطنين = "5", `غير مواطنين` = "6")
Test3 <- c(`\textarabic{}` = " ", `\textarabic{مواطنين}` = "5",
`\textarabic{غير مواطنين}` = "6")
add_header_above(x1, Test2, escape = FALSE)
add_header_above(x1, Test3, escape = FALSE)