要求:一个包含 n 个列表的长表列表 A(列表 B)(长表用于获取一个设计对齐)。通用术语是列表 A,它作为通用术语出现在每个新页面上的标题中
长表行代表独立的 n 个小列表(列表 B)。其结构始终相同 1) 业务行 2) 列描述 3) n 行条目。这些小列表的长度各不相同。这样的列表永远不应被打破(通过分页符)。结果:这样的小列表(1)+2)+3)的开头始终出现在新页面的顶部。
列表 A 第 1 页
清单B
Header (2 rows) 1 - n rows
清单B
Header (2 rows) 1 - n rows . .
列表 A 第 2 页
清单B
Header (2 rows) every time at first after pagebreak 1 - n rows must follow the header NEVER pagebreak (except of last row of this list B)
清单B
Header (2 rows) 1 - n rows .
我所得到的是“通用术语”sa 的正确放置和独特的外观。有没有人有解决方案,让受控分页符不分隔输出中显示的 B 列表?
%\documentclass[a4paper,14pt]{scrartcl} % KOMA not recommended with usage of fancyhdr
\documentclass[a4paper]{article}
\usepackage[top=1.0cm,right=1cm,left=1cm,bottom=1cm,headheight=50pt,includeheadfoot,headsep=20pt,]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{longtable}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{lastpage}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\fancyhf{} % clears all fields
\fancyfoot[C]{\thepage\ of \pageref{LastPage}}
\definecolor{ctaggreen}{HTML}{330066}
\setlength\headheight{57pt} % to prevent warning of fancyhdr
\cfoot{\colorbox{ctaggreen}{\parbox[b][0.20cm][c]{1.0cm}{\centering\textcolor{white}{\sffamily\bfseries \thepage\ of \pageref{LastPage}}}}}
\lhead{\raisebox{-2mm}{\makebox[0pt]{\hspace*{6.005cm}\includegraphics[height=2cm]{testlogo.png}}}}
\rhead{\raisebox{-2mm}{\makebox[0pt]{\hspace*{-6.005cm}\includegraphics[height=2cm]{testlogo.png}}}}
\chead{\raisebox{3mm}{\colorbox{ctaggreen}{\parbox[b][1.00cm][c]{6.0cm}{\large\centering\textcolor{black}{\sffamily \bfseries{Phone list} \\ [-0.20cm] \footnotesize{voor Medewerkers}%
}%end parbox
}%raisebox
}%endcolorbox
}% end chead
}% end of ???. without: error paragraph ended before ychead...
\usepackage{marvosym}
\begin{document}
\Large %quick and dirty
\sffamily
\setlength{\tabcolsep}{10pt}
\begin{longtable}[h]{ll@{}lr@{ - }l}%
\endfirsthead
\endhead
\multicolumn{5}{c}{\textit{next page continues}} \\
\endfoot
\hline\hline % two horiz. lines at the end of table
\endlastfoot
%%%%%%%%%%%%%%%%%%%%
%first tab row
%
% Headline
\multicolumn{5}{@{}l}{\textbf{Business Herbert}} Operating times (00:00)07:00 - 16:30\\ \hline
% Column desc
Contact & {Phone} & & Break from&to \\* \hline
% Rows
B\"uro & 71073 & 707 62 & 12:30 & 13:00 \\*
Dimitri & 20573 & 070 37 10 & & \\*
Dimitri & 2060 & 00 57 71 71 & & \\*
Herbert & 2073 & 272 25 75 & 00:00 & 00:30 \\*
Alma & 20516 & 655 12 30 & 12:30 & 13:00 \\*
Johannes & 20520 & 700 37 00 & 15:00 & 15:10 \\*
Georg & 2060 & 706 10 60 & & \\* [1cm]
\multicolumn{5}{@{}l}{\textbf{Business Gottfried \& Shirin}} Operating times (00:00)07:00 - 16:30\\ \hline% Column desc
Contact & {Phone} & & Break from&to \\* \hline
Shirin & 20523 & 370 70 00 & 00:00 & 00:20 \\*
Jessy & 2077 & 076 55 22 & 12:00 & 12:30 \\*
Leo & 2077 & 525 03 71 & 15:00 & 15:30\\* [1cm]
\multicolumn{5}{@{}l}{\textbf{Business Jorge}} Operating times 07:30 - 16:30\\ \hline
Contact & {Phone} & & Break from&to \\* \hline
Jorge & 2072 & 263 30 26 & 12:00 & 13:00 \\*
Gabi & 20525 & 733 76 75 & 12:00 & 13:00 \\*
Quintus & 2070 & 013 07 23 & 12:00 & 13:00 \\*
Sokrates & 20522 & 730 50 30 & 12:00 & 13:00 \\* [1cm]
\multicolumn{3}{@{}l}{\textbf{Pascal} \Smiley} Operating times& & \\ \hline
Contact & {Phone} & & Break from&to \\* \hline
Pascal & 2072 & 730 05 75 & & \\*
Pascal & 2072 & 730 05 75 & & \\* [1cm] %
\multicolumn{5}{@{}l}{\textbf{Business Herbert}} Operating times (00:00)07:00 - 16:30\\ \hline
Contact & {Phone} & & Break from&to \\* \hline
B\"uro & 71073 & 707 62 & 12:30 & 13:00 \\*
Dimitri & 20573 & 070 37 10 & & \\*
Dimitri & 2060 & 00 57 71 71 & & \\*
Herbert & 2073 & 272 25 75 & 00:00 & 00:30 \\*
Herbert & 2073 & 272 25 75 & 00:00 & 00:30 \\*
Alma & 20516 & 655 12 30 & 12:30 & 13:00 \\*
Johannes & 20520 & 700 37 00 & 15:00 & 15:10 \\*
Georg & 2060 & 706 10 60 & & \\* [1cm]
\multicolumn{5}{@{}l}{\textbf{Business Gottfried \& Shirin}} Operating times (00:00)07:00 - 16:30\\ \hline
Contact & {Phone} & & Break from&to \\* \hline
Shirin & 20523 & 370 70 00 & 00:00 & 00:20 \\*
Jessy & 2077 & 076 55 22 & 12:00 & 12:30 \\*
Leo & 2077 & 525 03 71 & 15:00 & 15:30\\* [1cm]
\multicolumn{5}{@{}l}{\textbf{Business Jorge}} Operating times 07:30 - 16:30\\ \hline
Contact & {Phone} & & Break from&to \\* \hline
Jorge & 2072 & 263 30 26 & 12:00 & 13:00 \\*
Gabi & 20525 & 733 76 75 & 12:00 & 13:00 \\*
Quintus & 2070 & 013 07 23 & 12:00 & 13:00 \\*
Sokrates & 20522 & 730 50 30 & 12:00 & 13:00 \\* [1cm]
\multicolumn{5}{@{}l}{\textbf{Business Herbert}} Operating times (00:00)07:00 - 16:30\\ \hline
Contact & {Phone} & & Break from&to \\* \hline
B\"uro & 71073 & 707 62 & 12:30 & 13:00 \\*
Dimitri & 20573 & 070 37 10 & & \\*
Dimitri & 2060 & 00 57 71 71 & & \\*
Herbert & 2073 & 272 25 75 & 00:00 & 00:30 \\*
Alma & 20516 & 655 12 30 & 12:30 & 13:00 \\*
Johannes & 20520 & 700 37 00 & 15:00 & 15:10 \\*
Johannes & 20520 & 700 37 00 & 15:00 & 15:10 \\*
Georg & 2060 & 706 10 60 & & \\* [1cm]
\multicolumn{5}{@{}l}{\textbf{Business Gottfried \& Shirin}} Operating times (00:00)07:00 - 16:30\\ \hline
Contact & {Phone} & & Break from&to \\* \hline
Shirin & 20523 & 370 70 00 & 00:00 & 00:20 \\*
Jessy & 2077 & 076 55 22 & 12:00 & 12:30 \\*
Leo & 2077 & 525 03 71 & 15:00 & 15:30\\* [1cm]
\multicolumn{5}{@{}l}{\textbf{Business Jorge}} Operating times 07:30 - 16:30\\ \hline
Contact & {Phone} & & Break from&to \\* \hline
Jorge & 2072 & 263 30 26 & 12:00 & 13:00 \\*
Gabi & 20525 & 733 76 75 & 12:00 & 13:00 \\*
Quintus & 2070 & 013 07 23 & 12:00 & 13:00 \\*
Sokrates & 20522 & 730 50 30 & 12:00 & 13:00 \\* [1cm]
\multicolumn{3}{@{}l}{\textbf{Pascal} \Smiley} Operating times& & \\ \hline
Contact & {Phone} & & Break from&to \\* \hline
Pascal & 2072 & 730 05 75 & & \\* [1cm]
\multicolumn{3}{@{}l}{\textbf{Pascal} \Smiley} Operating times& & \\ \hline
Contact & {Phone} & & Break from&to \\* \hline
Pascal & 2072 & 730 05 75 & & \\* [1cm]
\end{longtable}
\end{document}
答案1
根据您的评论,我已在宏中进行了构建。另外还更正了、、\nobreakhline
的设置\\
\\*
\\* \nobreakhline
。现在它起作用了!非常感谢在这里分享知识的每个人。
代码:
\documentclass[a4paper]{article}
\usepackage[top=1.0cm,right=1cm,left=1cm,bottom=1cm,headheight=50pt,includeheadfoot,headsep=20pt,]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{longtable}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{lastpage}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\fancyhf{} % clears all fields
\fancyfoot[C]{\thepage\ of \pageref{LastPage}}
\definecolor{ctaggreen}{HTML}{330066}
\setlength\headheight{57pt} % to prevent warning of fancyhdr
\cfoot{\colorbox{ctaggreen}{\parbox[b][0.20cm][c]{1.0cm}{\centering\textcolor{white}{\sffamily\bfseries \thepage\ of \pageref{LastPage}}}}}
\lhead{\raisebox{-2mm}{\makebox[0pt]{\hspace*{6.005cm}\includegraphics[height=2cm]{testlogo.png}}}}
\rhead{\raisebox{-2mm}{\makebox[0pt]{\hspace*{-6.005cm}\includegraphics[height=2cm]{testlogo.png}}}}
\chead{\raisebox{3mm}{\colorbox{ctaggreen}{\parbox[b][1.00cm][c]{6.0cm}{\large\centering\textcolor{black}{\sffamily \bfseries{Phone list} \\ [-0.20cm] \footnotesize{voor Medewerkers}%
}%end parbox
}%raisebox
}%endcolorbox
}% end chead
}% end of ???. without: error paragraph ended before ychead...
\usepackage{marvosym}
%%%
\makeatletter
\def\nobreakhline{%
\noalign{\ifnum0=`}\fi
\penalty\@M
\futurelet\@let@token\LT@@nobreakhline}
\def\LT@@nobreakhline{%
\ifx\@let@token\hline
\global\let\@gtempa\@gobble
\gdef\LT@sep{\penalty\@M\vskip\doublerulesep}% <-- change here
\else
\global\let\@gtempa\@empty
\gdef\LT@sep{\penalty\@M\vskip-\arrayrulewidth}% <-- change here
\fi
\ifnum0=`{\fi}%
\multispan\LT@cols
\unskip\leaders\hrule\@height\arrayrulewidth\hfill\cr
\noalign{\LT@sep}%
\multispan\LT@cols
\unskip\leaders\hrule\@height\arrayrulewidth\hfill\cr
\noalign{\penalty\@M}%
\@gtempa}
\makeatother
%%%
\begin{document}
\Large %quick and dirty
\sffamily
\setlength{\tabcolsep}{10pt}
\begin{longtable}[]{ll@{}lr@{ - }l}%
\endfirsthead
\endhead
\multicolumn{5}{c}{\textit{next page continues}} \\
\endfoot
\hline\hline % two horiz. lines at the end of table
\endlastfoot
%%%%%%%%%%%%%%%%%%%%
%first tab row
%
% Headline
\multicolumn{5}{@{}l}{\textbf{Business Herbert}} Operating times (00:00)07:00 - 16:30\\* \nobreakhline
% Column desc
Contact & {Phone} & & Break from&to \\* \nobreakhline
% Rows
B\"uro & 71073 & 707 62 & 12:30 & 13:00 \\*
Dimitri & 20573 & 070 37 10 & & \\*
Dimitri & 2060 & 00 57 71 71 & & \\*
Herbert & 2073 & 272 25 75 & 00:00 & 00:30 \\*
Alma & 20516 & 655 12 30 & 12:30 & 13:00 \\*
Johannes & 20520 & 700 37 00 & 15:00 & 15:10 \\*
Georg & 2060 & 706 10 60 & & \\[1cm]
\multicolumn{5}{@{}l}{\textbf{Business Gottfried \& Shirin}} Operating times (00:00)07:00 - 16:30\\* \nobreakhline% Column desc
Contact & {Phone} & & Break from&to \\* \nobreakhline
Shirin & 20523 & 370 70 00 & 00:00 & 00:20 \\*
Jessy & 2077 & 076 55 22 & 12:00 & 12:30 \\*
Leo & 2077 & 525 03 71 & 15:00 & 15:30\\[1cm]
\multicolumn{5}{@{}l}{\textbf{Business Jorge}} Operating times 07:30 - 16:30\\* \nobreakhline
Contact & {Phone} & & Break from&to \\* \nobreakhline
Jorge & 2072 & 263 30 26 & 12:00 & 13:00 \\*
Gabi & 20525 & 733 76 75 & 12:00 & 13:00 \\*
Quintus & 2070 & 013 07 23 & 12:00 & 13:00 \\*
Sokrates & 20522 & 730 50 30 & 12:00 & 13:00 \\[1cm]
\multicolumn{3}{@{}l}{\textbf{Pascal} \Smiley} Operating times& & \\* \nobreakhline
Contact & {Phone} & & Break from&to \\* \nobreakhline
Pascal & 2072 & 730 05 75 & & \\*
Pascal & 2072 & 730 05 75 & & \\ [1cm] %
\multicolumn{5}{@{}l}{\textbf{Business Herbert}} Operating times (00:00)07:00 - 16:30\\* \nobreakhline
Contact & {Phone} & & Break from&to \\* \nobreakhline
B\"uro & 71073 & 707 62 & 12:30 & 13:00 \\*
Dimitri & 20573 & 070 37 10 & & \\*
Dimitri & 2060 & 00 57 71 71 & & \\*
Herbert & 2073 & 272 25 75 & 00:00 & 00:30 \\*
Herbert & 2073 & 272 25 75 & 00:00 & 00:30 \\*
Alma & 20516 & 655 12 30 & 12:30 & 13:00 \\*
Johannes & 20520 & 700 37 00 & 15:00 & 15:10 \\*
Georg & 2060 & 706 10 60 & & \\[1cm]
\multicolumn{5}{@{}l}{\textbf{Business Gottfried \& Shirin}} Operating times (00:00)07:00 - 16:30\\* \nobreakhline
Contact & {Phone} & & Break from&to \\*\nobreakhline
Shirin & 20523 & 370 70 00 & 00:00 & 00:20 \\*
Jessy & 2077 & 076 55 22 & 12:00 & 12:30 \\*
Leo & 2077 & 525 03 71 & 15:00 & 15:30\\[1cm]
\multicolumn{5}{@{}l}{\textbf{Business Jorge}} Operating times 07:30 - 16:30\\* \nobreakhline
Contact & {Phone} & & Break from&to \\* \nobreakhline
Jorge & 2072 & 263 30 26 & 12:00 & 13:00 \\*
Gabi & 20525 & 733 76 75 & 12:00 & 13:00 \\*
Quintus & 2070 & 013 07 23 & 12:00 & 13:00 \\*
Sokrates & 20522 & 730 50 30 & 12:00 & 13:00 \\[1cm]
\multicolumn{5}{@{}l}{\textbf{Business Herbert}} Operating times (00:00)07:00 - 16:30\\* \nobreakhline
Contact & {Phone} & & Break from&to \\* \nobreakhline
B\"uro & 71073 & 707 62 & 12:30 & 13:00 \\*
Dimitri & 20573 & 070 37 10 & & \\*
Dimitri & 2060 & 00 57 71 71 & & \\*
Herbert & 2073 & 272 25 75 & 00:00 & 00:30 \\*
Alma & 20516 & 655 12 30 & 12:30 & 13:00 \\*
Johannes & 20520 & 700 37 00 & 15:00 & 15:10 \\*
Johannes & 20520 & 700 37 00 & 15:00 & 15:10 \\*
Georg & 2060 & 706 10 60 & & \\[1cm]
\multicolumn{5}{@{}l}{\textbf{Business Gottfried \& Shirin}} Operating times (00:00)07:00 - 16:30\\* \nobreakhline
Contact & {Phone} & & Break from&to \\* \nobreakhline
Shirin & 20523 & 370 70 00 & 00:00 & 00:20 \\*
Jessy & 2077 & 076 55 22 & 12:00 & 12:30 \\*
Leo & 2077 & 525 03 71 & 15:00 & 15:30\\[1cm]
\multicolumn{5}{@{}l}{\textbf{Business Jorge}} Operating times 07:30 - 16:30\\* \nobreakhline
Contact & {Phone} & & Break from&to \\* \nobreakhline
Jorge & 2072 & 263 30 26 & 12:00 & 13:00 \\*
Gabi & 20525 & 733 76 75 & 12:00 & 13:00 \\*
Quintus & 2070 & 013 07 23 & 12:00 & 13:00 \\*
Sokrates & 20522 & 730 50 30 & 12:00 & 13:00 \\[1cm]
\multicolumn{3}{@{}l}{\textbf{Pascal} \Smiley} Operating times& & \\* \nobreakhline
Contact & {Phone} & & Break from&to \\* \nobreakhline
Pascal & 2072 & 730 05 75 & & \\[1cm]
\multicolumn{3}{@{}l}{\textbf{Pascal} \Smiley} Operating times& & \\* \nobreakhline
Contact & {Phone} & & Break from&to \\* \nobreakhline
Pascal & 2072 & 730 05 75 & & \\[1cm]
\end{longtable}
\end{document}
使用 pdflatex 输出: