\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{array}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\begin{document}
\centering
\begin{tabular}{ |@{}C{20mm}@{}|*{5}{@{}C{8mm}@{}|}@{}C{20mm}@{}| }
\hline
a & b & c & d & e & f & g\\ \hline
a & b & c & d & e & f & g\\ \hline
start &
\multicolumn{5}{@{}l@{}}{
\begin{tabular}{*{4}{@{}C{10.1mm}@{}|}}
1 & 2 & 3 & 4 %\\ \hline 1 & 2 & 3 & 4 \\
\end{tabular}}
& end \\ \hline
a & b & c & d & e & f & g\\ \hline
a & b & c & d & e & f & g\\ \hline
\end{tabular}
\end{document}
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{array}
\usepackage{tabularx}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\begin{document}
\centering
\begin{tabularx}{100mm}{ |@{}C{15mm}@{}|*{5}{@{}>{\centering\arraybackslash}X@{}|}@{}C{15mm}@{}| }
\hline
a & b & c & d & e & f & g \\ \hline
a & b & c & d & e & f & g \\ \hline
\multicolumn{7}{@{}l@{}}{
\begin{tabularx}{100mm}{ |@{}C{15mm}@{}|
@{}*{4}{@{}>{\centering\arraybackslash}X@{}|}
@{}C{15mm}@{}|}
start & 1 & 2 & 3 & 4 & stop %\\ \hline start & 1 & 2 & 3 & 4 & stop \\
\end{tabularx}} \\ \hline
a & b & c & d & e & f & g\\ \hline
a & b & c & d & e & f & g\\ \hline
\end{tabularx}
\end{document}
如果问题的作者试图制作这样一个表格,那么我可以使用那里的数据(以免浪费时间自己输入公式)。但是由于没有示例,我将给出最小内容的表格。
要创建这样的表,您可以创建嵌套表并使用命令
\multicolumn。问题在于那些在单元格周围插入的垫片 - 对于嵌套表格,它们将与外部表格不同。因此,最容易摆脱所有这些间距(通过@{}每个表的序言中的命令)。要指定单元格,使用包中的列说明符之一会更方便array:p、m或b- 它们允许您手动设置所需的列宽(这适用于第一个和最后一个,应该比其余的更宽)。此外,您可以对所有内部列使用相同的类型,但是您需要精确选择大小以使垂直线匹配。或者您可以使用tabularx 包和 table environment 中的Xtabularx列说明符,它允许您设置整个表格的宽度。以下是几个例子。第一个选项:使用通常的环境
tabular并手动选择列的宽度。结果如下所示:
第二个选项,自动计算内部列的宽度和环境,
tabularx在我看来更方便;这里只需要指定整个表格的宽度和首尾列的宽度(对于嵌套表和外部表,这些值当然必须相同):因此,此选项的结果是:
在这两种情况下,对于固定宽度的列,都使用了我在序言中定义的格式
C,而对于具有自动调整宽度的格式,我没有重新定义列,而只是显式地在表序言中添加了一个命令>{\centering\arraybackslash}——它只是有使单元格的内容居中。此外,在这两种情况下,我都将嵌套表的第二行注释掉 - 您可以取消注释并查看在这种情况下表的外观。