lvjr / tabularray

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

Background colour and vlines are non-existent for negative rowsep #428

Open Aljumaily opened 11 months ago

Aljumaily commented 11 months ago

I understand that having a negative rowsep makes the row height smaller than anticipated and the output is expected. I want a way to show the background colour and the vlines for rows that are tightest in row height. Having rowsep=0pt is not the tightest.

image
\documentclass{article}
\usepackage{xcolor}
\usepackage{tabularray}
\begin{document}

\begin{tblr}{rowsep=0pt, vlines, hlines, row{odd}={azure9}, row{even}={gray8}}
    Alpha   & Beta  & Gamma  & Delta \\
    Epsilon & Zeta  & Eta    & Theta \\
    Iota    & Kappa & Lambda & Mu    \\
\end{tblr}
\par\vspace{2em}
\begin{tblr}{rowsep=-10pt, vlines, hlines, row{odd}={azure9}, row{even}={gray8}}
    Alpha   & Beta  & Gamma  & Delta \\
    Epsilon & Zeta  & Eta    & Theta \\
    Iota    & Kappa & Lambda & Mu    \\
\end{tblr}
\end{document}
muzimuzhi commented 11 months ago

I want a way to show the background colour and the vlines for rows that are tightest in row height.

rowsep=0pt, stretch=0

\documentclass{article}
\usepackage{xcolor}
\usepackage{tabularray}
\begin{document}

\begin{tblr}{rowsep=0pt, vlines, hlines, row{odd}={azure9}, row{even}={gray8}}
    Alpha   & Beta  & Gamma  & Delta \\
    Epsilon & Zeta  & Eta    & Theta \\
    Iota    & Kappa & Lambda & Mu    \\
\end{tblr}
\par\vspace{2em}
\begin{tblr}{rowsep=0pt, stretch=0, vlines, hlines, row{odd}={azure9}, row{even}={gray8}}
    Alpha   & Beta  & Gamma  & Delta \\
    Epsilon & Zeta  & Eta    & Theta \\
    Iota    & Kappa & Lambda & Mu    \\
\end{tblr}
\end{document}

image

muzimuzhi commented 11 months ago

About negative rowsep, I'm guessing it's caused by a negative depth and/or lower part of a row obtained by some internal calculation step.

\documentclass{article}
\usepackage{xcolor}
\usepackage{tabularray}

\begin{document}
\def\testRowsep#1{%
  \leavevmode\llap{\small\texttt{\detokenize{#1}}}
  \begin{tblr}{vlines, hlines, row{odd}={azure9}, row{even}={gray8}, baseline=T, #1}
    Alpha   & Beta  & Gamma  & Delta \\
    Epsilon & Zeta  & Eta    & Theta \\
    Iota    & Kappa & Lambda & Mu    \\
  \end{tblr}
  \par\medskip
}

\testRowsep{rowsep= 0pt}
\testRowsep{rowsep=-3pt}
\testRowsep{rowsep=-5pt}
\testRowsep{rowsep=-10pt}
\end{document}

image

Aljumaily commented 10 months ago

Thank you! Resolved my issue.

muzimuzhi commented 10 months ago

The interaction of negative rowsep and background color seems problematic, so let's keep this issue open until this is resolved.