Skip to content

fix #659#662

Merged
ponte-vecchio merged 5 commits into
dev-versionfrom
659
Jun 2, 2026
Merged

fix #659#662
ponte-vecchio merged 5 commits into
dev-versionfrom
659

Conversation

@ponte-vecchio
Copy link
Copy Markdown
Member

See #659 which this PR patches. Specifically, this addresses the following problem:

What seemed to be happening is that before span sizes are distributed, \__tblr_collect_column_widths_skips: populates \l__tblr_col_item_skip_size_prop using the @col-width of each column. For X columns where co > 0, this value is initially their unwrapped natural width, which can be massive. During \__tblr_set_column_widths_from_span_widths:, the routine evaluates the span distributions. Now, because the X columns are not covered by a span, the distribution logic leaves their massive natural width untouched in \l__tblr_col_item_skip_size_prop. It then populates \l__tblr_column_min_width_prop for the X columns using these untouched values. Consequently, when \__tblr_adjust_extendable_column_width: runs to assign the final target widths to the X columns, it checks against \l__tblr_column_min_width_prop. Since the recorded min width is the huge unwrapped natural width it locks the X column to be that size causing table overflow as exhibited by #659.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes issue #659, where X columns were assigned an inflated minimum width whenever a horizontally merged (\SetCell[c=...]) cell appeared in the same table, causing the table to overflow. The root cause is that \__tblr_set_column_widths_from_span_widths: recorded each column's current @col-width (the unwrapped natural width for X columns) as its minimum, which was later used by \__tblr_adjust_extendable_column_width: and locked X columns to that huge size. The fix detects columns with a non-zero coefficient (X columns) and skips recording a minimum width for them while resetting their entry in \l__tblr_col_item_skip_size_prop to 0pt.

Changes:

  • In \__tblr_set_column_widths_from_span_widths:, branch on the column coefficient: for X-style columns, zero out the col-item skip size and don't populate \l__tblr_column_min_width_prop; otherwise behave as before.
  • Bump the release date in \ProvidesExplPackage to 2026-05-28.
  • Add a new regression test table-018 (tex, tlg, pdftex.tlg, md5) and a corresponding entry in testfiles/README.md; refresh cell-005.md5; add .DS_Store to .gitignore.

Reviewed changes

Copilot reviewed 7 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tabularray-dev.sty Skip min-width recording for X (coefficient > 0) columns and bump release date.
testfiles/table-018.tex New regression test reproducing the merged-cell + X-column scenario from #659.
testfiles/table-018.tlg, table-018.pdftex.tlg, table-018.md5 Expected log/checksum baselines for the new test.
testfiles/cell-005.md5 Updated checksum reflecting the column-width fix's effect on existing test.
testfiles/README.md Documents the new table-018 test entry.
.gitignore Adds .DS_Store to ignore list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tabularray-dev.sty Outdated
Comment thread testfiles/table-018.tex
Copy link
Copy Markdown
Member

@peaR-red peaR-red left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, seems alright, other than a few stuff Copilot pointed out (was the AI review necessary though?).

What I'm curious about is why cell-005 warranted changes in light of this fix. Compiling locally there doesn't seem to be any noticeable difference.

@mariuslp
Copy link
Copy Markdown

Great fix, thanks. A tiny detail that I am not sure whether it is a bug or a feature, but calling hspan=even seems to have an unexpected (but small) effect on the column size.

\documentclass{article}
\usepackage{tabularray-dev} 
\usepackage{xcolor}

\begin{document}
\begin{tblr}{
  colspec = {lllXX},
  hlines,
  vlines,
  hspan=even,
}
    1-1 & 1-2 & \SetCell[c=2]{c} merged & very very long text in the X column & sooooooooooooo very much long it will not stop and continue \\
    2-1 & 2-2 & 2-3 & 2-4 & 2-5 \\ 
\end{tblr}

\begin{tblr}{
  colspec = {lllXX},
  hlines,
  vlines,
  hspan=default,
}
    2-1 & 2-2 & 2-3 & 2-4 & 2-5 \\ 
    1-1 & 1-2 & \SetCell[c=2]{c} merged & very very long text in the X column & sooooooooooooo very much long it will not stop and continue \\
\end{tblr}

\end{document}
image

I would say that intuitively, a merged cell over an X cell is not extending and therefore the effects of hspan=even should be the same as hspan=minimal or hspan=default (which is no effect), but that might be up to debate.

@ponte-vecchio
Copy link
Copy Markdown
Member Author

@peaR-red

Hmm, seems alright, other than a few stuff Copilot pointed out (was the AI review necessary though?).

Big oopsie with fat fingers, ignore the clanker.

What I'm curious about is why cell-005 warranted changes in light of this fix. Compiling locally there doesn't seem to be any noticeable difference.

Visually indistinguishable, but the checksum test fails, so something must be different - in any case, I've had to change it for that reason alone.

Copy link
Copy Markdown
Member

@peaR-red peaR-red left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A minor addition to \__tblr_set_column_widths_from_span_widths:...

Comment thread tabularray-dev.sty
Co-authored-by: peaR <pearatlatex@gmail.com>
@ponte-vecchio ponte-vecchio merged commit 57663af into dev-version Jun 2, 2026
4 checks passed
@ponte-vecchio ponte-vecchio deleted the 659 branch June 2, 2026 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] [tabularray-dev] X column do not compute the width when there is a merged cell

4 participants