- For coloring rows you need first to load
colortbl
or better xcolor
package with option table
.
- It is not clear, which rows you like to have colored
- Your code for table is frankly said strange. I try to correct it but I'm lost in it (how you use
multirow
), so temporary result is the following:
\documentclass[12pt,a4paper,hidelinks]{report}
\usepackage[czech]{babel}
\usepackage[output-decimal-marker={,}]{siunitx}
\usepackage[table]{xcolor}
\usepackage{booktabs,
makecell,
multirow}
\usepackage{empheq}
\usepackage[most]{tcolorbox}
\begin{document}
\begin{table}[!h]
\small
\label{porovnani} % this not work without use of "caption"
\renewcommand{\arraystretch}{1.2}
\setlength\tabcolsep{7pt}
\begin{tabular*}{\linewidth}{ccc *{3}{S[table-format=2.2]} }
\Xhline{1.2pt}
\rowcolor{red}
& {A} & {B} & {C} & {B} & {E} \\
\Xhline{1.2pt}
B & \multirow{2}{*}{A}
& \multirow{3}{*}{B}
& 21,95 & 7,59 & 3,19 \\
1 & & & 4,45 & 5,85 & 11,87 \\
1 & 2 & & 4,45 & 5,85 & 11,87 \\
\Xhline{1.2pt}
\end{tabular*}
\end{table}
\end{document}
- I would not use
tabular*
but simple tabular
and center table in float environment:
\documentclass[12pt,a4paper,hidelinks]{report}
\usepackage[czech]{babel}
\usepackage[output-decimal-marker={,}]{siunitx}
\usepackage[table]{xcolor}
\usepackage{booktabs,
makecell,
multirow}
\usepackage{empheq}
\usepackage[most]{tcolorbox}
\begin{document}
\begin{table}[!h]
\centering
\label{porovnani} % this not work without use of "caption"
\renewcommand{\arraystretch}{1.2}
\setlength\tabcolsep{7pt}
\begin{tabular}{ccc *{3}{S[table-format=2.2]} }
\Xhline{1.2pt}
\rowcolor{red}
& {A} & {B} & {C} & {B} & {E} \\
\Xhline{1.2pt}
B & \multirow{2}{*}{A}
& \multirow{3}{*}{B}
& 21,95 & 7,59 & 3,19 \\
1 & & & 4,45 & 5,85 & 11,87 \\
1 & 2 & & 4,45 & 5,85 & 11,87 \\
\Xhline{1.2pt}
\end{tabular}
\end{table}
\end{document}
\rowfont
command is only available inside of atabu
environment. If you want a solution that does not rely on thetabu
package, you might want to have a look at this answer: tex.stackexchange.com/a/26364/134144\multirow{4}{*}{a2}
in table it is balck then. I would like to skip the multirow cell but than have a red rest of row.