插入表的简单方法?

时间:2010-03-06 15:41:53

标签: formatting latex

我是LaTeX的初学者。到目前为止,每当我创建一个表(使用表格环境)时,LaTeX会将它浮动在我自己的段落中,在我的文本行之间。

但是,我想要一种方法在一个段落(向左或向右)中嵌入一个小表,让文本在它周围流动。有没有一种简单的方法可以做到这一点,而无需对格式化进行过多的手动控制?

1 个答案:

答案 0 :(得分:3)

\begin{wraptable}{O}{0.5\columnwidth}
% 0.5\columnwidth is 50% of the width for text. It will wrap to the "outer"
% of the current page, and thus if you have double-sided print, it'll still look
% good.
\begin{centering}
% The centering will look nice (else it's left-aligned, which isn't nice)
\begin{tabular}{|c|c|}
% Having your own tabular here.
\hline
Hello & World\tabularnewline
\hline
\hline 
Stack & Overflow!\tabularnewline
\hline
% End of content.
\end{tabular}
\par % Add for spacing
\end{centering}
\caption{Test Table}
% Enter your caption (a float having a caption looks cool)
\end{wraptable}

这将使表格包裹&浮动。如果您熟悉它们,这看起来类似于HTML中的浮点数。