在乳胶中使用kable向分组行的行名添加上标时,缩进会受到干扰 [英] Indenting disturbed when adding superscript to rowname of a grouped row using kable in latex
本文介绍了在乳胶中使用kable向分组行的行名添加上标时,缩进会受到干扰的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在 latex 环境中使用kable创建的表的特定行的名称中添加上标(
How do I add superscript to name of a particular row of a table created using kable in latex environment (this link gives solution for markdown). I tried following:
at2=cbind(1:5,6:10,11:15)
rownames(at2)=c("one", "two", "three", "four$^1$", "five")
kable(at2,format = "latex",booktabs=T)
但这不起作用.
第一个问题用escape = FALSE
解决了,但是现在出现了一个与缩进有关的新问题.我正在使用group_rows
,它会自动创建缩进.使用escape
会导致此缩进问题.代码:
The first problem is solved with escape = FALSE
but now a new problem related to indentation has come up. I am using group_rows
which automatically creates indenting. Using escape
is creating problem with this indenting. Code:
at2=cbind(1:5,6:10,11:15)
rownames(at2)=c("one", "two", "three", "four$^1$", "five")
kable(at2,format = "latex",booktabs=T,escape = FALSE,col.names = month.abb[1:3])%>%
group_rows("group1",1,2)%>%
group_rows("group2",3,5)
推荐答案
要添加上标footnote_marker_number
应该很方便
library(knitr)
library(kableExtra)
library(dplyr)
#sample data
at2 <- cbind(1:5, 6:10, 11:15)
rownames(at2) <- c("one", "two", "three", paste0("four", footnote_marker_number(1, "latex")), "five")
kable(at2, format = "latex", escape = F, col.names = month.abb[1:3]) %>%
group_rows("group1", 1, 2) %>%
group_rows("group2", 3, 5)
输出为:
这篇关于在乳胶中使用kable向分组行的行名添加上标时,缩进会受到干扰的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文