如何将xtable对象放置在页面的左侧 [英] How to place xtable object to the left side of page

查看:77
本文介绍了如何将xtable对象放置在页面的左侧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题::如何将xtable对象放置在页面左侧或如何禁用全局居中.

Question: How to place xtable object to the left side of page or how to disable centering globally.

我正在努力弄清楚如何将xtable对象放置在左侧.我有一个* .Rmd文件,所有这些都转到了相关的r块中.

I'm struggling to figure out how to place xtable object on the left side. I have got a *.Rmd file and all this goes to the relevant r chunk.

require(xtable)
df <- data.frame(x=seq(1,10,1),y=rnorm(10))

Xtab <- xtable(df, digits=0, caption="\\textbf{MINIMAL/IDEAL}",  
               floating=FALSE, latex.environments = c("left"))
print(Xtab, size = "small", include.colnames=FALSE)

在阅读了各种资源(print.xtable; xtable手册等)之后,我包括以下内容

I have included the following after reading various sources (print.xtable; xtable manual etc.)

1) floating=FALSE 2) latex.environments = c("left")

我已经搜索了SO,并使用了一些提示,但都失败了.

I have searched SO and used some of the hints but all failed.

推荐答案

无论您将参数传递给xtable()还是print(xtable()),似乎都有很大的不同.下面的块根据您的数据创建一个表格,该表格在pdf文件中的页面左侧对齐.

It seems to make quite a difference whether you pass a parameter to xtable() or to print(xtable()). The following chunk creates a table according to your data that is aligned at the left of the page in the pdf file.

```{r, results='asis',echo=FALSE}
library(xtable)
df <- data.frame(x=seq(1, 10, 1),y = rnorm(10))
print(xtable(df,digits=0, caption="\\textbf{MINIMAL/IDEAL}"), include.colnames=FALSE, size = "small", comment=FALSE, latex.environments="flushleft")
```

但是,正如您所看到的,标题仍位于页面的中心.

However, as you can see, the caption remains at the center of the page.

这篇关于如何将xtable对象放置在页面的左侧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆