lvjr / tabularray

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

Row selector Z does not correctly select last line for option hline in longtblr #318

Closed jasperhabicht closed 1 year ago

jasperhabicht commented 1 year ago

When used in a longtblr environment and together with the option hline, the row selector Z does obviously not only select the last horizontal line on the last page (that is, the very last horizontal line of the table), but also the last horizontal lines on the previous pages.

Consider the following minimal working example and its output:

\documentclass{article}
\usepackage{tabularray}

\begin{document}
    \begin{longtblr}{
            colspec={XX},
            vlines,
            hline{1-Y}={-}{solid},
            hline{Z}={1}{solid},
        }
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
    \end{longtblr}
\end{document}

image

This is inconsistent with how the row selector Z works with other options, such as cell or vline, where it only points to the very last line of the table. Also, the row selectors X and Y affect only the second to last and third to last row of the table (that is, only on the last page when then table spans multiple pages) respectively.

The same effect occurs if \SetHline is used as shown in the following example (which yields the same output as above):

\documentclass{article}
\usepackage{tabularray}

\begin{document}
    \begin{longtblr}{
            colspec={XX},
            vlines,
            hlines,
        }
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        1 & 1 \\
        \SetHline[1]{2}{0pt}
    \end{longtblr}
\end{document}

I would expect that both code examples above would yield an output where only the last horizontal line of the table (that is, the last horizontal line on the last page) is shorter than the others, but not the last horizontal lines on the other pages. Especially considering the semantics of the second example, I suspect the current behaviour to be a bug.

lvjr commented 1 year ago

We may discuss this in issue #130.