当长表跨越多页时,交替表格颜色不会重置

当长表跨越多页时,交替表格颜色不会重置

我搜索并发现了类似的问题,但在我的应用程序中没有真正起作用。我试图生成一个带有图片/规格的价格手册,这些图片/规格在长表的标题中。这一切都很顺利,但我还想应用交替颜色。工作正常,除非我的长表溢出到下一页。它似乎没有重置行数,所以它只是应用下一个背景颜色,就好像它就在原始表格的正下方一样。标题后的第一行应该是白色的,但第二个表格的背景是灰色的。下面是一个应该可以工作的示例:

\documentclass{report}
\renewcommand{\arraystretch}{1.5}
\usepackage[table]{xcolor}
\usepackage[final]{pdfpages}
\usepackage{fancyhdr}
\usepackage[letterpaper, lmargin=.5in, rmargin=.5in, tmargin=1in, bmargin=1in]{geometry}
\usepackage{caption}
\usepackage{tocloft}
\usepackage[export]{adjustbox}
\usepackage{longtable}
\usepackage{helvet}
\usepackage{everypage}
\usepackage[space]{grffile}
\usepackage{enumitem}
\usepackage{textcomp}
\usepackage[none]{hyphenat}
\renewcommand{\familydefault}{\sfdefault}
\setcounter{tocdepth}{5}
\pagestyle{fancy}

\renewcommand\footrule{\begin{minipage}{1\textwidth}
\hrule width \hsize height 2pt \kern 1mm \hrule width \hsize
\end{minipage}\par}%

\lfoot{\today}
\rfoot{\thepage}
\cfoot{}
\rhead{}
\lhead{\leftmark}
\renewcommand {\headrulewidth}{0.4pt}
\renewcommand {\footrulewidth}{0.4pt}
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}
\captionsetup{labelsep=space,singlelinecheck=off,labelformat=empty,labelfont=bf}
%
\makeatletter
\setlength{\@fptop}{0pt}
\makeatother
%

\newif\ifimportant\importanttrue

\AddEverypageHook{
\global\importanttrue
}

\definecolor{light-gray}{HTML}{E5E4E2}
\definecolor{light-cyan}{HTML}{FFFFFF}
\definecolor{Gray}{gray}{0.80}
\definecolor{LightGray}{gray}{0.95}

\usepackage{url}
\urlstyle{sf}
\usepackage{hyperref}
\hypersetup{colorlinks,allcolors=black}

\begin{document}

\includepdfset{pagecommand=\thispagestyle{fancy}}

\cleardoublepage\phantomsection
\addcontentsline{toc}{chapter}{Clearance}
\markboth{Clearance}{}

\setlength\LTleft{0pt}
\setlength\LTright{0pt}
\rowcolors{1}{light-cyan}{light-gray}
\begin{longtable}{p{.625in}p{1.5in}p{3.75in}p{.875in}}
\caption{
\ifimportant
\begin{minipage}[l]{0.3\textwidth}
\protect\includegraphics[width=1.875in,height=1.875in,keepaspectratio,left]{example-image}
\newline
\newline
\end{minipage}
\begin{minipage}[r]{0.7\textwidth}
\hspace{\fill}
\end{minipage}
\global\importantfalse
\fi
\textbf{Faucets}
}
\phantomsection\addcontentsline{toc}{section}{Faucets}\\
\hline
\rowcolor{Gray}
Product\# & Model\# & Description & Price\\
\hline
\endfirsthead
\caption[]{
\begin{minipage}[l]{0.3\textwidth}
\protect\includegraphics[width=1.875in,height=2in,keepaspectratio,left]{example-image}
\newline
\newline
\end{minipage}
\begin{minipage}[r]{0.7\textwidth}
\hspace{\fill}
\end{minipage}
\textbf{Faucets}
}\\
\hline
\rowcolor{Gray}
Product\# & Model\# & Description & Price\\
\hline
\endhead
387961 &  & K10577-4-2BZ BANCROFT WS LAV FCT & \$613.15 ea\\\hline
279697 & 10577-4P-BN & K10577-4P-BN BANCRFT W/S FCT & \$659.70 ea\\\hline
97397 &  & K11395-S 42 TRANS GRAB BAR ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASD & \$114.95 ea\\\hline
387968 &  & K11414-2BZ BANCROFT ROBE HOOK & \$42.40 ea\\\hline
37042 & 11581-CP & K11581-CP LOURE 24 TOWEL BAR & \$152.05 ea\\\hline
37906 & 11585-CP & K11585-CP LOURE ROBE HOOK & \$133.05 ea\\\hline
353981 & 11881-S & K11881-S MARGAUX 12 GRAB BAR & \$202.05 ea\\\hline
275281 & 11892-S & K11892-S PURIST 18 GRAB BAR & \$183.50 ea\\\hline
252952 & 12150-G & K12150-G 18IN BRU CHR TWL BAR & \$81.40 ea\\\hline
57743 & 12172-BN & K12172-BN FAIRFAX W/ SPRAY & \$383.45 ea\\\hline
2175 & 12177-G & K12177-G FAIRFAX P/O KIT FCT & \$413.55 ea\\\hline
256039 & 12182-BRZ & K12182-BRZ FAIRFAX S/H LAV FCT & \$353.00 ea\\\hline
100380 & 12183-BRZ & K12183-BRZ FAIRFAX SINK FCT & \$542.05 ea\\\hline
138661 & 128-SN & K128-SN ANTIQUE RISER TUBE(PR) & \$496.85 ea\\\hline
324289 & 13132-4B-BN & K13132-4B-BN PINSTRIPE LAV FCT & \$1353.70 ea\\\hline
15233 & 13864-CP & K13864-CP C/BRS SINK STRAINER & \$141.30 ea\\\hline
122632 & 15182-F-G & K15182-F-G LEVER HNDL LAV FCT & \$207.80 ea\\\hline
11301 & 16010-2-CP & K16010-2-CP TRITON SQR HDLS & \$68.60 ea\\\hline
51577 & 16012-2-CP & K16012-2-CP TRITON STD HANDLES & \$127.40 ea\\\hline
284047 & 16012-4-CP & K16012-4-CP TRITON LVR HANDLE & \$120.60 ea\\\hline
80275 & 16140-BV & K16140-BV TOWEL RING & \$358.40 ea\\\hline
92315 & 16141-BV & K16141-BV TOILET TISSUE HOLDER & \$354.85 ea\\\hline
88279 & 16146-BV & K16146-BV ROBE HOOK & \$203.25 ea\\\hline
84369 & 16150-BV & K16150-BV 24IN TOWEL BAR & \$432.45 ea\\\hline
286726 & 16252-CP & K16252-CP MARGAUX 30 TWL BAR & \$190.60 ea\\\hline
89795 & 16256-BN & K16256-BN MARGAUX ROBE HK & \$123.95 ea\\\hline
255048 & 303-K-NA & K303-K-NA 3-HNDL VALVE SYSTEM & \$165.80 ea\\\hline
\end{longtable}
\end{document}

相关内容