我尝试将前两列、、和垂直居中,Learning Object
但是Data Properties
没有Object Properties
效果。
\begin{tabularx}{\textwidth}{m{2.5cm}|m{2cm}|p{3cm}|p{5cm}}
\caption{Classes and Properties of EOMPP} \\
\toprule
\textbf{Class} & \textbf{Feature} & \textbf{Property} & \textbf{Description} \\
\midrule
\centering \textit{\textbf{Learning Object}} \multirow{2}{*} & \centering Data Properties \multirow{6}{*} & bla bla bla & foo bar foo bar foo bar\\
& & bla bla bla & foo bar foo bar foo bar foo bar foo bar \\
& & bla bla blae & foo bar foo bar foo bar foo bar foo bar \\
\cmidrule{2-4}
& \centering Object Properties \multirow{6}* & bla bla bla & foo bar foo bar foo bar foo bar foo bar \\
& & bla bla bla & foo bar foo bar foo bar foo bar foo bar \\
& & bla bla bla & foo bar foo bar foo bar foo bar foo bar \\
& & bla bla bla & foo bar foo bar foo bar foo bar foo bar \\
& & bla bla bla & foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar \\
& & bla bla bla & foo bar foo bar foo bar foo bar foo bar \\
\bottomrule
\end{tabularx}
答案1
第一个参数\multirow
(行数)适用于单行单元格。在其他情况下,您必须计算这些行中的总行数,甚至可以使用带有小数部分的数字来微调 \multirow 内容的位置:
\documentclass{article}
\usepackage{geometry}
\usepackage{multirow, booktabs}
\usepackage{tabularx}
\begin{document}
\begin{table}[htbp]
\begin{tabularx}{\textwidth}{p{3cm}p{3cm}p{3cm}X}
%\caption{Classes and Properties of EOMPP}
\toprule
\textbf{Class}
& \textbf{Feature}
& \textbf{Property}
& \textbf{Description} \\
\midrule
\multirow{18}{*}{\textit{\textbf{Learning Object}}}
& \multirow{5}{*} {\centering Data Properties}
& bla bla bla
& foo bar foo bar foo bar\\
& & bla bla bla & foo bar foo bar foo bar foo bar foo bar \\
& & bla bla blae & foo bar foo bar foo bar foo bar foo bar \\
\cmidrule{2-4}
& \multirow{13}{*} {\centering Object Properties} & bla bla bla & foo bar foo bar foo bar foo bar foo bar \\
& & bla bla bla & foo bar foo bar foo bar foo bar foo bar \\
& & bla bla bla & foo bar foo bar foo bar foo bar foo bar \\
& & bla bla bla & foo bar foo bar foo bar foo bar foo bar \\
& & bla bla bla & foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar \\
& & bla bla bla & foo bar foo bar foo bar foo bar foo bar \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
答案2
使用tabularray
。与其他表格包相比,多行单元格中的 tabularray 考虑的是相邻行的数量,而不是这些行中的文本行数,而不是跨越的文本行数。
\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\begin{document}
\begin{table}[htbp]
\begin{tblr}{hline{1,Z} = 1pt, hline{2}=0.6pt,
colspec = {@{} *{2}{X[1,c]} X[1,l] X[2.5,l] @{}},
column{1} = {font=\bfseries},
row{1} = {font=\bfseries},
}
Class & Feature
& Property
& Description \\
\SetCell[r=9]{l} \itshape Learning Object
& \SetCell[r=3]{c} Data Properties
& bla bla bla
& foo bar foo bar foo bar \\
& & bla bla bla
& foo bar foo bar foo bar foo bar foo bar \\
& & bla bla blae
& foo bar foo bar foo bar foo bar foo bar \\
\midrule
& \SetCell[r=6]{c} Object Properties
& bla bla bla
& foo bar foo bar foo bar foo bar foo bar \\
& & bla bla bla
& foo bar foo bar foo bar foo bar foo bar \\
& & bla bla bla
& foo bar foo bar foo bar foo bar foo bar \\
& & bla bla bla
& foo bar foo bar foo bar foo bar foo bar \\
& & bla bla bla
& foo bar foo bar foo bar foo bar foo bar \\
& & bla bla bla
& foo bar foo bar foo bar foo bar foo bar \\
\end{tblr}
\end{table}
\end{document}
答案3
\documentclass{article}
\usepackage{geometry}
\usepackage{multirow, booktabs}
\usepackage{tabularx}
\begin{document}
\begin{table}[htbp]
\begin{tabularx}{\textwidth}{p{3cm}p{3cm}p{3cm}X}
% \caption{Classes and Properties of EOMPP}
\toprule
\textbf{Class}
& \textbf{Feature}
& \textbf{Property}
& \textbf{Description} \\
\midrule
\multirow{18}{*}{\textit{\textbf{Learning Object}}}
& \multirow{5}{*} {Data Properties}
& bla bla bla
& foo bar foo bar foo bar\\
& & bla bla bla & foo bar foo bar foo bar foo bar foo bar \\
& & bla bla blae & foo bar foo bar foo bar foo bar foo bar \\
\cmidrule{2-4}
& \centering Object Properties \multirow{6}* & bla bla bla & foo bar foo bar foo bar foo bar foo bar \\
& & bla bla bla & foo bar foo bar foo bar foo bar foo bar \\
& & bla bla bla & foo bar foo bar foo bar foo bar foo bar \\
& & bla bla bla & foo bar foo bar foo bar foo bar foo bar \\
& & bla bla bla & foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar \\
& & bla bla bla & foo bar foo bar foo bar foo bar foo bar \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}