tabularx 标题中的页码

tabularx 标题中的页码

我正在尝试让页码显示在tabularx表格跨越的每一页的页眉中。

我遇到的问题是,标题和表格同时创建,它们都显示相同的页码。

有没有办法让页码显示为页眉的一部分tabularx

梅威瑟:

\documentclass{article}

\usepackage{hyperref}
\usepackage{booktabs}
\usepackage{ltxtable} 
\usepackage{ltablex}
\usepackage{multirow}
\usepackage{array}
\usepackage{boldline}

\begin{document}

\newcounter{TableStartTableCounter}
\newcounter{TableEndTableCounter}
\setcounter{TableStartTableCounter}{\getpagerefnumber{TableStartTable}}
\setcounter{TableEndTableCounter}{\getpagerefnumber{TableEndTable}}

\begin{tabularx}{40pc}{X|X}
    \caption{Table 1 - Page \the\numexpr\value{page}} \\ \hline
    \nopagebreak \textbf{Header 1} & \textbf{Header 2} \\ \hline \endfirsthead
    \caption{Table 1 - Page \the\numexpr\value{page}} \\ \hline
    \nopagebreak \textbf{Header 1} & \textbf{Header 2} \\ \hline \endhead
    \label{TableStartTable} Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \\ \hline
    Content & Content \label{TableEndTable} \\ \hline
\end{tabularx}

\end{document}

这样就得到了以下两个页面:

在此处输入图片描述 在此处输入图片描述

对于第二张图片,我希望它显示“表格 1 - 第 2 页”。

答案1

您正在使用ltxtable,这意味着tabularx实际上是longtablelongtable表头和表尾设置在表格开头的框中,因此如果不对包进行大量更改,就无法使它们具有不同的文本。

相关内容