lvjr / tabularray

Typeset tabulars and arrays with LaTeX3
https://ctan.org/pkg/tabularray
247 stars 22 forks source link

Styles set for out-of-bound cell may be applied to wrong cell #418

Open muzimuzhi opened 11 months ago

muzimuzhi commented 11 months ago

In example below, style font=\Huge is set for cell (2,3) in a 3x2 tblr tabular. It should have no effect because (2,3) is out of bound. But now the style is applied to a wrong cell (3,1).

\documentclass{article}
\usepackage{tabularray}

\SetTblrInner{
  cells={preto={(\therownum, \thecolnum)}},
  hline{1,Z},
  vline{1,Z},
}

\begin{document}
\begin{tblr}{cell{2}{3}={font=\Huge}}
  & \\ \\ \\
\end{tblr}
\end{document}

image

My findings so far

Additional checks for overflow row or col numbers is needed, perhaps in \__tblr_data_item:nnnn and \__tblr_data_gput:nnnnn, where row and col numbers are available and not combined into a single index of some intarray.

Currently there's only an intarray-beyond-bound check in \__tblr_intarray_gset:Nnn. But if a cell is indeed out-of-bound but its index in intarray is not, corresponding style settings for this cell is not ignored.