我正在使用这个在线工具https://www.latex-tables.com/#生成我的表格。这是它为下表生成的代码。如何减少每行之间的间距以及如何强制下面红色箭头所示的特定列具有较小的宽度?它们主要用作列块之间的分隔符。
\usepackage{tabularray}
\begin{table}
\centering
\resizebox{\linewidth}{!}{%
\begin{tblr}{
column{even} = {c},
column{3} = {c},
column{5} = {c},
column{7} = {c},
column{9} = {c},
column{11} = {c},
column{13} = {c},
column{15} = {c},
column{17} = {c},
column{19} = {c},
column{21} = {c},
cell{1}{2} = {c=8}{},
cell{1}{11} = {c=2}{},
cell{1}{14} = {c=8}{},
cell{2}{2} = {c=2}{},
cell{2}{5} = {c=2}{},
cell{2}{8} = {c=2}{},
cell{2}{11} = {c=2}{},
cell{2}{14} = {c=2}{},
cell{2}{17} = {c=2}{},
cell{2}{20} = {c=2}{},
hline{1,10} = {-}{0.08em},
hline{2} = {2-9,11-12,14-21}{},
hline{3} = {2-3,5-6,8-9,11-12,14-15,17-18,20-21}{},
hline{4,7-8} = {-}{},
}
& x & & & & & & & & & & & & x & & & & & & & \\
& x & & & x & & & x & & & x & & & x & & & x & & & x & \\
method & x & x & & x & x & & x & x & & x & x & & x & x & & x & x & & x & x \\
a & & & & & & & & & & & & & & & & & & & & \\
b & & & & & & & & & & & & & & & & & & & & \\
context & & & & & & & & & & & & & & & & & & & & \\
Ours & & & & & & & & & & & & & & & & & & & & \\
w/o clf & & & & & & & & & & & & & & & & & & & & \\
w/ GT clf & & & & & & & & & & & & & & & & & & & &
\end{tblr}
}
\end{table}
答案1
- 正如@Fran 在他的评论中提到的,删除所有空列。例如,对于多列单元格下面的规则,请使用
\cmidrule[lr=-0.4]{2-3}
- 第一行所需的设计并不完全清楚,所以我希望下面的 MWE 是正确的。
\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\begin{document}
\begin{table}
\begin{tblr}{colspec = {@{} l *{14}{X{c}} @{}},
cell{1}{2} = {c=6}{c},
cell{1}{10} = {c=6}{c},
cell{2}{even[2]} = {c=2}{},
}
\toprule
& x & & & & & & & & x & & & & \\
\cmidrule[lr=-0.4]{2-7}
\cmidrule[lr=-0.4]{10-15}
& x & & x & & x & & x & & x & & x & & x & \\
\cmidrule[lr=-0.4]{2-3}
\cmidrule[lr=-0.4]{4-5}
\cmidrule[lr=-0.4]{6-7}
\cmidrule[lr=-0.4]{8-9}
\cmidrule[lr=-0.4]{10-11}
\cmidrule[lr=-0.4]{12-13}
\cmidrule[lr=-0.4]{14-15}
method & x & x & x & x & x & x & x & x & x & x & x & x & x & x \\
\midrule
a & & & & & & & & & & & & & & \\
b & & & & & & & & & & & & & & \\
context & & & & & & & & & & & & & & \\
\midrule
Ours & & & & & & & & & & & & & & \\
\midrule
w/o clf & & & & & & & & & & & & & & \\
w/ GT clf & & & & & & & & & & & & & & \\
\bottomrule
\end{tblr}
\end{table}
\end{document}