使用longtable更改xtable的字体大小

时间:2017-07-14 16:41:42

标签: r r-markdown

我有这个xtable,我想设置fontsize

我在做:

library(xtable)
options(xtable.include.rownames=F) 
#options(xtable.scalebox=.5)
options(xtable.size = "small")
options(xtable.tabular.environment = "longtable")
#options(xtable.width = "10 in")
options(xtable.comment=F)
options(xtable.floating = F)
#options("xtable.latex.environments", c("center"))

t = xtable(MYTABLE)

align(t) = "r|p{1.3cm}|p{1.25cm}|p{2cm}|p{.5cm}|p{1.8cm}|p{1.5cm}|p{1cm}|p{1cm}|p{1cm}|p{1cm}|p{1cm}|p{1cm}|p{1cm}|p{1cm}|p{1cm}|p{1cm}|"
digits(t) = c(0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1)
print(t, sanitize.text.function = identity,hline.after =      c(-1,seq(0,nrow(t)))  , add.to.row = list(pos = list(0), command = "\\hline \\endhead ")       )

选项(xtable.size =" small")不会更改字体大小。有没有办法可以用选项(xtable.size = ??)或fontsize = 9来改变字体大小?

我在这里看到https://cran.r-project.org/web/packages/xtable/vignettes/xtableGallery.pdf你可以使用add.to.row来改变选项,但字体大小可以用某种方式改变吗?

add.to.row <- list(pos = list(0), command = NULL)
command <- paste0("\\hline\n\\endhead\n",
"\\hline\n",
"\\multicolumn{", dim(x)[2] + 1, "}{l}",
"{\\footnotesize Continued on next page}\n",
"\\endfoot\n",
"\\endlastfoot\n")
add.to.row$command <- command
print(x.big, hline.after=c(-1), add.to.row = add.to.row,
tabular.environment = "longtable")

谢谢。

0 个答案:

没有答案