首页 > 解决方案 > 长表操作 - 乳胶

问题描述

我正在编写 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}

生成表的问题是彩色区域中没有出现水平线。这是我的输出: 在此处输入图像描述

有什么帮助吗?

标签: latexlongtable

解决方案


推荐阅读