![如何枚举 longtable 中的页脚行?](https://linux22.com/image/361572/%E5%A6%82%E4%BD%95%E6%9E%9A%E4%B8%BE%20longtable%20%E4%B8%AD%E7%9A%84%E9%A1%B5%E8%84%9A%E8%A1%8C%EF%BC%9F.png)
简单的解决方案为页脚行提供了错误的数字:(
\documentclass[a4paper,12pt,
russian,
twoside,
% draft
% slashbox
]{extarticle}
\usepackage[a4 paper, portrait,%
tmargin=20mm,%
bmargin=20mm,%
inner=15mm,%
outer=15mm,%
headheight=0mm,headsep=0mm,footskip=10mm]{geometry}
\usepackage{longtable}
\newcounter{LineCNT}
\newcommand{\MYline}[1]{%
\stepcounter{LineCNT}\theLineCNT&& \\ \hline
}
\begin{document}
\begin{longtable}{r|c|c|c}
\hline
It&is&table's&head \\ \hline \hline \endhead
\MYline{} \endfoot
\MYline{Some data}
\MYline{enather data}
\MYline{more info}
\MYline{}
\end{longtable}
\end{document}
发生这种情况的原因很清楚。
但目前还不清楚如何解决这个问题。
答案1
我必须承认,我不明白你想要实现什么。只是自动对表中的行进行编号?而不是以下姆韦可能对你有用:
\documentclass[a5paper]{article}
\usepackage{array, longtable}
\newcounter{LineCNT}
\newcommand{\getCNT}{\refstepcounter{LineCNT}\theLineCNT}
\usepackage{lipsum}
\begin{document}
\begin{longtable}{>{\getCNT}r|c|c|c}
\hline
\multicolumn{1}{r}{It}
& is & table's & head \\
\hline \hline
\endhead
\hline
\multicolumn{4}{r}{\footnotesize\textit{continue on the next page}}
\endfoot
\hline
\endlastfoot
% table body
& Some data & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
& more info & & \\
\end{longtable}
\end{document}