标题显示长桌末端有一个丑陋的头像

标题显示长桌末端有一个丑陋的头像

我想在表格末尾添加一个较长的标题,但按照目前的格式,标题与表格的最后一行在页面上不合适。结果是最后一页上的标题相当丑陋;特别是,\hline标题中的重复会产生一条与表格无关的水平线,这相当难看。基本上,我在寻找类似\endlasthead.

示例代码:

\documentclass[landscape]{article}
\usepackage{lmodern}
\usepackage{graphicx, longtable, multirow}

\begin{document}
\begin{longtable}{|c|c|}
\hline
\textbf{Letters} & \textbf{Numbers} \\
\hline \hline
\endfirsthead

\multicolumn{ 2 }{c}
{{\bfseries \tablename\ \thetable{} -- continued from previous page}} 
\\ \hline 
\textbf{Letters} & \textbf{Numbers} \\ 
\hline \hline    
\endhead

\hline \multicolumn{2}{|r|}{{Continued on next page}} \\ \hline
\endfoot
\endlastfoot

A & 1 \\ B & 2 \\ C & 3 \\ D & 4 \\ E & 5 \\ F & 6 \\ G & 7 \\ H & 8 \\ I & 9 \\ J & 10 \\ K & 11 \\ L & 12 \\ M & 13 \\ N & 14 \\ O & 15 \\ P & 16 \\ Q & 17 \\ R & 18 \\ S & 19 \\ T & 20 \\ U & 21 \\ V & 22 \\ W & 23 \\ X & 24 \\ Y & 25 \\ Z & 26 \\

\caption{Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.}
\end{longtable}

\end{document}

这是一个问题有人能够改变第一个脚,所以我猜这应该是可能的。我的 tex fu 无法解析@Heiko Oberdeik 的解决方案,但如果有人能解释如何修改它以达到我的目的,那就行了。

答案1

这里有一个解决方案,即通过实验固定标题的宽度。默认值为\LTcaptionwidth4 英寸,我captionsetup在表格内部使用,就在 之前\caption

我还抑制了垂直线,因为这是一种不好的印刷习惯,并且使用了booktabs

以下是代码:

\documentclass[landscape]{article}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{graphicx, longtable, multirow, array}
\usepackage{caption, booktabs, threeparttablex}
\renewcommand\arraystretch{1.25}
\captionsetup{labelfont = {bf, small}, font = small}

\begin{document}

\noindent\begin{longtable}{@{\,}c@{} c@{}c@{}}
\toprule
\textbf{Letters} &\hspace{1.5em} & \textbf{Numbers} \\
 \cmidrule(l{4pt}r{2pt}){1-1}\cmidrule(l{4pt}r{4pt}){3-3}
\endfirsthead
%
\multicolumn{3}{c}
{{\small\bfseries \tablename\ \thetable}{} -- \footnotesize continued from previous page}
\\ \midrule
\textbf{Letters} & & \textbf{Numbers} \\
 \cmidrule(l{4pt}r{2pt}){1-1}\cmidrule(l{4pt}r{4pt}){3-3}
\endhead
%
 \cmidrule(l{4pt}r{4pt}){1-1}\cmidrule(l{4pt}r{4pt}){3-3}
\multicolumn{3}{r}{\footnotesize Continued on next page}
\endfoot
%
\bottomrule\addlinespace
\captionsetup{width =0.55\LTcapwidth}
\caption{Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.}
\endlastfoot
%
A & & 1 \\ B & & 2 \\ C & & 3 \\ D & & 4 \\ E & & 5 \\ F & & 6 \\ G & & 7 \\ H & & 8 \\ I & & 9 \\ J & & 10 \\ K & & 11 \\ L & & 12 \\ M & & 13 \\ N & & 14 \\ O & & 15 \\ P & & 16 \\ Q & & 17 \\ R & & 18 \\ S & & 19 \\ T & & 20 \\ U & & 21 \\ V & & 22 \\ W & & 23 \\ X & & 24 \\ Y & & 25 \\ Z & & 26
%
\end{longtable}

\end{document} 

在此处输入图片描述

在此处输入图片描述

相关内容