lvjr / tabularray

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

Found possible defect for `cell{2-X}{3} = {}, ...` #440

Closed assarbad closed 8 months ago

assarbad commented 8 months ago

Hi,

I am using your class to create a table where I combine some of the rows from the first column, but not the others. So I "group" x rows together, but only for the first column.

When I then use something like cell{2-X}{3} = {font=\ttfamily}, in \SetTblrInner, I get no error. But the result is odd.

If there is no page break (I use longtblr) in between, it appears as if the X in {2-X} refers only to the top row from the last "group" of rows (where the first column combines x rows).

If there is a page break I see no particular pattern of how the font= specification gets applied.

Please note that for all items within a group, except the last one, I use \\* to force them to page-break together.

I may have misunderstood the examples from the documentation, too. If you agree this seems odd, I'll try to condense what I see into an MWE.

muzimuzhi commented 8 months ago

If there is a page break I see no particular pattern of how the font= specification gets applied.

[...]

I may have misunderstood the examples from the documentation, too.

Currently in longtblr tables row number will not get reset after a page break. Thus in example below, the first row in the second page is numbered 4, not 1.

\documentclass{article}
\usepackage[papersize={8cm, 5cm}, margin=1cm, footskip=10pt]{geometry}
\usepackage{tabularray}

\begin{document}
\begin{longtblr}{
  hlines, vlines,
  cells={preto={(\therownum,\thecolnum)}},
  cell{1,4,7}{1}={r=3}{},
  cell{2-X}{3}={font=tt\ttfamily}
}
   & & & \\* \\* \\
         \\* \\* \\
         \\* \\* \\
\end{longtblr}
\end{document}

image

assarbad commented 8 months ago

@muzimuzhi thanks. Page 3 nicely shows the issue I meant. You can see that 8,3 and 9,3 do not use \ttfamily. Thanks for the clarification about how the counter continues on the next page.

But I would have expected the rows 8 and 9 also to get the treatment from cell{2-X}{3}={font=tt\ttfamily}. But it only goes up to row 7 in your example. And that's what I saw, too.

muzimuzhi commented 8 months ago

But I would have expected the rows 8 and 9 also to get the treatment from cell{2-X}{3}={font=tt\ttfamily}.

X denotes the third last children. To affect also the remaining two cells, you can use cell{2-Z}{3}.

The related doc can be found in package manual (2023A 2023-03-01), sec. 2.2.1 "Hlines and Vlines in New Interfaces":

https://github.com/lvjr/tabularray/blob/690e67ee175ff7601d0144c84f9a7e9c67573e0b/manual/manual-2.tex#L167-L168

assarbad commented 8 months ago

Oh I see. Thanks so much. These single letter items are hard to search and this is exactly what I was looking for.