我如何才能向该表格格式添加带状彩色行?
\documentclass{minimal}
\begin{document}
\begin{tabular}{ | p{3.40cm} | *{5}{p{1.8cm}|} \hline
\ & \b{Title} & \b{Title} & \b{Title} & \b{Title} & \b{Title} \\
\hline
\hline
\multicolumn{6}{|l|}{subhead} \\
\hline {text} & {text} & {text} & {text} & {text} & {text} \\
\hline
\hline
\end{tabular}
\end{document}
答案1
以下是带状行,感谢这个答案和包的使用xcolor
:
\documentclass{minimal}
\usepackage[table]{xcolor} % loads also »colortbl«
\begin{document}
\rowcolors{2}{gray!25}{white}
\begin{tabular}{ | p{3.40cm} | *{5}{p{1.8cm}}|} \hline
\rowcolor{gray!50} % comment out if you don't want top row colored
\ & \b{Title} & \b{Title} & \b{Title} & \b{Title} & \b{Title} \\
\hline
\hline
\multicolumn{6}{|l|}{subhead} \\
\hline {text} & {text} & {text} & {text} & {text} & {text} \\
\hline {text} & {text} & {text} & {text} & {text} & {text} \\
\hline {text} & {text} & {text} & {text} & {text} & {text} \\
\hline {text} & {text} & {text} & {text} & {text} & {text} \\
\hline {text} & {text} & {text} & {text} & {text} & {text} \\
\hline {text} & {text} & {text} & {text} & {text} & {text} \\
\hline {text} & {text} & {text} & {text} & {text} & {text} \\
\hline {text} & {text} & {text} & {text} & {text} & {text} \\
\hline
\hline
\end{tabular}
\end{document}