Skip to content

White lines between colored cells when using partial vline or hline #215

@jtl5770

Description

@jtl5770

Using texlive 2021, and tabularray 2022A.

My MWE

\documentclass[11pt]{article}
\usepackage{xcolor}
\usepackage{tabularray}

\definecolor{colA}{rgb}{0.8,0.9,0.8}
\definecolor{colB}{rgb}{0.5,0.7,0.5}
\definecolor{colC}{rgb}{0.95,0.85,0.6}
\definecolor{colD}{rgb}{0.9,0.5,0.5}

\begin{document}
\begin{tblr}{
    column{1} = {colA}, column{2} = {colB}, column{3} = {colC},
    cell{1}{1,3} = {colD}, cell{2}{3} = {colD}, cell{3}{2} = {colD},
    hline{1} = {1,3}{solid}, hline{2} = {1}{solid}, hline{3,4} = {2}{solid}, hline{3} = {3}{solid},
    vline{1,2} = {1}{solid}, vline{4} = {1,2}{solid}, vline{2} = {3}{solid}, vline{3}, 
    %%%%%%%% Note the ugly white lines.
    %%%%%%%% I would like to NOT have to do the following to fix this (but instead it being "right" automatically):
    % hline{2} = {2}{colB, leftpos=0, rightpos=0}, hline{2} = {3}{colD, leftpos=0, rightpos=0}, hline{3} = {1}{colA},
    % vline{2} = {2}{colB},
  }
  Alpha & Beta & Gamma \\
  One   & Two  & Three \\
  Tic   & Tac  & Toe
\end{tblr}
\end{document}

This yields the following result.

tabularraytest

See the comments in the MWE what I do to fix this - basically it boils down to having to insert rules colored like the background of the cells and inserting leftpos/rightpos=0 in strategic places. So it is possible, but it seems incredibly awkward having to do this in the first place. Ideally this would be handled in a way that these white lines are not created in the first place.

How could this be done? I have no idea how to do it in a current model where the vline/hline takes up space on its own next to the cells. But - could we implement vlines/hlines (maybe with their own new name and semantic) that actually don't take up space, but are rather printed on top? Half of the width of the rule would then be added to the cell right (or top in the case of a hline) and half of it to the cell left (or bottom), so the visible part of the cell would still be exactly the same as it would be without the rule in place. This would ensure that the cells are always directly stacked next to each other and the background wouldn't have any discontinuities.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions