You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The width of cells is not according to the X column ratio when using colsep. #427
I'm wanting to perfectly align cells of different tables with X columns, but that seems to be only possible when colsep is 0, see example below. Is this a real issue or am I doing something wrong? Most people won't notice with small colseps, but OCD people will notice.
\documentclass{article}
\usepackage{mwe}
\usepackage{tabularray, color, xparse, parskip}
\setlength{\parindent}{0pt}
\NewDocumentEnvironment{tableNoColsep}{m +b}{
\begin{tblr}{
colspec = {#1},
colsep = 0pt,
vlines = {black}}
#2
\end{tblr}%
}{}
\NewDocumentEnvironment{tableColsep}{m +b}{
\begin{tblr}{
colspec = {#1},
colsep = 1cm,
vlines = {black}}
#2
\end{tblr}%
}{}
\begin{document}
\section*{Cell horizontal spacing issues}
\subsection*{Good spacing}
Tables with three cells of equal spacing:
\begin{tableNoColsep}{XXX}
1 & 2 & 3
\end{tableNoColsep}
\begin{tableColsep}{XXX}
1 & 2 & 3
\end{tableColsep}
Tables with one cell of a third, and another of two thirds of the width:
\begin{tableNoColsep}{X[1]X[2]}
1 & 2+3
\end{tableNoColsep}
\begin{tableNoColsep}{X[2]X[1]}
1+2 & 3
\end{tableNoColsep}
\subsection*{Bad spacing}
The following tables should be divided one cell of a third, and another of two thirds of the width:
\begin{tableColsep}{X[1]X[2]}
1 & 2+3
\end{tableColsep}
\begin{tableColsep}{X[2]X[1]}
1+2 & 3
\end{tableColsep}
\subsection*{Expected behavior}
\begin{tableNoColsep}{X[1]X[2]}
\hspace{1cm}1\hspace{1cm} & \hspace{1cm}2+3\hspace{1cm}
\end{tableNoColsep}
\begin{tableNoColsep}{X[2]X[1]}
\hspace{1cm}1+2\hspace{1cm} & \hspace{1cm}3\hspace{1cm}
\end{tableNoColsep}
\end{document}
Is this a real issue or am I doing something wrong?
I'm afraid that's a "real issue". leftsep, rightsep (colsep set them both) and vertical rule width of an X column are extracted from the total target width of all X columns, after that the width of X[1] is calculated by dividing the target width by sum of coefficients.
Activity
muzimuzhi commentedon Aug 4, 2023
I'm afraid that's a "real issue".
leftsep,rightsep(colsepset them both) and vertical rule width of an X column are extracted from the total target width of all X columns, after that the width ofX[1]is calculated by dividing the target width by sum of coefficients.https://github.com/lvjr/tabularray/blob/690e67ee175ff7601d0144c84f9a7e9c67573e0b/tabularray.sty#L4074-L4081
https://github.com/lvjr/tabularray/blob/690e67ee175ff7601d0144c84f9a7e9c67573e0b/tabularray.sty#L4124-L4130
According to the doc for
tabupackage, sec. 1.2 "Xcolumn widths computation",tabudoes the calculation in the same order.lvjr commentedon Sep 7, 2025
This is a duplicate of issue #365 (see this comment for the planned
hspacing=fixedoption).