长表和标题的页码错误

长表和标题的页码错误

我正在尝试制作产品目录/价格表。我使用 longtable,因为表格跨越 1 页以上的情况并不少见。一切都很顺利,但似乎当 longtable 从一页开始,但随后被强制转到下一页以容纳至少 1 行时,计数器不会增加。例如,Tools - Corona - Pruner 在目录中显示第 6 页,但出现在第 7 页。我在代码上运行了 6 或 7 次 latex。以下是代码:

    \documentclass[8pt]{report}
    \renewcommand{\arraystretch}{1.5}
    \usepackage[final]{pdfpages}
    \usepackage{fancyhdr}
    \usepackage[letterpaper, margin=1in]{geometry}
    \usepackage{caption}
    \usepackage{tocloft}
    \usepackage[export]{adjustbox}
    \usepackage{longtable}
    \usepackage{hyperref}
    \usepackage{helvet}
    \usepackage{everypage}
    \usepackage[space]{grffile}
    \usepackage{colortbl}
    \usepackage{enumitem}
    \renewcommand{\familydefault}{\sfdefault}

    \hypersetup{%
        pdfborder = {0 0 0}
    }
    \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\importantfalse

    \AddEverypageHook{
        \global\importanttrue
    }

    \definecolor{Gray}{gray}{0.80}
    \definecolor{LightGray}{gray}{0.95}

    \begin{document}\thispagestyle{empty}
    \setlength\unitlength{1in}
    \begin{titlepage}
    \begin{center}

    \huge
    {\fontsize{50}{60}\selectfont Product Catalog}\\
    \vspace{.25in}
    {\fontsize{30}{40}\selectfont DOUG PETERSON}\\
    \vspace{.25in}
    {\fontsize{20}{30}\selectfont \today}

    \vfill

    % Bottom of the page
    {\large www.mountainlandsupply.com}

    \end{center}
    \end{titlepage}
    \setcounter{page}{2}
    \tableofcontents
    \includepdfset{pagecommand=\thispagestyle{fancy}}

    \cleardoublepage\phantomsection
    \addcontentsline{toc}{chapter}{Turf}
    \markboth{Turf}{}
    \addcontentsline{toc}{section}{Tools - Corona - Bar}

    \begin{longtable}{p{.625in}p{1.5in}p{2.75in}p{.875in}}
        \caption{\textbf{Tools - Corona - Bar}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Bar}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Bar}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endhead
        272858 & BR 70090 & BR 70090 14LB SAN ANGELO DIGGING BA & \$45.56 ea\\\hline
                6705 & BR 73090 & BR 73090 18LB 60IN PINCH POINT BAR & \$68.34 ea\\\hline
                345490 & BR 74090 & BR 74090 32LB 69IN LANDSCAPE BAR & \$113.89 ea\\\hline

    \end{longtable}
    \addcontentsline{toc}{section}{Tools - Corona - Broom}

    \begin{longtable}{p{.625in}p{1.5in}p{2.75in}p{.875in}}
        \caption{\textbf{Tools - Corona - Broom}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Broom}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Broom}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endhead
        6718 & BM 60001 & BM 60001 18" LANDSCAPE BROOM WD 60IN WOOD HANDLE & \$61.25 ea\\\hline
                415576 & BM 61002 & BM 61002 CORONA PUSHBROOM 2 BRISTLES & \$61.25 ea\\\hline
                271547 & BM 62060 & BM 62060 24IN PUSH BROOM ALUM 60IN ALUMINUM HANDLE & \$63.72 ea\\\hline

    \end{longtable}
    \addcontentsline{toc}{section}{Tools - Corona - Cutter Mattock}

    \begin{longtable}{p{.625in}p{1.5in}p{2.75in}p{.875in}}
        \caption{\textbf{Tools - Corona - Cutter Mattock}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Cutter Mattock}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Cutter Mattock}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endhead
        379120 & 42000-8 & 42000-8 CORONA CUTTER MATTOCK *HEAD ONLY* & \$22.78 ea\\\hline
                6746 & PM 42000 & PM 42000 5LB CUTTER MATTOCK WD 36IN HICKORY WOOD HANDLE & \$55.89 ea\\\hline
                345488 & PM 75020 & PM 75020 5LB CUTTER MATTOCK FBR 36IN SOLID CORE FIBERGLASS HANDLE & \$57.78 ea\\\hline

    \end{longtable}
    \addcontentsline{toc}{section}{Tools - Corona - Extractor}

    \begin{longtable}{p{.625in}p{1.5in}p{2.75in}p{.875in}}
        \caption{\textbf{Tools - Corona - Extractor}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Extractor}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Extractor}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endhead
        383115 & UT 65001 & UT 65001 EZ OUT - 1IN AND 1-1/4IN STEEL BODY WITH ZINK HEAD & \$15.95 ea\\\hline
                383116 & UT 65002 & UT 65002 EZ OUT - 1/2IN AND 3/4IN STEEL BODY WITH ZINK HEAD & \$8.59 ea\\\hline

    \end{longtable}
    \addcontentsline{toc}{section}{Tools - Corona - File}

    \begin{longtable}{p{.625in}p{1.5in}p{2.75in}p{.875in}}
        \caption{\textbf{Tools - Corona - File}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - File}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - File}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endhead
        476446 &  & 4 IN 1 FILE AND RASP & \$17.94 ea\\\hline
                476459 & FR410108BC1CD & CORONA HALF ROUND WOOD RASP & \$21.51 ea\\\hline

    \end{longtable}
    \addcontentsline{toc}{section}{Tools - Corona - Hammer}

    \begin{longtable}{p{.625in}p{1.5in}p{2.75in}p{.875in}}
        \caption{\textbf{Tools - Corona - Hammer}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Hammer}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Hammer}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endhead
        68742 & ST 43003 & ST 43003 3LB DRILLING HAMMER WD 10IN HICKORY WOOD HANDLE & \$25.75 ea\\\hline
                272050 & ST 70021 & ST 70021 8LB SLEDGEHAMMER FBR 32IN SOLID CORE FIBERGLASS HANDLE & \$50.55 ea\\\hline
                236113 & ST 70024 & ST 70024 12LB SLEDGEHAMMER FBR 32IN SOLID CORE FIBERGLASS HANDLE & \$65.29 ea\\\hline
                345454 & ST 73003 & ST 73003 3LB DRILLING HAMMER FBR 10IN SOLID CORE FIBERGLASS HANDLE & \$28.33 ea\\\hline

    \end{longtable}
    \addcontentsline{toc}{section}{Tools - Corona - Handles}

    \begin{longtable}{p{.625in}p{1.5in}p{2.75in}p{.875in}}
        \caption{\textbf{Tools - Corona - Handles}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Handles}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Handles}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endhead
        347760 & 41000-4 & 41000-4 HANDLE - POLY GURARD FOR PICKS AND MATTOCKS & \$32.36 ea\\\hline
                271638 & 73020-4 & 73020-4 HANDLE - SOLID CORE FIBERGLASS FOR PICKS \& MATTOCKS & \$33.33 ea\\\hline
                272958 & AX 70020 & AX 70020 3-1/2LB MICHIGAN AXE FBR 34IN SOLID CORE FIBERGLASS HANDLE & \$62.23 ea\\\hline

    \end{longtable}
    \addcontentsline{toc}{section}{Tools - Corona - Hoe}

    \begin{longtable}{p{.625in}p{1.5in}p{2.75in}p{.875in}}
        \caption{\textbf{Tools - Corona - Hoe}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Hoe}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Hoe}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endhead
        288263 & SH 60060 & SH 60060 6IN GARDEN HOE ALUM 60IN ALUMINUM HANDLE & \$36.77 ea\\\hline
                311823 & SH 60061 & SH 60061 - 6IN OSCILLATING HOE ALUM 60IN ALUMINUM HANDLE & \$40.43 ea\\\hline
                288500 & SH 63000 & SH 63000 - 7IN HEAVYDUTY WEEDING HO 60IN ASH WOOD HANDLE & \$41.68 ea\\\hline
                423317 & SH 65000 & SH 65000 CORONA MCLEOD HOE 48IN ASH WOOD HANDLE & \$68.61 ea\\\hline

    \end{longtable}
    \addcontentsline{toc}{section}{Tools - Corona - Lopper}

    \begin{longtable}{p{.625in}p{1.5in}p{2.75in}p{.875in}}
        \caption{\textbf{Tools - Corona - Lopper}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Lopper}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Lopper}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endhead
        6876 & AL 8260 & AL 8260 32" HD LOPPER - 2 1/4" CUT & \$79.33 ea\\\hline
                235823 & AL 8462 & AL 8462 2-1/4IN CUT ORCHARD LOPPER 32IN ALUMINUM HANDLES & \$74.44 ea\\\hline
                6886 & FL 3470 & FL 3470 1-5/8IN CUT BYPASS LOPPER 21-33IN EXTENDABLE FBR HANDLES & \$36.05 ea\\\hline
                6871 & SL 3310 & SL 3310 24" BYPASS LOOPER - 1 1/2" CUT & \$35.21 ea\\\hline
                345492 & SL 7180 & SL 7180 2IN CUT DUAL BYPASS LOPPER 31IN STEEL HANDLES & \$58.70 ea\\\hline

    \end{longtable}
    \addcontentsline{toc}{section}{Tools - Corona - Misc}

    \begin{longtable}{p{.625in}p{1.5in}p{2.75in}p{.875in}}
        \caption{\textbf{Tools - Corona - Misc}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Misc}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Misc}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endhead
        237376 & AC 7220 & AC 7220 5IN LEATHER SCABBARD W/ CLIP AND BELT LOOP & \$14.82 ea\\\hline
                345501 & AC 7310 & AC 7310 18IN MACHETE SCABBARD FOR MA60041 & \$10.34 ea\\\hline
                237184 & AC 8300 & AC 8300 SHARPENING TOOL & \$10.34 ea\\\hline
                347529 & AH 4220 & AH 4220 COMPOUND ACTION HEDGE SHEAR 9IN BLADE 11IN ALUMINUM HANDLE & \$26.70 ea\\\hline
                417592 & AS 90400 & AS 90400 WIRE \& EDGING TRENCHER CORONA & \$75.69 ea\\\hline
                345493 & CT 3010i & CT 3010I COMFORT TROWEL POLISHED ALUMINUM ALLOY & \$6.48 ea\\\hline
                276140 & CT 3020I & CT 3020I COMFORT TRANSPLANTER POLISHED ALUMINUM ALLOY & \$6.11 ea\\\hline
                345494 & CT 3030i & CT 3030I COMFORT CULTIVATOR POLISHED ALUMINUM ALLOY & \$0.00 ea\\\hline
                288588 & FK 72065 & FK 72065 5 TINE MANURE FORK ALUM 54IN ALUMINUM HANDLE & \$67.39 ea\\\hline
                345491 & HS 3070 & HS 3070 7IN PRECISION HEDGE SHEAR POLY HANDLES & \$21.85 ea\\\hline
                229709 & HS 7140 & HS 7140 10IN DUAL CUT HEDGE SHEAR ALUMINUM HANDLES & \$49.50 ea\\\hline
                345498 & MA 60041 & MA 60041 18IN MACHETE CO-MOLDED HDL & \$10.34 ea\\\hline
                345499 & MA 61040 & MA 61040 14IN CANE KNIFE WOOD HANDL & \$9.11 ea\\\hline
                235421 & PD 40020 & PD 40020 - POST HOLE DIGGER FBR HDL 12GA 48IN FIBERGLASS HANDLES & \$55.14 ea\\\hline
                415583 & SG 2950 & SG 2950 CORONA BULB PLANTER ** DISCONTINUED AS OF 6-15-2015 ** & \$4.38 ea\\\hline
                235700 & UT 20000 & UT 20000 1/2 MOON EDGER 48IN WD HDL & \$25.92 ea\\\hline
                278273 & UT 66004 & UT 66004 - 4IN HEAD TRIMMER 29IN SHAFT W/ T-HANDLE \& GRIPS & \$49.01 ea\\\hline
                360095 & UT 66006 & UT 66006 6IN HEAD TRIMMER CORONA & \$61.25 ea\\\hline

    \end{longtable}
    \addcontentsline{toc}{section}{Tools - Corona - Pick}

    \begin{longtable}{p{.625in}p{1.5in}p{2.75in}p{.875in}}
        \caption{\textbf{Tools - Corona - Pick}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Pick}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Pick}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endhead
        379118 & 40000-8 & 40000-8 CORONA RAILROAD PICK *HEAD ONLY* & \$22.78 ea\\\hline
                379119 & 41000-8 & 41000-8 CORONA PICK MATTOCK *HEAD ONLY* & \$22.78 ea\\\hline
                271926 & PM 40000 & PM 40000 5LB RAILROAD PICK WD 36IN HICKORY WOOD HANDLE & \$55.89 ea\\\hline
                272032 & PM 41000 & PM 41000 5LB PICK MATTOCK WD 36IN HICKORY WOOD HANDLE & \$55.89 ea\\\hline
                236099 & PM 73020 & PM 73020 5lb RAILROAD PICK FBR HNDL 36IN SOLID CORE FIBERGLASS HANDLE & \$57.78 ea\\\hline
                6739 & PM 74020 & PM 74020 5LB PICK MATTOCK FBR 36IN SOLID CORE FBR HANDLE & \$57.78 ea\\\hline

    \end{longtable}
    \addcontentsline{toc}{section}{Tools - Corona - Post Driver}

    \begin{longtable}{p{.625in}p{1.5in}p{2.75in}p{.875in}}
        \caption{\textbf{Tools - Corona - Post Driver}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Post Driver}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Post Driver}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endhead
        6796 & UT 67001 & UT 67001 2-1/2IN POST DRIVER & \$107.81 ea\\\hline
                6805 & UT 67003 & UT 67003 2-1/2IN POST DRIVER 65IN LONG REACH MODEL & \$103.66 ea\\\hline

    \end{longtable}
    \addcontentsline{toc}{section}{Tools - Corona - Pouch}

    \begin{longtable}{p{.625in}p{1.5in}p{2.75in}p{.875in}}
        \caption{\textbf{Tools - Corona - Pouch}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Pouch}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Pouch}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endhead
        237451 & AC 4510 & AC 4510 6-3/4IN NYLON TOOL POUCH & \$10.34 ea\\\hline

    \end{longtable}
    \addcontentsline{toc}{section}{Tools - Corona - Pruner}

    \begin{longtable}{p{.625in}p{1.5in}p{2.75in}p{.875in}}
        \caption{\textbf{Tools - Corona - Pruner}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Pruner}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endfirsthead
        \caption[]{\textbf{Tools - Corona - Pruner}}\\
        \hline
        \rowcolor{Gray}
        Product\# & Model\# & Description & Price\\
        \hline
        \endhead
        6902 & BP 3160 & BP 3160 3/4" BYPASS PRUNER RADIAL ARC BLADE / ALL STEEL & \$27.92 ea\\\hline
                6893 & BP 3180 & BP 3180 1" BYPASS PRUNER RADIAL ARC BLADE / ALL STEEL & \$32.76 ea\\\hline
                415571 & TP 3811 & TP 3811 CORONA 10FT TREE PRUNER & \$65.52 ea\\\hline
                347505 & TP 6830 & TP 6830 - 12FT TREE PRUNER DUAL COMPOUND ACTION POWERGLIDE ROPE PULL SYSTEM & \$98.94 ea\\\hline
                237002 & TP 6850 & TP 6850 14FT TREE PRUNER DUAL COMPOUND ACTION CHAIN PULLEY SYSTEM & \$100.00 ea\\\hline

    \end{longtable}
    \end{document}

答案1

巧妙运用 TeX 和 LaTeX!:-)

指令\addcontentsline先行 \begin{longtable},并且这两个指令不能保证在同一页上执行。由于所有 longtable 的表格式(标题除外)都相同,因此创建一个宏很方便,该宏 (a) 包含所有表头指令,并且 (b) 将\addcontentsline指令 \caption(之后的第一条指令\begin{longtable})。这样做可以让您从文档主体中删除大量重复的内容。

具体来说,您可以设置一个名为的宏\tableheader,它包含所有格式指令并接受一个参数——标题:

\newcommand\tableheader[1]{%
\begin{longtable}{p{.625in}p{1.5in}p{2.75in}p{.875in}}
\caption{#1}\phantomsection\addcontentsline{toc}{section}{#1}\\
\hline
\rowcolor{Gray}
Product\# & Model\# & Description & Price\\
\hline
\endfirsthead
\caption{#1, continued}\\
\hline
\rowcolor{Gray}
Product\# & Model\# & Description & Price\\
\hline
\endhead}

请留意,我已删除了之前的重复材料\endfirsthead

然后,完整的文档将由以下代码生成:

    \documentclass{report}
    \renewcommand{\arraystretch}{1.5}
    \usepackage[final]{pdfpages}
    \usepackage{fancyhdr}
    \usepackage[letterpaper, margin=1in]{geometry}
    \usepackage{caption}
    \captionsetup{labelsep=space,singlelinecheck=off,
          labelformat=empty,font=bf}
    \usepackage{tocloft}
    \usepackage[export]{adjustbox}
    \usepackage{longtable}
    \usepackage{helvet}
    \usepackage{everypage}
    \usepackage[space]{grffile}
    \usepackage{colortbl}
    \usepackage{enumitem}
    \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}}
    %
    \makeatletter
    \setlength{\@fptop}{0pt}
    \makeatother
    %


    \newif\ifimportant\importantfalse

    \AddEverypageHook{
\global\importanttrue
    }

    \definecolor{Gray}{gray}{0.80}
    \definecolor{LightGray}{gray}{0.95}

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


\newcommand\tableheader[1]{%
\begin{longtable}{p{.625in}p{1.5in}p{2.75in}p{.875in}}
\caption{#1}\phantomsection\addcontentsline{toc}{section}{#1}\\
\hline
\rowcolor{Gray}
Product\# & Model\# & Description & Price\\
\hline
\endfirsthead
\caption{#1}\\
\hline
\rowcolor{Gray}
Product\# & Model\# & Description & Price\\
\hline
\endhead}

    \begin{document}
    \thispagestyle{empty}
    \setlength\unitlength{1in}
    \begin{titlepage}
    \centering

    \fontsize{50}{60}\selectfont Product Catalog\par
    \vspace{.25in}
    \fontsize{30}{40}\selectfont DOUG PETERSON\par
    \vspace{.25in}
    \fontsize{20}{30}\selectfont \today\par

    \vfill

    % Bottom of the page
    \large \url{www.mountainlandsupply.com}
    \normalsize
    \end{titlepage}
    \setcounter{page}{2}
    \tableofcontents
    \includepdfset{pagecommand=\thispagestyle{fancy}}

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

\tableheader{Tools - Corona - Bar}
272858 & BR 70090 & BR 70090 14LB SAN ANGELO DIGGING BA & \$45.56 ea\\\hline
6705 & BR 73090 & BR 73090 18LB 60IN PINCH POINT BAR & \$68.34 ea\\\hline
345490 & BR 74090 & BR 74090 32LB 69IN LANDSCAPE BAR & \$113.89 ea\\\hline
\end{longtable}


\tableheader{Tools - Corona - Broom}
6718 & BM 60001 & BM 60001 18" LANDSCAPE BROOM WD 60IN WOOD HANDLE & \$61.25 ea\\\hline
415576 & BM 61002 & BM 61002 CORONA PUSHBROOM 2 BRISTLES & \$61.25 ea\\\hline
271547 & BM 62060 & BM 62060 24IN PUSH BROOM ALUM 60IN ALUMINUM HANDLE & \$63.72 ea\\\hline
\end{longtable}


\tableheader{Tools - Corona - Cutter Mattock}
379120 & 42000-8 & 42000-8 CORONA CUTTER MATTOCK *HEAD ONLY* & \$22.78 ea\\\hline
6746 & PM 42000 & PM 42000 5LB CUTTER MATTOCK WD 36IN HICKORY WOOD HANDLE & \$55.89 ea\\\hline
345488 & PM 75020 & PM 75020 5LB CUTTER MATTOCK FBR 36IN SOLID CORE FIBERGLASS HANDLE & \$57.78 ea\\\hline
\end{longtable}


\tableheader{Tools - Corona - Extractor}
383115 & UT 65001 & UT 65001 EZ OUT - 1IN AND 1-1/4IN STEEL BODY WITH ZINK HEAD & \$15.95 ea\\\hline
383116 & UT 65002 & UT 65002 EZ OUT - 1/2IN AND 3/4IN STEEL BODY WITH ZINK HEAD & \$8.59 ea\\\hline
\end{longtable}


\tableheader{Tools - Corona - File}
476446 &  & 4 IN 1 FILE AND RASP & \$17.94 ea\\\hline
476459 & FR410108BC1CD & CORONA HALF ROUND WOOD RASP & \$21.51 ea\\\hline
\end{longtable}


\tableheader{Tools - Corona - Hammer}
68742 & ST 43003 & ST 43003 3LB DRILLING HAMMER WD 10IN HICKORY WOOD HANDLE & \$25.75 ea\\\hline
272050 & ST 70021 & ST 70021 8LB SLEDGEHAMMER FBR 32IN SOLID CORE FIBERGLASS HANDLE & \$50.55 ea\\\hline
236113 & ST 70024 & ST 70024 12LB SLEDGEHAMMER FBR 32IN SOLID CORE FIBERGLASS HANDLE & \$65.29 ea\\\hline
345454 & ST 73003 & ST 73003 3LB DRILLING HAMMER FBR 10IN SOLID CORE FIBERGLASS HANDLE & \$28.33 ea\\\hline
\end{longtable}


\tableheader{Tools - Corona - Handles}
347760 & 41000-4 & 41000-4 HANDLE - POLY GURARD FOR PICKS AND MATTOCKS & \$32.36 ea\\\hline
271638 & 73020-4 & 73020-4 HANDLE - SOLID CORE FIBERGLASS FOR PICKS \& MATTOCKS & \$33.33 ea\\\hline
272958 & AX 70020 & AX 70020 3-1/2LB MICHIGAN AXE FBR 34IN SOLID CORE FIBERGLASS HANDLE & \$62.23 ea\\\hline
\end{longtable}


\tableheader{Tools - Corona - Hoe}
288263 & SH 60060 & SH 60060 6IN GARDEN HOE ALUM 60IN ALUMINUM HANDLE & \$36.77 ea\\\hline
311823 & SH 60061 & SH 60061 - 6IN OSCILLATING HOE ALUM 60IN ALUMINUM HANDLE & \$40.43 ea\\\hline
288500 & SH 63000 & SH 63000 - 7IN HEAVYDUTY WEEDING HO 60IN ASH WOOD HANDLE & \$41.68 ea\\\hline
423317 & SH 65000 & SH 65000 CORONA MCLEOD HOE 48IN ASH WOOD HANDLE & \$68.61 ea\\\hline
\end{longtable}


\tableheader{Tools - Corona - Lopper}
6876 & AL 8260 & AL 8260 32" HD LOPPER - 2 1/4" CUT & \$79.33 ea\\\hline
235823 & AL 8462 & AL 8462 2-1/4IN CUT ORCHARD LOPPER 32IN ALUMINUM HANDLES & \$74.44 ea\\\hline
6886 & FL 3470 & FL 3470 1-5/8IN CUT BYPASS LOPPER 21-33IN EXTENDABLE FBR HANDLES & \$36.05 ea\\\hline
6871 & SL 3310 & SL 3310 24" BYPASS LOOPER - 1 1/2" CUT & \$35.21 ea\\\hline
345492 & SL 7180 & SL 7180 2IN CUT DUAL BYPASS LOPPER 31IN STEEL HANDLES & \$58.70 ea\\\hline
\end{longtable}


\tableheader{Tools - Corona - Misc}
237376 & AC 7220 & AC 7220 5IN LEATHER SCABBARD W/ CLIP AND BELT LOOP & \$14.82 ea\\\hline
345501 & AC 7310 & AC 7310 18IN MACHETE SCABBARD FOR MA60041 & \$10.34 ea\\\hline
237184 & AC 8300 & AC 8300 SHARPENING TOOL & \$10.34 ea\\\hline
347529 & AH 4220 & AH 4220 COMPOUND ACTION HEDGE SHEAR 9IN BLADE 11IN ALUMINUM HANDLE & \$26.70 ea\\\hline
417592 & AS 90400 & AS 90400 WIRE \& EDGING TRENCHER CORONA & \$75.69 ea\\\hline
345493 & CT 3010i & CT 3010I COMFORT TROWEL POLISHED ALUMINUM ALLOY & \$6.48 ea\\\hline
276140 & CT 3020I & CT 3020I COMFORT TRANSPLANTER POLISHED ALUMINUM ALLOY & \$6.11 ea\\\hline
345494 & CT 3030i & CT 3030I COMFORT CULTIVATOR POLISHED ALUMINUM ALLOY & \$0.00 ea\\\hline
288588 & FK 72065 & FK 72065 5 TINE MANURE FORK ALUM 54IN ALUMINUM HANDLE & \$67.39 ea\\\hline
345491 & HS 3070 & HS 3070 7IN PRECISION HEDGE SHEAR POLY HANDLES & \$21.85 ea\\\hline
229709 & HS 7140 & HS 7140 10IN DUAL CUT HEDGE SHEAR ALUMINUM HANDLES & \$49.50 ea\\\hline
345498 & MA 60041 & MA 60041 18IN MACHETE CO-MOLDED HDL & \$10.34 ea\\\hline
345499 & MA 61040 & MA 61040 14IN CANE KNIFE WOOD HANDL & \$9.11 ea\\\hline
235421 & PD 40020 & PD 40020 - POST HOLE DIGGER FBR HDL 12GA 48IN FIBERGLASS HANDLES & \$55.14 ea\\\hline
415583 & SG 2950 & SG 2950 CORONA BULB PLANTER ** DISCONTINUED AS OF 6-15-2015 ** & \$4.38 ea\\\hline
235700 & UT 20000 & UT 20000 1/2 MOON EDGER 48IN WD HDL & \$25.92 ea\\\hline
278273 & UT 66004 & UT 66004 - 4IN HEAD TRIMMER 29IN SHAFT W/ T-HANDLE \& GRIPS & \$49.01 ea\\\hline
360095 & UT 66006 & UT 66006 6IN HEAD TRIMMER CORONA & \$61.25 ea\\\hline
\end{longtable}


\tableheader{Tools - Corona - Pick}
379118 & 40000-8 & 40000-8 CORONA RAILROAD PICK *HEAD ONLY* & \$22.78 ea\\\hline
379119 & 41000-8 & 41000-8 CORONA PICK MATTOCK *HEAD ONLY* & \$22.78 ea\\\hline
271926 & PM 40000 & PM 40000 5LB RAILROAD PICK WD 36IN HICKORY WOOD HANDLE & \$55.89 ea\\\hline
272032 & PM 41000 & PM 41000 5LB PICK MATTOCK WD 36IN HICKORY WOOD HANDLE & \$55.89 ea\\\hline
236099 & PM 73020 & PM 73020 5lb RAILROAD PICK FBR HNDL 36IN SOLID CORE FIBERGLASS HANDLE & \$57.78 ea\\\hline
6739 & PM 74020 & PM 74020 5LB PICK MATTOCK FBR 36IN SOLID CORE FBR HANDLE & \$57.78 ea\\\hline
\end{longtable}


\tableheader{Tools - Corona - Post Driver}
6796 & UT 67001 & UT 67001 2-1/2IN POST DRIVER & \$107.81 ea\\\hline
6805 & UT 67003 & UT 67003 2-1/2IN POST DRIVER 65IN LONG REACH MODEL & \$103.66 ea\\\hline
\end{longtable}


\tableheader{Tools - Corona - Pouch}
237451 & AC 4510 & AC 4510 6-3/4IN NYLON TOOL POUCH & \$10.34 ea\\\hline
\end{longtable}


\tableheader{Tools - Corona - Pruner}
6902 & BP 3160 & BP 3160 3/4" BYPASS PRUNER RADIAL ARC BLADE~\slash\ ALL STEEL & \$27.92 ea\\\hline
6893 & BP 3180 & BP 3180 1" BYPASS PRUNER RADIAL ARC BLADE~\slash\ ALL STEEL & \$32.76 ea\\\hline
415571 & TP 3811 & TP 3811 CORONA 10FT TREE PRUNER & \$65.52 ea\\\hline
347505 & TP 6830 & TP 6830 - 12FT TREE PRUNER DUAL COMPOUND ACTION POWERGLIDE ROPE PULL SYSTEM & \$98.94 ea\\\hline
237002 & TP 6850 & TP 6850 14FT TREE PRUNER DUAL COMPOUND ACTION CHAIN PULLEY SYSTEM & \$100.00 ea\\\hline
\end{longtable}

\end{document}

答案2

这是一种不使用 的方法\caption。它使用titlesec.stytitletoc.sty来自定义目录的外观和分段命令。 命令\turfhead控制长表标题。它用于\nameref*{<subsec.name>}续标题。如果您想修改产品名称,只需编辑命令\subsection,其余部分将相应更新。

\documentclass[10pt]{article}
\renewcommand{\arraystretch}{1.5}
\usepackage[letterpaper, margin=1in]{geometry}
\usepackage{caption,colortbl}
\usepackage{longtable,helvet}
\usepackage{hyperref}
\renewcommand{\familydefault}{\sfdefault}

\captionsetup{labelsep=space,singlelinecheck=off,labelformat=empty,labelfont=bf}

\usepackage[pagestyles,nobottomtitles*]{titlesec}
\titleformat{\section}[hang]{\large\bfseries}{\sectiontitle}{0em}{}
\titleformat{\subsection}[hang]{\bfseries}{\subsectiontitle}{0em}{}

\usepackage{titletoc,ragged2e}

\titlecontents{section}[0em]
  {\addvspace{0.3pc}\bfseries\filright}
  {}{\hspace*{0em}}
  {\mdseries\titlerule*[0.7pc]{.}\bfseries\contentspage}

\titlecontents{subsection}[0em]
  {\addvspace{0.1pc}\filright}
  {}{\hspace*{0em}}
  {\titlerule*[0.7pc]{.}\contentspage}

\newcolumntype{T}{%
  p{.625in}p{1.5in}>{\hspace{0pt}\RaggedRight}p{2.75in}p{.875in}}

\newcommand*\turfhead[1]{%
  \multicolumn{4}{@{}l}{\bfseries #1 \itshape (cont.)}\\\hline
  \rowcolor{Gray} Product\# & Model\# & Description & Price\\
  \hline
  \endhead
  \hline
  \rowcolor{Gray} Product\# & Model\# & Description & Price\\
  \hline
  \endfirsthead
}

\definecolor{Gray}{gray}{0.80}
\definecolor{LightGray}{gray}{0.95}

\begin{document}

\tableofcontents

\section{Turf}
\subsection{Tools - Corona - Bar}
\label{sec:tools-corona-bar}

\begin{longtable}{T}
  \turfhead{\nameref*{sec:tools-corona-bar}}
  272858 & BR 70090 & BR 70090 14LB SAN ANGELO DIGGING BA & \$45.56 ea\\\hline
  6705 & BR 73090 & BR 73090 18LB 60IN PINCH POINT BAR & \$68.34 ea\\\hline
  345490 & BR 74090 & BR 74090 32LB 69IN LANDSCAPE BAR & \$113.89 ea\\\hline
\end{longtable}

\subsection{Tools - Corona - Broom}
\label{sec:tools-corona-broom}

\begin{longtable}{T}
  \turfhead{\nameref*{sec:tools-corona-broom}}
  6718 & BM 60001 & BM 60001 18" LANDSCAPE BROOM
                    WD 60IN WOOD HANDLE & \$61.25 ea\\\hline
  415576 & BM 61002 & BM 61002 CORONA PUSHBROOM
                      2 BRISTLES & \$61.25 ea\\\hline
  271547 & BM 62060 & BM 62060 24IN PUSH BROOM
                      ALUM 60IN ALUMINUM HANDLE & \$63.72 ea\\\hline
\end{longtable}

\subsection{Tools - Corona - Cutter Mattock}
\label{sec:tools-corona-cutter}

\begin{longtable}{T}
  \turfhead{\nameref*{sec:tools-corona-cutter}}%
  379120 & 42000-8 & 42000-8 CORONA CUTTER MATTOCK
                     *HEAD ONLY* & \$22.78 ea\\\hline
  6746 & PM 42000  & PM 42000 5LB CUTTER MATTOCK WD 36IN HICKORY WOOD
                    HANDLE & \$55.89 ea\\\hline
  345488 & PM 75020 & PM 75020 5LB CUTTER MATTOCK FBR 36IN SOLID CORE
                      FIBERGLASS HANDLE & \$57.78 ea\\\hline
\end{longtable}

\subsection{Tools - Corona - Extractor}
\label{sec:tools-corona-extr}

\begin{longtable}{T}
  \turfhead{\nameref*{sec:tools-corona-extr}}%
  383115 & UT 65001 & UT 65001 EZ OUT - 1IN AND 1-1/4IN STEEL BODY
                      WITH ZINK HEAD & \$15.95 ea\\\hline
  383116 & UT 65002 & UT 65002 EZ OUT - 1/2IN AND 3/4IN STEEL BODY
                      WITH ZINK HEAD & \$8.59 ea\\\hline
\end{longtable}

\end{document}

相关内容