0

For the following, I need to robustly pad a height-controlled white vertical space between each pair of adjacent rows and between a row and its adjacent rule.

I need to do it in two cases:

1- All the rows including the header rows should have the padded white spaces.

2- Only the non-header rows are padded with the white spaces.

\documentclass{article}
\usepackage[paperheight=75mm]{geometry}
\usepackage{xcolor}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\begin{document}
    \begin{tblr}[
        long, caption = {The Caption},
        ]{
            width = 0.5\linewidth, colspec = {XX}, 
            row{odd} = {blue!15}, row{even} = {gray!15}, 
            rowhead = 1, row{1} = {red!20},
        }
        \toprule[1.5pt]
        One & Two  \\
        \midrule
        1  &   2  \\
        3  &   4  \\
        5  &   6  \\
        7  &   8  \\
        9  &  10  \\
        11  &  12  \\
        13  &  14  \\
        15  &  16  \\
        17  &  18  \\
        19  &  20  \\
        \bottomrule[1.5pt]
    \end{tblr}
\end{document}

1 Answer 1

2

Case I All the rows including the header rows have a 1.0pt padded white space. {hlines={white,1.0pt}

c1c

%% Case I
\documentclass{article}
\usepackage[paperheight=75mm]{geometry}
\usepackage{xcolor}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}

\begin{document}
    
    \begin{tblr}[long, caption = {The Caption II}]
        {
            hlines={white,1.0pt}, % added <<<<<<
            rulesep=0pt, % added <<<<<<
            width = 0.5\linewidth,
            colspec = {XX}, 
            row{odd} = {blue!15}, 
            row{even} = {gray!15},       
            rowhead = 1,
            row{1} = {red!20},
        }
        \toprule[1.5pt] 
        \hline[white,1.0pt]% added <<<<<<
        One & Two  \\
        \midrule
        \hline[white,1.0pt]% added <<<<<<
        1  &   2  \\
        3  &   4  \\
        5  &   6  \\
        7  &   8  \\
        9  &  10  \\
        11  &  12  \\
        13  &  14  \\
        15  &  16  \\
        17  &  18  \\
        19  &  20  \\
        \bottomrule[1.5pt]
    \end{tblr}
\end{document}

Case II Only the non-header rows are padded with a 1.0pt white space.

c2c

    %% Case II
\documentclass{article}
\usepackage[paperheight=75mm]{geometry}
\usepackage{xcolor}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}

\begin{document}
    
    \begin{tblr}[long, caption = {The Caption}]
        {
            hlines={white,1.0pt},
            rulesep=-1.0pt, % added <<<<<<
            width = 0.5\linewidth, 
            colspec = {XX}, 
            row{odd} = {blue!15},
            row{even} = {gray!15},       
            rowhead = 1, 
            row{1} = {red!20},
        }
        \toprule[1.5pt] 
        One & Two  \\
        \midrule[1.7pt]% changed <<<<<<
        \hline[white,1.0pt]% added <<<<<<
        1  &   2  \\
        3  &   4  \\
        5  &   6  \\
        7  &   8  \\
        9  &  10  \\
        11  &  12  \\
        13  &  14  \\
        15  &  16  \\
        17  &  18  \\
        19  &  20  \\
        \hline[white,2.0pt]% added <<<<<<
        \bottomrule[1.5pt]
    \end{tblr}
\end{document}

Used tabularray.sty 2021-07-01 v2021L

2
  • In case 1, how to add the same white space between the midrule and the first non-header row?
    – Diaa
    Commented Jul 19, 2021 at 19:57
  • 1
    @Diaa With \hline[white,1.0pt] I updated the answer Commented Jul 19, 2021 at 20:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .