我有一个跨多页的单个表格,当我在页面最后一行末尾使用 \cline 时,该行仅出现在页面末尾,而不会出现在表格第一行的新页面开头。
使用 \hline 我得到了想要的效果,但是线穿过了所有列。
我举个例子:
有什么建议吗?
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{ltablex}
\usepackage[table]{xcolor}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}m{3cm}}
\newcolumntype{K}{>{\RaggedRight\arraybackslash \columncolor{blue!10}}m{3cm}}
\usepackage{ragged2e}
%\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\begin{document}
\begin{tabularx}{\textwidth}{|>{\hsize=0.8333\hsize}K|
>{\hsize=0.4167\hsize}L|
>{\hsize=1.0000\hsize}L|
>{\hsize=0.8333\hsize}L|}
\hline
\rowcolor{gray!50}\textbf{a} & \textbf{b} & \textbf{c} & \textbf{d}\\
\rowcolor{lightgray} & & & \\
\rowcolor{lightgray} & & & \\
\hline
& & & \\
\textbf{Bla bla bla}\par
\emph{jjjjj}
& r & Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse ut elit ac ipsum placerat scelerisque eget id justo. Ut cursus viverra neque, in porta justo facilisis sit amet. Donec vitae libero a diam lobortis ultrices. Vestibulum metus urna, pharetra et cursus quis, eleifend ut dui. Phasellus pellentesque, quam et hendrerit. & d \\
& & & \\
\cline{2-4}
& r& Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse ut elit ac ipsum placerat scelerisque eget id justo. hendrerit. & k
\\
& & &
\\
\cline{2-4}
& g & Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse ut elit ac ipsum placerat scelerisque eget id justo. Ut cursus viverra neque, in porta justo facilisis sit amet. Donec vitae libero a diam lobortis ultrices. Vestibulum metus urna, pharetra et cursus quis, eleifend ut dui. Phasellus pellentesque, quam et hendrerit. & p
\\
\hline
\end{tabularx}
\end{document}
答案1
你可以将你想要的内容合并cline{2-4}
到 中\endhead
。我猜你插入了一些空行,以便为单元格内容提供垂直填充。我让填充自动完成。我还使用了(重新定义的)X
列类型来使表格全宽。
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{ltablex}
\keepXColumns
\renewcommand\tabularxcolumn[1]{ >{\arraybackslash}m{#1}}
\usepackage[table]{xcolor}
\usepackage{ragged2e}
\begin{document}
\begin{tabularx}{\textwidth}%
{| >{\hsize=1.1\hsize\columncolor{blue!10}}X|
>{\hsize=0.55\hsize}X|
>{\hsize=1.25\hsize\rule{0pt}{4ex}}X <{\mbox{}\rule[-2.5ex]{0pt}{0pt}}|
>{\hsize=1.1\hsize}X|}
\hline
\rowcolor{gray!50}\textbf{a} & \textbf{b} & \textbf{c} & \textbf{d} \\%
\hline
\endfirsthead
\hline
\endhead
\textbf{Bla bla bla}\par
\emph{jjjjj}
& r & Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse ut elit ac ipsum placerat scelerisque eget id justo. Ut cursus viverra neque, in porta justo facilisis sit amet. Donec vitae libero a diam lobortis ultrices. Vestibulum metus urna, pharetra et cursus quis, eleifend ut dui. Phasellus pellentesque, quam et hendrerit. & d \\
\cline{2-4}
& r & Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse ut elit ac ipsum placerat scelerisque eget id justo. hendrerit. & k
\\
\cline{2-4}
& g & Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse ut elit ac ipsum placerat scelerisque eget id justo. Ut cursus viverra neque, in porta justo facilisis sit amet. Donec vitae libero a diam lobortis ultrices. Vestibulum metus urna, pharetra et cursus quis, eleifend ut dui. Phasellus pellentesque, quam et hendrerit. & p
\\
\hline
\end{tabularx}
\end{document}