tikz.dev / nicematrix Manual

The nicematrix package

7 The command \RowStyle

The command \RowStyle takes in as argument some formatting instructions that will be applied to each cell on the rest of the current row.

That command also takes in as optional argument (between square brackets) a list of key=value pairs.

  • The key nb-rows sets the number of rows to which the specifications of the current command will apply (with the special value *, it will apply to all the following rows).

  • The keys cell-space-top-limit\(^+\), cell-space-bottom-limit\(^+\) and cell-space-limits\(^+\) are available with the same meaning that the corresponding global keys (cf. 2).

  • The key fill (alias: rowcolor) sets the color of the background and opacity1 sets its opacity.

    These commands have a normal syntax but also an “additive” syntax. That means that it’s possible to write, for example, cell-space-limits = 2pt but also cell-space-limits += 1pt.

  • If the key rounded-corners is used, that background will have rounded corners.

  • The key color sets the color of the text.2

  • The key bold enforces bold characters for the cells of the row, both in math and text mode.

Compiled output

\begin{NiceTabular}{cccc}
\hline
\RowStyle[cell-space-limits=3pt]{\rotate}
first & second & third & fourth \\
\RowStyle[nb-rows=2,fill=blue!50,color=white]{\sffamily}
1 & 2 & 3 & 4 \\
I & II & III & IV
\end{NiceTabular}

The command \rotate is described in the section 14.6.

1 Caution: that feature creates instructions of transparency in the pdf and some readers of pdf don’t support such instructions. The opacity is applied by using \pgfsetfillopacity.

2 The key color uses the command \color but also inserts an instruction \leavevmode before. This instruction prevents an extra vertical space in the cells which belong to columns of type p, b, m and X (which start in vertical mode of LaTeX). For the columns V (of varwidth), that’s not enough, except when LuaLaTeX is used with the package luacolor (see question 460489 on TeX StackExchange).