【发布时间】:2015-07-11 17:14:50
【问题描述】:
如果我执行以下命令:
xtable(diamonds[1:5,1:4], label = 'tab:myTab', caption='This is my caption',align = c("rr|lr|r"))
我得到以下输出:
\begin{table}[ht]
\centering
\begin{tabular}{rr|lr|r}
\hline
& carat & cut & color & clarity \\
\hline
1 & 0.23 & Ideal & E & SI2 \\
2 & 0.21 & Premium & E & SI1 \\
3 & 0.23 & Good & E & VS1 \\
4 & 0.29 & Premium & I & VS2 \\
5 & 0.31 & Good & J & SI2 \\
\hline
\end{tabular}
\caption{This is my caption}
\label{tab:myTab}
\end{table}
我的问题是:是否可以让 xtable 输出不是 {table},而是 {table*}?
========================== 编辑===================== ====
我正在考虑 Repmat 的意见。我正在使用此处的代码 (How to center LaTeX xtable output in full text width)。
1) 我在他们的序言中添加了一个包
\usepackage{tabularx}
2) 然后,我改变了他们的命令:
print(x.big, tabular.environment ='longtable', floating = FALSE, include.rownames=FALSE)
到四个命令:
print(x.big, tabular.environment ='tabular*', include.rownames=FALSE, width= "\\linewidth")
print(x.big, tabular.environment ='tabular*', include.rownames=FALSE, width= "\\textwidth")
print(x.big, tabular.environment ='tabularx', include.rownames=FALSE, width = "\\linewidth")
print(x.big, tabular.environment ='tabularx', include.rownames=FALSE, width= "\\textwidth")
每次都会产生如下输出:
当我想要做的输出更像是:
我不介意将 xtable 也移动一个硬编码的指定量(例如向右移动 3 英寸) - 但我也能够弄清楚这一点。
【问题讨论】:
-
{table*}和{table}有什么区别?也许它与乳胶中的表编号有关,是吗? -
我认为 {table*} 用于整页宽度的表格
-
(mirrors.ibiblio.org/CTAN/macros/latex/contrib/tufte-latex/…) 第 页。图 3 显示了 figure 和 figure* 环境之间的区别。
-
LaTeX 中的星标环境通常应用于两列或多列布局,其中带星号的版本跨越整个页面宽度,而通常的版本与列宽一样宽。
-
感谢@RHertel!根据我提供的参考资料,我认为这也是正确的。您认为使用 xtable 命令可以实现此目的吗?我正在使用该参考中给出的相同 Tufte-Handout 格式的 xtable 命令。