\documentclass{article}
\usepackage{caption}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage[table]{xcolor}
\begin{document}
\begin{table*}
\begin{tabular}{p{3cm}ccp{2cm}p{7.5cm}}
\toprule[.5pt]
\rowcolor{black}
\multirow{2}{3cm}{\centering \textbf{Regions}} & \multicolumn{2}{c}{\textbf{Types of flower}} & \multirow{2}{2cm}{\centering \textbf{Weight}} & \multirow{2}{*}{\textbf{Remarks}} \\ \cline{2-3}
& Type I & Type I & \\ \midrule[1pt]
In I & DNE & DNE & abc & ddddd and ddddddddddddddd\\[.2ex]
\end{tabular}
\end{table*}
\end{document}
上面我给出了 MWE...这里使用了多行,但我无法为完整的第一行着色。
答案1
我建议使用该tabularray
包:
\documentclass{article}
\usepackage{xcolor}
\usepackage{tabularray}
\usepackage{geometry}
\begin{document}
\begin{table*}
\begin{tblr}{
colspec={XccXX[2]},
hline{2}={solid,white},
row{odd}={bg=cyan!20},
row{even}={bg=gray!30},
row{1-2}={font=\bfseries,halign=c,bg=black,fg=white}
}
\SetCell[r=2]{} Regions & \SetCell[c=2]{} Types of flower && \SetCell[r=2]{} Weight & \SetCell[r=2]{} Remarks \\
& Type I & Type I & \\
In I & DNE & DNE & abc & ddddd and ddddddddddddddd\\
In I & DNE & DNE & abc & ddddd and ddddddddddddddd\\
In I & DNE & DNE & abc & ddddd and ddddddddddddddd\\
\end{tblr}
\end{table*}
\end{document}
我可以建议一个看起来更专业一点的布局吗?
\documentclass{article}
\usepackage{xcolor}
\usepackage{tabularray}
\usepackage{geometry}
\begin{document}
\begin{table*}
\begin{tblr}{
colspec={XccXX[2]},
hline{1,Z}={solid,1pt},
hline{2-3}={solid},
row{1-2}={font=\bfseries,halign=c}
}
\SetCell[r=2]{} Regions & \SetCell[c=2]{} Types of flower && \SetCell[r=2]{} Weight & \SetCell[r=2]{} Remarks \\
& Type I & Type I & \\
In I & DNE & DNE & abc & ddddd and ddddddddddddddd\\
In I & DNE & DNE & abc & ddddd and ddddddddddddddd\\
In I & DNE & DNE & abc & ddddd and ddddddddddddddd\\
\end{tblr}
\end{table*}
\end{document}