【发布时间】:2020-01-13 12:36:26
【问题描述】:
我正在使用 knitr/sweave 动态生成 R 代码并将其包含到我的乳胶文档中。我拥有的最小代码是:
list <- c("Bike", "Train", "Bike", "Bike", "Bike", "Train", "Bike", "Bike", "Bike", "Moped", "Bus", "Moped", "Train", "Bus", "Moped", "Bike","Moped")
library(xtable)
print(xtable(table(list)),floating=FALSE,booktabs=TRUE)
这会产生输出:
\begin{tabular}{rr}
\toprule
& list \\
\midrule
Bike & 8 \\
Bus & 2 \\
Moped & 4 \\
Train & 3 \\
\bottomrule
\end{tabular}
我想要的是将tabular 环境与基线对齐,即\begin{tabular}[t]{rr}...\end{tabular}。
查看xtable 文档有table.placement,但这引入了table 环境。我尝试了tabular.environment 并将其设置为tabular[t] 但这不起作用,因为它给了\begin{tabular[t]}
如何解决这个问题?
【问题讨论】: