我正在编写 LaTeX 代码以使用 longtable 包生成一个长表,我希望第一列颜色为灰色
这是我的代码:
\documentclass[a4paper,11pt,english]{report}
\usepackage{longtable}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage[table,xcdraw]{xcolor}
\usepackage{lipsum} % just for dummy text- not needed for a longtable
\begin{document}
\lipsum[1]
\lipsum[1]
\lipsum[1]
\definecolor{lightgray}{HTML}{EFEFEF}
\begin{longtable}[H]{|
>{\columncolor{lightgray}}p{0.2\linewidth} | p{0.175\linewidth} |}
\hline
foo & bar \\ \hline
foo & bar \\ \hline
foo & bar \\ \hline
foo & bar \\ \hline
foo & bar \\ \hline
foo & bar \\ \hline
foo & bar \\ \hline
foo & bar \\ \hline
foo & bar \\ \hline
foo & bar \\ \hline
foo & bar \\ \hline
\caption{Your caption here} % needs to go inside longtable environment
\label{tab:myfirstlongtable}
\end{longtable}
Table \ref{tab:myfirstlongtable} shows my first longtable.
\end{document}
有什么帮助吗?