R-studio と Knitr を使用して pdf を作成すると、テーブルを水平方向に中央に配置できません。以下の例からわかるように、xtable() を使用すると問題なく動作しますが、latex() テーブルはすべて左揃えです。Hmisc のドキュメントを理解しているので、latex() から作成されたテーブルは水平方向に自動的に中央に配置されるはずですが、何か間違ったことをしているに違いありません。
\documentclass{article}
\begin{document}
<<>>=
library(Hmisc)
library(tables)
library(xtable)
@
The tables are all left-aligned:
<<results='asis'>>=
latex( tabular( (Species + 1) ~ (n=1) + Format(digits=2)*(Sepal.Length + Sepal.Width)*(mean + sd), data=iris ) )
@
<<results='asis'>>=
latex( tabular( (Species + 1) ~ (n=1) + Format(digits=2)*(Sepal.Length + Sepal.Width)*(mean + sd), data=iris ),center="center" )
@
<<results='asis'>>=
latex( tabular( (Species + 1) ~ (n=1) + Format(digits=2)*(Sepal.Length + Sepal.Width)*(mean + sd), data=iris ),center="centering" )
@
I have tried to use the fig.align option, but it does not do it:
<<results='asis',fig.align='center'>>=
latex( tabular( (Species + 1) ~ (n=1) + Format(digits=2)*(Sepal.Length + Sepal.Width)*(mean + sd), data=iris ) )
@
with xtable it automatically centers:
<<results='asis'>>=
xtable(table(Puromycin$conc, Puromycin$state))
@
\end{document}
R バージョン 3.0.0 (2013-04-03)
プラットフォーム: x86_64-w64-mingw32/x64 (64 ビット)