如何创建具有此布局的表格?

如何创建具有此布局的表格?

在寻求帮助之前,我尝试自己寻找方法\cline \multicolumns,但\multirows没有成功。

我如何获得下面布局的表格?

表格布局

编辑:

我的尝试:

\documentclass[a4paper]{report}
\usepackage{multirow}
\usepackage{array}
\begin{document}
\begin{table}[h]
\begin{center}
\renewcommand{\arraystretch}{2}
\begin{tabular}{|m{2cm}|m{2cm}|m{3cm}|m{2cm}|m{2cm}|}
\hline
\multirow{2}*{text} & \multirow{2}*{text} & \multirow{2}*{text} & \multicolumn{2}{c|}{text}\\
\cline{1-3}
1 & 2 & 3 & 4 & 5\\
\hline
\end{tabular}
\end{center}
\end{table}
\end{document}

答案1

你几乎已经实现了你想要的一切:-)

\documentclass[a4paper]{report}
\usepackage{multirow}
\usepackage{array}
\begin{document}
\begin{table}[h]
\centering
\renewcommand{\arraystretch}{2}
\begin{tabular}{|m{2cm}|m{2cm}|m{3cm}|m{2cm}|m{2cm}|}
\hline
\multirow{2}*{text} & \multirow{2}*{text} & \multirow{2}*{text} & \multicolumn{2}{c|}{text}\\
    \cline{4-5}
  &   &   & 4 & 5\\
    \hline
1 & 2 & 3 & 4 & 5\\
\hline
\end{tabular}
\end{table}
\end{document}

在此处输入图片描述

答案2

{NiceTabular}下面显示了如何使用 制作该表nicematrix

在该环境中,它类似于{tabular}(的array),您可以使用命令垂直和水平合并单元格\Block,并且键hvlines会绘制块(由创建)中除外的所有规则\Block

\documentclass[a4paper]{report}
\usepackage{nicematrix}
\begin{document}
\begin{table}[h]
\centering
\renewcommand{\arraystretch}{2}
\begin{NiceTabular}{m{2cm}m{2cm}m{3cm}m{2cm}m{2cm}}[hvlines]
\Block{2-1}{text} & \Block{2-1}{text} & \Block{2-1}{text} & \Block{1-2}{text}\\
  &   &   & 4 & 5\\
1 & 2 & 3 & 4 & 5\\
\end{NiceTabular}
\end{table}
\end{document}

您需要多次编译(因为nicematrix在后台使用 PGF/Tikz 节点)。

上述代码的输出

相关内容