2015-07-13 94 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