我按照以下方式创建了一个表格:
\documentclass{article}
\usepackage[table,xcdraw]{xcolor} %Tables
\usepackage{array,multirow}
\usepackage{booktabs}
\begin{document}
\begin{table}\centering
\begin{tabular}{>{\columncolor[HTML]{EFEFEF}}l>{\columncolor[HTML]
{EFEFEF}}l>{\columncolor[HTML]{EFEFEF}}l>{\columncolor[HTML]{EFEFEF}}l>
{\columncolor[HTML]{EFEFEF}}l>{\columncolor[HTML]{EFEFEF}}l>
{\columncolor[HTML]{EFEFEF}}l>{\columncolor[HTML]{EFEFEF}}l}
\toprule
& \multicolumn{3}{c}{\cellcolor[HTML]{EFEFEF}\textbf{Estimates}} &
&\multicolumn{3}{c}{\cellcolor[HTML]{EFEFEF}\textbf{\begin{tabular}[c]
{@{}l@{}}$\varepsilon$ s. d. and\\ correlation\end{tabular}}} \\\cmidrule{2-
4}\cmidrule{6-8}
& $\hat{b},\hat{\phi}$ & $\sigma(\hat{b})$ & implied& & $r$ & $\Delta d$ &
$dp$ \\
\midrule
$r$ & 0.32324 & 2 & & & & &\\
$\Delta d$ & 0.32324 & 2 & & & & &\\
$dp$ & 0.32324 & 2 & & & & &\\
\bottomrule
\end{tabular}
\caption{Test}
\end{table}
\end{document}
问题是,并不是所有的东西都填上了颜色。它并不是所有的东西都被涂上了颜色:
答案1
如果您只是想要统一的背景颜色,那么这似乎容易得多。我删除了列和单元格颜色,并将整个表格包裹在彩色背景中。归零\fboxsep
是为了让彩色框到达边缘。
\documentclass{article}
\usepackage[table,xcdraw]{xcolor} %Tables
\usepackage{array,multirow}
\usepackage{booktabs}
\definecolor{mycolor}{HTML}{EFEFEF}
\begin{document}
\begin{table}\centering
\setlength{\fboxsep}{0pt}
\colorbox{mycolor}{\begin{tabular}{llllllll}
\toprule
& \multicolumn{3}{c}{\textbf{Estimates}} &
&\multicolumn{3}{c}{\textbf{\begin{tabular}[c]
{@{}l@{}}$\varepsilon$ s. d. and\\ correlation\end{tabular}}} \\\cmidrule{2-
4}\cmidrule{6-8}
& $\hat{b},\hat{\phi}$ & $\sigma(\hat{b})$ & implied& & $r$ & $\Delta d$ &
$dp$ \\
\midrule
$r$ & 0.32324 & 2 & & & & &\\
$\Delta d$ & 0.32324 & 2 & & & & &\\
$dp$ & 0.32324 & 2 & & & & &\\
\bottomrule
\end{tabular}}
\caption{Test}
\end{table}
\end{document}