我的 Latex 表格有问题,有人能帮帮我吗?

我的 Latex 表格有问题,有人能帮帮我吗?

我的 Latex 表格有问题,左侧第一条竖线太长。另外,我该如何让该功能位于列的中间?

\documentclass{article}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{multicol}
\begin{document}

\begin{table}[!ht]
\centering
\caption{Concept}
\small
\begin{tabular}{|m{3cm}<{\centering}|m{3cm}<{\centering}|m{8cm}<{\centering}|}
\hline
\textbf{Models}& \textbf{Symbol} & \textbf{Description}  
\\
\hline 

\multirow{2}{*}{Capability} & CC & Combined capabilities are upper-level capabilities, which can be divided by functional decomposition into simple, lower-level capabilities \\ \cline{2-3}
& SC & Simple Capability is a single capability that the resources have  
\\ 
\hline
\label{table:semantic models of OCCR model}
\end{tabular}
\end{table}

\end{document}

在此处输入图片描述

答案1

  • 将 \label{table:OCCR model 的语义模型} 移出最后一行(如@DavidCarlisle 所建议的)。
  • 我会使用tabularx并规定其表格宽度等于\textwidth
  • 在使用时multrow考虑行数,您必须实际考虑跨越行中的文本行数(5 而不是 2):
\documentclass{article}
\usepackage{tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\usepackage{multirow}

\begin{document}

\begin{table}[!ht]
\centering
\caption{Concept}
\label{table:semantic models of OCCR model}
\small
\begin{tabularx}{\textwidth}{|>{\centering\arraybackslash}m{15mm}
                             |>{\centering\arraybackslash}m{15mm}
                             |C|}
    \hline
\textbf{Models} & \textbf{Symbol} & \textbf{Description}    \\
    \hline
\multirow{5}{=}{Capability} 
                & CC & Combined capabilities are upper-level capabilities, which can be divided by functional decomposition into simple, lower-level capabilities \\ 
    \cline{2-3}
                & SC & Simple Capability is a single capability that the resources have\\
    \hline
\end{tabularx}
\end{table}

\end{document}

在此处输入图片描述

但是您可以考虑使用tabularray包。使用它,表格代码更短,在多行单元格中考虑跨行数(与其他表格包相反),以便更好地实现单元格内容的垂直间距:

\documentclass{article}
\usepackage{tabularray}

\begin{document}

\begin{table}[!ht]
\centering
\caption{Concept}
\label{table:semantic models of OCCR model}
\small
\begin{tblr}{hlines, vlines,
             colspec={X[l] X[c] X[4,c,m]},
             row{1}={font=\bfseries}
            }

Models  & Symbol    & Description       \\
\SetCell[r=2]{l}    Capability 
        & CC & Combined capabilities are upper-level capabilities, which can be divided by functional decomposition into simple, lower-level capabilities \\
        & SC & Simple Capability is a single capability that the resources have\\
\end{tblr}
\end{table}

\end{document}

在此处输入图片描述

相关内容