我尝试了一些解决方案,但还是不行。我想从这个表格的第三行开始编号。另外,我遇到了一个问题\rowcolor
,请帮帮我。
\documentclass[10pt, a4paper]{article}
\newcounter{myrow}
\usepackage{multirow}
\usepackage{color, colortbl}
\definecolor{Gray}{gray}{0.9}
\begin{document}
\begin{table}[h!]
\tiny
\begin{tabular}{|>{\stepcounter{myrow}\raggedright\arraybackslash\themyrow.~}m{30mm}|> {\raggedright\arraybackslash}m{5mm}|>{\raggedright\arraybackslash}m{5mm}|>{\raggedright\arraybackslash}m{5mm}|>{\raggedright\arraybackslash}m{5mm}|>{\raggedright\arraybackslash}m{5mm}|>{\raggedright\arraybackslash}m{5mm}|>{\raggedright\arraybackslash}m{5mm}|>{\raggedright\arraybackslash}m{5mm}|>{\raggedright\arraybackslash}m{5mm}|>{\raggedright\arraybackslash}m{5mm}|>{\raggedright\arraybackslash}m{5mm}|>{\raggedright\arraybackslash}m{5mm}|}
\hline
\rowcolor{Gray} \multirow{2}{*}{\parbox[c]{30mm}{\centering\bfseries Texx}} & \multicolumn{12}{c|}{\textbf{Ttttt} }\\\cline{2-13}
\rowcolor{Gray} & \multicolumn{1}{>{\centering\arraybackslash}m{5mm}|}{\textbf{1}} & \multicolumn{1}{>{\centering\arraybackslash}m{5mm}|}{\textbf{Sem 2}} & \multicolumn{1}{>{\centering\arraybackslash}m{5mm}|}{\textbf{Sem 3}} & \multicolumn{1}{>{\centering\arraybackslash}m{5mm}|}{\textbf{4}} & \multicolumn{1}{>{\centering\arraybackslash}m{5mm}|}{\textbf{5}} & \multicolumn{1}{>{\centering\arraybackslash}m{5mm}|}{\textbf{6}} & \multicolumn{1}{>{\centering\arraybackslash}m{5mm}|}{\textbf{7}} & \multicolumn{1}{>{\centering\arraybackslash}m{5mm}|}{\textbf{8}} & \multicolumn{1}{>{\centering\arraybackslash}m{5mm}|}{\textbf{9}} & \multicolumn{1}{>{\centering\arraybackslash}m{5mm}|}{\textbf{10}} & \multicolumn{1}{>{\centering\arraybackslash}m{5mm}|}{\textbf{11}} & \multicolumn{1}{>{\centering\arraybackslash}m{5mm}|}{\textbf{12}}\\
\hline
Text text text text text text text text text text text text text &&&&&&&&&&&&\\\hline
Text text text text text text text text text text text text text &&&&&&&&&&&&\\\hline
Text text text text text text text text text text text text text &&&&&&&&&&&&\\\hline
Text text text text text text text text text text text text text &&&&&&&&&&&&\\\hline
\end{tabular}
\end{table}
\end{document}
答案1
\documentclass[10pt, a4paper]{article}
\newcounter{myrow}
\usepackage{multirow}
\usepackage{color, colortbl,hhline}
\definecolor{Gray}{gray}{0.9}
\begin{document}
\begin{table}[htbp]
\setlength\extrarowheight{2pt}
\tiny
\begin{tabular}{|>{\stepcounter{myrow}\raggedright\themyrow.~}m{30mm}|*{12}{> {\raggedright\arraybackslash}m{5mm}|}}
\hline
\rowcolor{Gray}\multicolumn{1}{|c|}{}
& \multicolumn{12}{c|}{\textbf{Ttttt}}\\
\hhline{|>{\arrayrulecolor{Gray}}->{\arrayrulecolor{black}}|*{12}{-}}
\rowcolor{Gray}\multicolumn{1}{|c|}{\raisebox{1em}[0pt]{\textbf{Texx}}}
& \centering \textbf{1} & \centering\textbf{Sem 2} & \centering\textbf{Sem 3} & \centering\textbf{4} &\centering\textbf{5} & \multicolumn{1}{c}{\textbf{6}} & \centering\textbf{7} & \centering\textbf{8} & \centering\textbf{9} & \centering\textbf{10} &
\centering\textbf{11} & \centering\arraybackslash\textbf{12}\\
\hline
Text text text text text text text text text text text text text &&&&&&&&&&&&\\\hline
Text text text text text text text text text text text text text &&&&&&&&&&&&\\\hline
Text text text text text text text text text text text text text &&&&&&&&&&&&\\\hline
Text text text text text text text text text text text text text &&&&&&&&&&&&\\\hline
\end{tabular}
\end{table}
\end{document}