1

I need to fix the following error after using \addlinespace

Misplaced \noalign. \addlinespace ->\noalign {\ifnum 0=`}\fi @ifnextchar [{@addspace }{@addsp... l.25 \end {tblr}

\documentclass{article}
\usepackage{xcolor}
\usepackage{tabularray, booktabs}
\UseTblrLibrary{booktabs}
\begin{document}
    \begin{tblr}{
            width = 0.5\linewidth, colspec = {XX}, rowhead = 1,
            row{odd} = {gray!10}, row{even} = {gray!30}, row{1} = {blue!5},
        }
        \toprule[1.5pt]
        One & Two  \\
        \midrule
        1  &   2  \\
        3  &   4  \\
        5  &   6  \\
        7  &   8  \\
        9  &  10  \\
        \addlinespace
        11  &  12  \\
        13  &  14  \\
        15  &  16  \\
        17  &  18  \\
        19  &  20  \\
        \bottomrule[1.5pt]
    \end{tblr}
\end{document}
Diaa
  • 9,599
  • 1
    You may use \SetRow{abovesep+=5pt} there. – L.J.R. Jul 18 '21 at 15:26
  • @L.J.R. How to make the separation have white color regardless the colors of the rows above and below? I need to do the same styling effect for the global key rowsep+. – Diaa Jul 18 '21 at 21:51
  • Then you may write \hline[white,5pt]. – L.J.R. Jul 18 '21 at 23:05
  • @L.J.R. I have off-topic question if you don't mind: I fail to control the vertical alignment of the rows contents using cells={b}, rows={b}, or columns={b} inside the table mandatory options. They have no effect at all; so, what should be done to have a control over the cells contents vertical alignment? – Diaa Jul 20 '21 at 02:12
  • Better to ask a new question with details. – L.J.R. Jul 20 '21 at 02:33
  • @L.J.R. I asked it here https://tex.stackexchange.com/q/605676/2288. Thanks in advance! – Diaa Jul 20 '21 at 03:09

1 Answers1

4

With version 2021N (2021-09-01) of tabularray package, you can use \addlinespace command with booktabs library.

Note that one half of the vertical space is added to the previous row and the other half is added to current row. This makes row colors look better.

\documentclass{article}

\usepackage{xcolor} \usepackage{tabularray} \UseTblrLibrary{booktabs}

\begin{document}

\begin{tblr}{ width = 0.5\linewidth, colspec = {XX}, rowhead = 1, row{odd} = {gray9!50}, row{even} = {gray9}, row{1} = {blue9}, } \toprule[1.5pt] One & Two \ \midrule 1 & 2 \ 3 & 4 \ 5 & 6 \ 7 & 8 \ 9 & 10 \ \addlinespace 11 & 12 \ 13 & 14 \ 15 & 16 \ 17 & 18 \ 19 & 20 \ \bottomrule[1.5pt] \end{tblr}

\end{document}

enter image description here

L.J.R.
  • 10,932