我的代码是这样的
\documentclass{article}
\usepackage{tabularx}
\begin{document}
\begin{table}[!ht]
\centering
\caption{Main concept classes }
\small
\begin{tabular}
{m{3cm}<{\centering}m{2cm}<{\centering}m{7.5cm}<{\centering}}
\hline
\textbf{Class}& \textbf{Symbol} & \textbf{Description} \\
\hline Combined Capability & CC& Combined capabilities
\\ \hline Simple Capability& SC & Simple Capability \\ \hline
\end{tabular}
\label{label:1}
\end{table}
\end{document}
答案1
尝试使用此代码multirow
将两个单元格合并为一个多行单元格。
(放在\label
旁边\caption
)
\documentclass{article}
\usepackage{multirow}% added <<<<<<<<<<<<<
\begin{document}
\begin{table}[!ht]
\centering\sffamily
\caption{Main concept} \label{label:1}
\small
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{lll}
\hline
\textbf{Class} & \textbf{Symbol} & \textbf{Description} \\ \hline
\multirow{ 2}{*}{Capability} & CC & Combined Capability \\ \cline{2-3}
& SC & Simple Capability\\ \hline
\end{tabular}
\end{table}
\end{document}
选修的
添加后 \usepackage{booktabs}
您可以获得更好的规则。
\documentclass{article}
\usepackage{multirow}% added <<<<<<<<<<<<<
\usepackage{booktabs} % nicer rules
\begin{document}
\begin{table}[!ht]
\centering\sffamily
\caption{Main concept}\label{label:1}
\small
\renewcommand{\arraystretch}{1.3}% expand the cells
\begin{tabular}{lll}
\toprule
\textbf{Class} & \textbf{Symbol} & \textbf{Description} \\ \midrule
\multirow{ 2}{*}{Capability} & CC & Combined Capability \\ \cline{2-3}
& SC & Simple Capability\\
\bottomrule
\end{tabular}
\end{table}
\end{document}
答案2
使用包nicematrix
-Block{2-1}
表示由以下部分组成的多行命令{2rows-1column}
平均能量损失
\documentclass{article}
\usepackage{nicematrix}
\begin{document}
\begin{table}
\centering
\caption{Main concept}
\NiceMatrixOptions{cell-space-limits = 3pt}
\begin{NiceTabular}{ccc}
\Hline
Class &Symbol &Description \\ \Hline
\Block{2-1}{Capability} & CC &Combined Capability \\ \Hline
& SC & Simple Capability\\ \Hline
\end{NiceTabular}
\end{table}
\end{document}
第二个示例使用少量颜色来强调标题行 - 这样就无需水平线或\Hline
blue
使用语法将颜色添加到第一行
\CodeBefore
\rowcolor{blue!50}{1}
平均能量损失
\documentclass{article}
\usepackage{nicematrix}
\begin{document}
\begin{table}
\centering
\caption{Main concept}
\NiceMatrixOptions{cell-space-limits = 3pt}
\begin{NiceTabular}{ccc}
\CodeBefore
\rowcolor{blue!50}{1}
\Body
\RowStyle{\bfseries}
Class &Symbol &Description \\
\Block{2-1}{Capability} & CC &Combined Capability \\
& SC & Simple Capability\\ \Hline
\end{NiceTabular}
\end{table}
\end{document}
答案3
这是一个采用multirow
和booktabs
包的解决方案。
两点说明。首先, 的第一个参数\multirow
不需要是整数值。其次,这里可以使用基本c
列类型代替m{...}<{\centering}
。
\documentclass{article}
\usepackage{booktabs} % for well-spaced horizontal rules
\usepackage{multirow} % for "\multirow" macro
\begin{document}
\begin{table}
\centering
\caption{Main concept\strut}
\begin{tabular}{@{} ccc @{}}
\toprule
\textbf{Class} & \textbf{Symbol} & \textbf{Description} \\
\midrule
\multirow{2.3}{*}{Capability} & CC & Combined Capability \\
\cmidrule(l){2-3}
& SC & Simple Capability \\
\bottomrule
\end{tabular}
\end{table}
\end{document}