TeX表中的多单元格

时间:2011-07-29 23:06:14

标签: latex tex

我正在尝试创建一个与Cremona关于椭圆曲线的书的first table非常相似的表格,但偶尔我想让单元格跨越多行。我并不反对使用LaTeX软件包,但我无法弄清楚如何使用可变宽度列,这些列尊重中心列周围的垂直条。

(来自Wikibooks的此代码使居中的列显示为右对齐

    \begin{tabular*}{0.75\textwidth}{@{\extracolsep{\fill}} | c | c | c | r | }
    \hline
    label 1 & label 2 & label 3 & label 4 \\
    \hline
    item 1  & item 2  & item 3  & item 4  \\
    \hline
    \end{tabular*}

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:1)

只需使用表格环境而不是表格*,上面的示例将包含所有居中的列。

我给出以下示例以显示居中的multicols和居中的multirows(使用包multirow):

\begin{tabular}{ | c | c | c | r | }
\hline
label 1 & label 2 & label 3 & label 4 \\
\hline
\multicolumn{2}{|c|}{\textbf{Name of the SLA parameter $\pi$}} &
\multicolumn{2}{|c|}{\textbf{Name of the SLA parameter $\pi$}} \\
\hline
\multirow{2}{*}{item 1} & item 2 & item 3 & item 4\\
  & item 2  & item 3  & item 4  \\
\hline
item 1  & item 2  & item 3  & item 4  \\
\hline
\end{tabular}

要居中的所有列和行都居中。