我想在每一行都有编号列表,我试过了\rownumber
,但是不行。我在开头写了一个数字,但是它可以自动实现吗?你能帮我吗?这是我的代码:
\documentclass[10pt, a4paper]{article}
\usepackage{fontspec}
\setmainfont{Arial}
\usepackage{color, colortbl}
\definecolor{Gray}{gray}{0.9}
\begin{document}
\begin{table}[h!]
\tiny
\begin{tabular}{|>{\raggedright\arraybackslash}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
\multicolumn{1}{|>{\centering\arraybackslash}m{30mm}|}{\rowcolor{Gray}\textbf{Text}} & \multicolumn{1}{|>{\centering\arraybackslash}m{5mm}|}{\textbf{Sem 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{Sem 4}} & \multicolumn{1}{|>{\centering\arraybackslash}m{5mm}|}{\textbf{Sem 5}} & \multicolumn{1}{|>{\centering\arraybackslash}m{5mm}|}{\textbf{Sem 6}} & \multicolumn{1}{|>{\centering\arraybackslash}m{5mm}|}{\textbf{Sem 7}} & \multicolumn{1}{|>{\centering\arraybackslash}m{5mm}|}{\textbf{Sem 8}} & \multicolumn{1}{|>{\centering\arraybackslash}m{5mm}|}{\textbf{Sem 9}} & \multicolumn{1}{|>{\centering\arraybackslash}m{5mm}|}{\textbf{Sem 10}} & \multicolumn{1}{|>{\centering\arraybackslash}m{5mm}|}{\textbf{Sem 11}} & \multicolumn{1}{|>{\centering\arraybackslash}m{5mm}|}{\textbf{Sem 12}}\\
\hline
1. Text text text text text text text text text text text text text &&&&&&&&&&&&\\\hline
2. Text text text text text text text text text text text text text &&&&&&&&&&&&\\\hline
3. Text text text text text text text text text text text text text &&&&&&&&&&&&\\\hline
4. Text text text text text text text text text text text text text &&&&&&&&&&&&\\\hline
\hline
\end{tabular}
\end{table}
\end{document}
答案1
我隐藏了表中的一行,这会产生错误;\rowcolor
该行中的错误位置使用了该行:
\documentclass[10pt, a4paper]{article}
\usepackage{fontspec}
%\setmainfont{Arial}
\usepackage{lipsum}
\usepackage{color, colortbl}
\definecolor{Gray}{gray}{0.9}
\newcounter{myrow}
\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
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}