使用 创建表格时tabularray
,由于某种原因,表格不会由连续的线条组成,但每列之间会有 2-3 个像素的间隙。这个问题可以修复吗?它并不明显,但使用经典时table
根本没有间隙。
\documentclass{article}
\usepackage{graphicx}
\usepackage{xcolor,colortbl}
\usepackage{multirow}
\usepackage{hhline}
\definecolor{rowcol}{rgb}{0.7, 0.7, 0.7}
\usepackage{tabularray}
\title{TEST2}
\author{Anon}
\date{May 2023}
\begin{document}
\maketitle
\section{Introduction}
\begin{table}
\centering
\begin{tblr}{
colspec={Q[c,m] Q[c,m] Q[c,m] Q[c,m] Q[c,m]},
cells={font=\large},
cell{1}{1} = {r=2}{c},
cell{1}{1} = {c=1}{c},
cell{1}{2} = {c=4}{c},
hline{1-Z}={1}{-}{leftpos=0, rightpos=0},
hline{3}={2}{-}{leftpos=0, rightpos=0},
vlines,
vline{2}={2}{-}{},
row{odd[3]}={bg=rowcol}
}
& Description \\
& 1 & 2 & 3 & 4 \\
A & 10 & 20 & 30 & 40 \\
B & 15 & 25 & 35 & 25 \\
C & 12 & 22 & 32 & 80 \\
\end{tblr}
\caption{Table caption}
\label{tabularraytablelabel}
\end{table}
\end{document}
答案1
虽然我不确定这是否是您想要的,但我发布了这个解决方案,希望能对您有所帮助:
\documentclass{article}
\usepackage{graphicx}
\usepackage{xcolor,colortbl}
\usepackage{multirow}
\usepackage{hhline}
\definecolor{rowcol}{rgb}{0.7, 0.7, 0.7}
\usepackage{tabularray}
\title{TEST2}
\author{Anon}
\date{May 2023}
\begin{document}
\maketitle
\section{Introduction}
\begin{table}
\centering
\begin{tblr}{
colspec={Q[c,m]Q[c,m]Q[c,m]Q[c,m]Q[c,m]},
cells={font=\large},
cell{1}{1} = {r=2}{c},
cell{1}{1} = {c=1}{c},
cell{1}{2} = {c=4}{c},
hlines, %<-- added
hline{1-Z}={1}{1}{leftpos=1, rightpos=0.15},%<-- added
hline{1-Z}={1}{2}{leftpos=0.15, rightpos=1}, %<-- changed
hline{3}={2}{-}{solid}, %<-- added
hline{3}={2}{1}{leftpos=1, rightpos=0.15},%<-- changed
hline{3}={2}{2}{leftpos=0.15, rightpos=1}, %<-- added
vlines,
vline{2}={2}{-}{},
row{odd[3]}={bg=rowcol}
}
& Description \\
& 1 & 2 & 3 & 4 \\
A & 10 & 20 & 30 & 40 \\
B & 15 & 25 & 35 & 25 \\
C & 12 & 22 & 32 & 80 \\
\end{tblr}
\caption{Table caption}
\label{tabularraytablelabel}
\end{table}
\end{document}