答案1
Sebastiano 的另一种回答是:
\documentclass{article}
\usepackage{caption}
\usepackage[table]{xcolor}
\newcommand{\mcsix}[1]{\multicolumn{6}{l|}{#1}}
\begin{document}
\begin{table}[h]
\centering
\begin{tabular}{|>{\columncolor{blue!45}}l | *{6}{l|}}
\hline
text & & & & & & \\ \hline
proof & \mcsix{} \\ \hline
begin & \mcsix{} \\ \hline
gray & \mcsix{} \\ \hline
\end{tabular}
\end{table}
\end{document}
例如,定义一列的着色就足以>{\columncolor{blue!45}}l
。cellcolor
专用于为特定单元格着色,但使用>{\cellcolor{blue!45}}l
会产生与上述 MWE 相同的结果。
答案2
在 ConTeXt MKIV 中,您可以使用自然表来完成这项工作。
\starttext
\setupTABLE[option=stretch]
\setupTABLE[each][each][align=middle]
\setupTABLE[column][first][background=color,backgroundcolor=cyan]
\startTABLE
\NC TEXT \NC \NC \NC \NC \NC \NC \NC\NR
\NC TEXT \NC[nx=6] \NC\NR
\NC TEXT \NC[nx=6] \NC\NR
\NC TEXT \NC[nx=6] \NC\NR
\stopTABLE
\stoptext
答案3
希望对你有帮助。说实话我的资源很简陋,也很贫乏。
\documentclass{article}
\usepackage{mathtools,caption}
\usepackage[table]{xcolor}
\begin{document}
\begin{table}[hhh]
\centering
\captionsetup{skip=0cm}
\caption{My table}
\begin{tabular}{|
>{\cellcolor{blue!45}}l |l|l|l|l|l|l|}
\hline
\cellcolor{blue!45} text & & & & & & \\ \hline
\cellcolor{blue!45} proof & \multicolumn{6}{l|}{} \\ \hline
\cellcolor{blue!45} begin & \multicolumn{6}{l|}{} \\ \hline
\cellcolor{blue!45} gray & \multicolumn{6}{l|}{} \\ \hline
\end{tabular}
\end{table}
\end{document}
答案4
您可以使用\columncolor
命令,来自(通过选项colortbl
加载)。我向单元格添加了一些填充,从而更改了的值。[table]
xcolor
\arraystretch
添加:第二种解决方案,tabularx
可以填充整个线宽。\documentclass{article} \usepackage[showframe]{geometry} \usepackage{mathtools} \usepackage{array, tabularx, caption}% \usepackage[table, svgnames]{xcolor}
\begin{document}
\begin{table}[!htb]
\centering%
\renewcommand{\arraystretch}{1.6}
\caption{My table}
\begin{tabular}{|>{\centering\bfseries\columncolor{RoyalBlue!80}}m{2cm} |*{8}{m{3mm}|}}
\hline
TEXT & & & & & & & & \\ \hline
TEXT & \multicolumn{8}{l|}{} \\ \hline
TEXT & \multicolumn{8}{l|}{} \\ \hline
TEXT & \multicolumn{8}{l|}{} \\ \hline
\end{tabular}
\end{table}
\begin{table}[!htb]
\renewcommand{\arraystretch}{1.6}
\renewcommand{\tabularxcolumn}[1]{>{\arraybackslash}m{#1}}
\caption{My table}
\begin{tabularx}{\linewidth}{|>{\centering\bfseries\columncolor{RoyalBlue!80}\hsize =3\hsize}X |*{8}{ >{\hsize=0.75\hsize}X|}}
\hline
TEXT & & & & & & & & \\ \hline
TEXT & \multicolumn{8}{l|}{} \\ \hline
TEXT & \multicolumn{8}{l|}{} \\ \hline
TEXT & \multicolumn{8}{l|}{} \\ \hline
\end{tabularx}
\end{table}
\end{document}