tabularray:在彩色行周围添加空格

tabularray:在彩色行周围添加空格

对于以下内容,我需要在每对相邻行之间以及一行与其相邻规则之间稳健地填充高度控制的白色垂直空间。

我需要在两种情况下这样做:

1-包括标题行在内的所有行都应有填充的空白。

2-仅非标题行用空格填充。

\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

案例一 所有行(包括标题行)均有1.0pt填充的白色空间。{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}

案例二仅非标题行用1.0pt 空格填充。

中央对中央

    %% 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}

用过的 tabularray.sty 2021-07-01 v2021L

相关内容