Closed latexstudio closed 1 year ago
With colspec={@{}cQ[c,3cm]@{}}
, you set leftsep=0pt
for the first column and set rightsep=0pt
for the second column.
But by default rightsep=6pt
for the first column and leftsep=6pt
for the second column. Therefore the cells look not centered.
PS: please always use English in reporting potential bugs of this package.
\documentclass[a4paper]{article}
\usepackage{array,amssymb}
\usepackage{tabularray}
\SetTblrInner[tblr]{rowsep=0pt}
\setlength\parindent{0pt}
\newcommand\mybox{$\blacksquare$}
\begin{document}
\section{tabularray}
\begin{tblr}{vlines,colspec={@{}cQ[c,3cm]@{}}}
\hline
\mybox\mybox & \mybox\mybox\mybox\mybox\mybox\mybox\mybox \\
\hline
\mybox\mybox\mybox\mybox & \mybox\mybox\mybox\mybox\mybox \\
\hline
\end{tblr}
\medskip
\begin{tblr}{|@{}c|Q[c,3cm]@{}|}
\hline
\mybox\mybox & \mybox\mybox\mybox\mybox\mybox\mybox\mybox \\
\hline
\mybox\mybox\mybox\mybox & \mybox\mybox\mybox\mybox\mybox \\
\hline
\end{tblr}
\section{tabular}
\begin{tabular}{|@{}c|>{\centering\arraybackslash}b{3cm}@{}|}
\hline
\mybox\mybox & \mybox\mybox\mybox\mybox\mybox\mybox\mybox \\
\hline
\mybox\mybox\mybox\mybox & \mybox\mybox\mybox\mybox\mybox \\
\hline
\end{tabular}
\end{document}
如下是代码:
效果来看,表格里的内容明显偏右。 如果该用 tabularx 等 @{} 不影响单元格的居中显示。