1

I have made the following table:

\usepackage{tabu}
\usepackage{xcolor,colortbl}

\begin{center}
{\tabulinesep=1.2mm 
    \begin{tabu} to 0.9\linewidth { |[2pt] *{3}{X[1 c]|}[2pt] }
        \tabucline[2pt]{-}
        \cellcolor{green!20}\textbf{Parameter} & \cellcolor{green!20}\textbf{Value} & \cellcolor{green!20}\textbf{Units} \\ \tabucline[1.5pt]{-}
        \multicolumn{3}{ |[2pt]c|[2pt] }{\cellcolor{green!20}Nose Parameters} \\ \tabucline[2pt]{-}
        $\alpha$ & 10 & Deg \\ \tabucline[2pt]{-}
        \multicolumn{3}{ |[2pt]c|[2pt] }{\cellcolor{green!20}Body Parameters} \\ \tabucline[2pt]{-}
        $d_{B}$ & 122 & mm \\ \hline
        $L_{B}$ & 2670 & mm \\ \tabucline[2pt]{-}
    \end{tabu}}
\end{center}

enter image description here

However the title cells arent get affected by \cellcolor.

I have tried to update the package as I read it might effect but it did not work.

Thank you.

Ben
  • 413
  • 2
    see https://tex.stackexchange.com/questions/494689/color-rows-on-table-tabu-package if it can help you. Recent fix available on GitHub seems not yet be released on CTAN. – Zarko Jun 19 '19 at 19:07

1 Answers1

2

The new LaTeX3 package tabularray is an alternative to the outdated tabu package:

\documentclass{article}

\usepackage{tabularray} \usepackage{xcolor}

\begin{document}

\begin{center} \begin{tblr}{ width = 0.9\linewidth, colspec = {|[2pt]X[1,c]|X[1,c]|X[1,c]|[2pt]}, row{1} = {green9, font=\bfseries}, } \hline[2pt] Parameter & Value & Units \ \hline[1.5pt] \SetCell[c=3]{c,green9} Nose Parameters & & \ \hline[2pt] $\alpha$ & 10 & Deg \ \hline[2pt] \SetCell[c=3]{c,green9} Body Parameters & & \ \hline[2pt] $d_{B}$ & 122 & mm \ \hline $L_{B}$ & 2670 & mm \ \hline[2pt] \end{tblr} \end{center}

\end{document}

enter image description here

L.J.R.
  • 10,932