Longtable - 样式延续标题与主标题相同

Longtable - 样式延续标题与主标题相同

我正在使用longtable(通过在线表格生成器),但请注意,延续标题的样式略有不同:

带注释的输出抓取

以下是后续内容:

<code>longtable</code> 续页标题

我已经(在第二次抓取中)删除了一个\bfseries加粗整个延续标题的宏(也不在我的 MWE 中。我尝试使用包装\caption{}器,但这破坏了表格(因为它实际上位于一行宽的表格单元格内)。

我想要修复的问题在以下 MWE 中注明。请注意,MWE 单元格填充/间距比上面的屏幕截图(我的 uni sty doc?)略紧,但延续标题与主标题的垂直间距更近,在两种情况下都是一致的,我假设是内部的longtable。以下是 MWE:

\documentclass{report}
\usepackage{longtable}

%from my uni thisis sty file
\usepackage[centerlast,small,sc]{caption}

\begin{document}

This is a specimen table, note the \texttt{caption} macro sets the table caption in smaller than the body font size. Also the main caption sets `Table` in all caps with the non-initial letters in small caps.
\\

I'd ideally like the same styling in the continuation header, \textit{and} with the same slightly larger vertical space as below the main caption---though I don't know if that comes from the \texttt{caption} macro.

% Note: It may be necessary to compile the document several times to get a multi-page table to line up properly
% Please add the following required packages to your document preamble:
% \usepackage{longtable}
% Note: It may be necessary to compile the document several times to get a multi-page table to line up properly
\begin{longtable}[c]{l|rr}
    \caption{This is a main caption}
    \label{tab:my-tablex}\\
    Category & \multicolumn{1}{c|}{Count} & \multicolumn{1}{c}{\%} \\ \hline
    \endfirsthead
    %
    \multicolumn{3}{c}%
    {{Table \thetable\ (continued from previous page)}} \\
    Category & \multicolumn{1}{c|}{Count} & \multicolumn{1}{c}{\%} \\ \hline
    \endhead
    %
    AA & \multicolumn{1}{r|}{100} & 0.011 \\
    AB & \multicolumn{1}{r|}{104} & 0.012 \\
    AA & \multicolumn{1}{r|}{108} & 0.012 \\
    AB & \multicolumn{1}{r|}{112} & 0.012 \\
    AA & \multicolumn{1}{r|}{116} & 0.013 \\
    AB & \multicolumn{1}{r|}{120} & 0.013 \\
    AA & \multicolumn{1}{r|}{124} & 0.014 \\
    AB & \multicolumn{1}{r|}{128} & 0.014 \\
    AA & \multicolumn{1}{r|}{132} & 0.015 \\
    AB & \multicolumn{1}{r|}{136} & 0.015 \\
    AA & \multicolumn{1}{r|}{140} & 0.016 \\
    AB & \multicolumn{1}{r|}{144} & 0.016 \\
    AA & \multicolumn{1}{r|}{148} & 0.016 \\
    AB & \multicolumn{1}{r|}{152} & 0.017 \\
    AA & \multicolumn{1}{r|}{156} & 0.017 \\
    AB & \multicolumn{1}{r|}{160} & 0.018 \\
    AA & \multicolumn{1}{r|}{164} & 0.018 \\
    AB & \multicolumn{1}{r|}{168} & 0.019 \\
    AA & \multicolumn{1}{r|}{172} & 0.019 \\
    AB & \multicolumn{1}{r|}{176} & 0.020 \\
    AA & \multicolumn{1}{r|}{180} & 0.020 \\
    AB & \multicolumn{1}{r|}{184} & 0.020 \\
    AA & \multicolumn{1}{r|}{188} & 0.021 \\
    AB & \multicolumn{1}{r|}{192} & 0.021 \\
    AA & \multicolumn{1}{r|}{196} & 0.022 \\
    AB & \multicolumn{1}{r|}{200} & 0.022 \\
    AA & \multicolumn{1}{r|}{204} & 0.023 \\
    AB & \multicolumn{1}{r|}{208} & 0.023 \\
    AA & \multicolumn{1}{r|}{212} & 0.023 \\
    AB & \multicolumn{1}{r|}{216} & 0.024 \\
    AA & \multicolumn{1}{r|}{220} & 0.024 \\
    AB & \multicolumn{1}{r|}{224} & 0.025 \\
    AA & \multicolumn{1}{r|}{228} & 0.025 \\
    AB & \multicolumn{1}{r|}{232} & 0.026 \\
    AA & \multicolumn{1}{r|}{236} & 0.026 \\
    AB & \multicolumn{1}{r|}{240} & 0.027 \\
    AA & \multicolumn{1}{r|}{244} & 0.027 \\
    AB & \multicolumn{1}{r|}{248} & 0.027 \\
    AA & \multicolumn{1}{r|}{252} & 0.028 \\
    AB & \multicolumn{1}{r|}{256} & 0.028 \\
    AA & \multicolumn{1}{r|}{260} & 0.029 \\
    AB & \multicolumn{1}{r|}{264} & 0.029 \\
    AA & \multicolumn{1}{r|}{268} & 0.030 \\
    AB & \multicolumn{1}{r|}{272} & 0.030 \\
    AA & \multicolumn{1}{r|}{276} & 0.031 \\
    AB & \multicolumn{1}{r|}{280} & 0.031 \\
    AA & \multicolumn{1}{r|}{284} & 0.031 \\ \hline
    Totals & \multicolumn{1}{r}{ 9,024} & \\
\end{longtable}

\end{document}

答案1

替换延续标题(包括 \multicolumn 在内的所有内容)

\documentclass{report}
\usepackage{longtable}

%from my uni thisis sty file
\usepackage[centerlast,small,sc]{caption}

\begin{document}

This is a specimen table, note the \texttt{caption} macro sets the table caption in smaller than the body font size. Also the main caption sets `Table` in all caps with the non-initial letters in small caps.
\\

I'd ideally like the same styling in the continuation header, \textit{and} with the same slightly larger vertical space as below the main caption---though I don't know if that comes from the \texttt{caption} macro.

% Note: It may be necessary to compile the document several times to get a multi-page table to line up properly
% Please add the following required packages to your document preamble:
% \usepackage{longtable}
% Note: It may be necessary to compile the document several times to get a multi-page table to line up properly
\begin{longtable}[c]{l|rr}
    \caption{This is a main caption}
    \label{tab:my-tablex}\\
    Category & \multicolumn{1}{c|}{Count} & \multicolumn{1}{c}{\%} \\ \hline
    \endfirsthead
    %
   \caption[]{(continued from previous page)}\\
    Category & \multicolumn{1}{c|}{Count} & \multicolumn{1}{c}{\%} \\ \hline
    \endhead
    %
    AA & \multicolumn{1}{r|}{100} & 0.011 \\
    AB & \multicolumn{1}{r|}{104} & 0.012 \\
    AA & \multicolumn{1}{r|}{108} & 0.012 \\
    AB & \multicolumn{1}{r|}{112} & 0.012 \\
    AA & \multicolumn{1}{r|}{116} & 0.013 \\
    AB & \multicolumn{1}{r|}{120} & 0.013 \\
    AA & \multicolumn{1}{r|}{124} & 0.014 \\
    AB & \multicolumn{1}{r|}{128} & 0.014 \\
    AA & \multicolumn{1}{r|}{132} & 0.015 \\
    AB & \multicolumn{1}{r|}{136} & 0.015 \\
    AA & \multicolumn{1}{r|}{140} & 0.016 \\
    AB & \multicolumn{1}{r|}{144} & 0.016 \\
    AA & \multicolumn{1}{r|}{148} & 0.016 \\
    AB & \multicolumn{1}{r|}{152} & 0.017 \\
    AA & \multicolumn{1}{r|}{156} & 0.017 \\
    AB & \multicolumn{1}{r|}{160} & 0.018 \\
    AA & \multicolumn{1}{r|}{164} & 0.018 \\
    AB & \multicolumn{1}{r|}{168} & 0.019 \\
    AA & \multicolumn{1}{r|}{172} & 0.019 \\
    AB & \multicolumn{1}{r|}{176} & 0.020 \\
    AA & \multicolumn{1}{r|}{180} & 0.020 \\
    AB & \multicolumn{1}{r|}{184} & 0.020 \\
    AA & \multicolumn{1}{r|}{188} & 0.021 \\
    AB & \multicolumn{1}{r|}{192} & 0.021 \\
    AA & \multicolumn{1}{r|}{196} & 0.022 \\
    AB & \multicolumn{1}{r|}{200} & 0.022 \\
    AA & \multicolumn{1}{r|}{204} & 0.023 \\
    AB & \multicolumn{1}{r|}{208} & 0.023 \\
    AA & \multicolumn{1}{r|}{212} & 0.023 \\
    AB & \multicolumn{1}{r|}{216} & 0.024 \\
    AA & \multicolumn{1}{r|}{220} & 0.024 \\
    AB & \multicolumn{1}{r|}{224} & 0.025 \\
    AA & \multicolumn{1}{r|}{228} & 0.025 \\
    AB & \multicolumn{1}{r|}{232} & 0.026 \\
    AA & \multicolumn{1}{r|}{236} & 0.026 \\
    AB & \multicolumn{1}{r|}{240} & 0.027 \\
    AA & \multicolumn{1}{r|}{244} & 0.027 \\
    AB & \multicolumn{1}{r|}{248} & 0.027 \\
    AA & \multicolumn{1}{r|}{252} & 0.028 \\
    AB & \multicolumn{1}{r|}{256} & 0.028 \\
    AA & \multicolumn{1}{r|}{260} & 0.029 \\
    AB & \multicolumn{1}{r|}{264} & 0.029 \\
    AA & \multicolumn{1}{r|}{268} & 0.030 \\
    AB & \multicolumn{1}{r|}{272} & 0.030 \\
    AA & \multicolumn{1}{r|}{276} & 0.031 \\
    AB & \multicolumn{1}{r|}{280} & 0.031 \\
    AA & \multicolumn{1}{r|}{284} & 0.031 \\ \hline
    Totals & \multicolumn{1}{r}{ 9,024} & \\
\end{longtable}

\end{document}

在此处输入图片描述

相关内容