我认为这是一个重复,但我在这里或文档中都找不到这个精确的问题。
我正在使用它supertabular
来创建一个跨越多页的长表,其\midrule
位于表头之后和\hline
每行之后。
不幸的是,在第二页上,显示了 和\midrule
(\hline
见下图),而我希望\midrule
那里只有 ,也就是说,我想“跳过”这个特定的\hline
。这可能吗?
梅威瑟:
\documentclass{memoir}
\usepackage{supertabular}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{forloop}
\begin{document}
\renewcommand{\arraystretch}{1.3}
\centering
\tablefirsthead{\toprule Row Counter & Random Header \\ \arrayrulecolor{black} \midrule \arrayrulecolor{lightgray}}
\tablehead{Row Counter & Random Header \\ \arrayrulecolor{black} \midrule \arrayrulecolor{lightgray}}
\tabletail{ \\ \arrayrulecolor{black} \bottomrule \arrayrulecolor{lightgray} \multicolumn{2}{l}{\small \textit{Random tail text.}}\\}
\tablelasttail{\\ \arrayrulecolor{black} \bottomrule}
\bottomcaption{Random caption text.}
\newcounter{rowcounter}
\begin{supertabular}{p{3cm}|p{9cm}}
\forloop{rowcounter}{0}{\value{rowcounter} < 70}{line \arabic{rowcounter} & random text \\ \hline }
last line & random text
\end{supertabular}
\end{document}
答案1
您可以使用 David Carlisle 的答案中的代码https://tex.stackexchange.com/a/52042/15925如下
\documentclass{memoir}
\usepackage{supertabular}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{forloop}
\makeatletter
\let\savedST@cr\ST@cr
\def\ST@cr{\noalign{\ifnum0=`}\fi\futurelet\st@temp\ST@crhline}
\def\ST@crhline{%
\ifx\st@temp\hline
\global\let\next@a\hline
\global\let\next@b\@gobble
\else
\global\let\next@a\@gobble
\global\let\next@b\@empty
\fi
\ifnum0=`{\fi}%
\next@a
\savedST@cr
\next@b}
\makeatother
\begin{document}
\renewcommand{\arraystretch}{1.3}
\centering
\tablefirsthead{\toprule Row Counter & Random Header \\
\arrayrulecolor{black} \midrule \arrayrulecolor{lightgray}}
\tablehead{Row Counter & Random Header \\
\arrayrulecolor{black} \midrule \arrayrulecolor{lightgray}}
\makeatletter
\tabletail{\arrayrulecolor{black}
\noalign{\ifnum0=`}\fi\@BTrule[\heavyrulewidth]
\arrayrulecolor{lightgray} \multicolumn{2}{l}{\small \textit{Random
tail text.}}\\}
\makeatother
\tablelasttail{ \\ \arrayrulecolor{black} \bottomrule}
\bottomcaption{Random caption text.}
\newcounter{rowcounter}
\begin{supertabular}{p{3cm}|p{9cm}}
\forloop{rowcounter}{0}{\value{rowcounter} < 70}{line
\arabic{rowcounter} & random text \\ \hline } last line & random
text
\end{supertabular}
\end{document}
注意尾部的定义 - 这是一个\bottomrule
没有分离的。或者,你可以设置\arrayrulesep
为0pt
贯穿始终。