tabularray – Troubleshooting Lost Lines in Colored Tables with Tabularray

tabularray

I downloaded today the latest version of tabularray.sty from github, but unfortunately still see issue with lines in colored tables, or at least with my specific file and specific set of packages. I show here all the preamble I use:

\documentclass[12pt, a4paper]{article}

\usepackage{mathtools}

\usepackage{unicode-math}
\setmainfont{Times New Roman}
\setmathfont{STIX Two Math}
\usepackage{microtype}
\usepackage[english]{babel}
\usepackage{tikz}
\usetikzlibrary{positioning, arrows.meta}
\usepackage[left=3cm, right=2cm, top=3cm, bottom=2cm, headheight=2cm, headsep=0.5cm]{geometry}
\usepackage{graphicx}
\usepackage{tabularray}
\usepackage{lastpage}

\usepackage{siunitx}
\sisetup{inter-unit-product = \ensuremath{{}\cdot{}}}
\sisetup{mode=text, reset-text-series=false}

\usepackage{xcolor}
\colorlet{titleblue}{blue!70!black}

\usepackage[pdfa]{hyperref}
\usepackage{hyperxmp}
\usepackage{embedfile}
\title{Title}
\author{Author}

\hypersetup{%
    pdflang=en,
    pdfapart=1,
    pdfaconformance=B,
    hidelinks,
    pdfstartview={XYZ null null 1.00}
}

\begin{document}

\begin{longtblr}{
        colspec = {lXX}, width = \textwidth,
        rowhead = 1,
        hlines, vlines,
        row{2} = {bg=titleblue!15},
        cell{2}{2} = {c=2}{l},
        cell{3}{2} = {c=2}{l}
        }
    Head & Head & Head \\
    1 & Combined text &  \\
    1.1 & Sub text &  \\
    1.1.1 & Text & Normal row \\
\end{longtblr}

\end{document}

I specifically set initial view of PDF to 100%, here I see no horizontal line between head row and colored row (2nd hline). It become visible at 150% view and then goes away at 200% etc. Can this be fixed? Does it depend on packages set?

Thank you.

Best Answer

Updated on 2021-09-09: This bug should has been fixed. You may download the latest package file from https://github.com/lvjr/tabularray/raw/main/tabularray.sty and test whether there are other problems.


In fact, this is a bug only for long tables. If you change longtblr to tblr, everything will be OK.

\documentclass[12pt,a4paper]{article}

\usepackage{tabularray}
\usepackage{xcolor}
\colorlet{titleblue}{blue!70!black}

\begin{document}

\begin{tblr}{
    colspec = {lXX}, width = \textwidth,
    rowhead = 1,
    hlines, vlines,
    row{2} = {bg=titleblue!15},
    cell{2,3}{2} = {c=2}{l},
}
    Head  & Head          & Head \\
    1     & Combined text &  \\
    1.1   & Sub text      &  \\
    1.1.1 & Text          & Normal row \\
\end{tblr}

\end{document}

enter image description here

Recently, in order to solve the problem of disappeared borders in some PDF readers, tabularray changed some code to draw table borders after table cells (see issue #76). The new method works very well for short tables, but unfortunely fails for some long tables.

A long table in a page consists of three parts: head, body and foot. In this example, the second hline is in the head, while the second row is in the body. Therefore the hline may be covered by the row in some cases in PDF readers.

To solve this problem, I need to modify the code of long table typesetting, drawing table body before table head.

But it is too late for version 2021N. Therefore I will fix this bug after 2021N and update this answer afterwards.

Related Question