我想重现与图片几乎相同的表格,但遇到了一些困难。我使用了以下内容:
\begin{table}[h]
\centering
\begin{tabular}{l|l|l|}
\hline
\multicolumn{1}{|l|}{\textbf{Type}} & \textbf{Model} & \textbf{Example} \\ \hline
\multicolumn{1}{|l|}{A} & Belongs to A & Example 1 \\ \hline
\multirow{2}{*}{} & \multirow{2}{*}{HERE IS PROBLEM} & \multirow{2}{*}{PROBLEM} \\
& & \\ \hline
\multicolumn{1}{|l|}{\multirow{4}{*}{B}} & \begin{tabular}[c] {@{}l@{}}Belongs to B\\ - \textit{Example1}\end{tabular} & Examples \\ \cline{2-3}
\multicolumn{1}{|l|}{} & Belongs to B & Examples \\ \cline{2-3}
\multicolumn{1}{|l|}{} & Belongs to B & Examples \\ \cline{2-3}
\multicolumn{1}{|l|}{} & Belongs to B & Examples \\ \hline
\end{tabular}
\caption{Table problem}
\label{table123}
\end{table}
我真正想要的是 'A' 和 'B' 覆盖具有 '属于 A 和 B' 的单元格,使得 A 和 B 之间有重叠,如图所示。
另外,我想使用:
\begin{enumerate} ... \end{enumerate}
但没有成功。
有小费吗?
答案1
像这样?我使用了makecell
允许在单元格中换行以及特定单元格的通用格式的包,使用以下命令\makecell
和\thead
:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{array, multirow, makecell}
\renewcommand\theadfont{\normalsize\bfseries}
\renewcommand\theadalign{lc}
\begin{document}
\begin{table}[h]
\centering\setcellgapes[t]{3pt}\makegapedcells
\begin{tabular}{|l|l|l|}
\hline
\thead{Type} & \thead{Model} & \thead{Example} \\ \hline
\multirow{2}{*}{A} & Belongs to A & Example 1 \\ \cline{2-3}
& \raisebox{-1.5ex}[\height][0pt]{HERE IS PROBLEM} & \raisebox{-1.5ex}[\height][0pt]{PROBLEM} \\ \cline{1-1}
\multirow{6}{*}[-1ex]{B} & & \\\cline{2-3}
& \makecell[t]{Belongs to B \\ - \textit{Example1}} & Examples \\ \cline{2-3}
& Belongs to B & Examples \\ \cline{2-3}
& Belongs to B & Examples \\ \cline{2-3}
& Belongs to B & Examples \\ \hline
\end{tabular}
\caption{Table problem}
\label{table123}
\end{table}
\end{document}