我正在尝试让页码显示在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
实际上是longtable
。 longtable
表头和表尾设置在表格开头的框中,因此如果不对包进行大量更改,就无法使它们具有不同的文本。