2015-07-13 59 views
3

我想调整一个xtable数字标题左对齐表与表,或者如果不起作用,至少居中,因为我认为它看起来很亲切愚蠢的一张小桌子居中,相应的标题左对齐。另外,左对齐表格和标题并不是最佳选择。xtable标题对齐左对齐表或集中(使用knitr)

它应该是可能的usinglatex.environments = "left",但我收到一条错误消息,就像在this后。

我不认为问题在于参考,因为我收到与label="myLabel"相同的错误消息。

这里,MWE:

<<table, echo=FALSE, results='asis'>>= 
print(xtable(lm(mpg~hp, data=mtcars), caption="Linear Model", label="myLabel") , caption.placement = "top", latex.environments="left") 
@ 

错误(缩写形式,长期看版再次this后):

Missing $ inserted. 
Missing delimiter (. inserted) 
Missing $ inserted 
Missing \right. inserted 

是否有人知道解决办法?左对齐左侧或居中,我会很高兴与任何解决方案。

+0

我有问题。与此同时你是否使用'latex.environments =“left”'发现了这个问题? – giordano

回答

0

确定,所以我找到了解决至少中心表字幕,使用包caption,指定

\usepackage[ 
    singlelinecheck=false, 
    justification=centering 
]{caption} 
+1

为了左对齐表格,使用'latex.environments =“flushleft”'。请参阅http://stackoverflow.com/a/31898709/3625022。 – Clarinetist