Im trying to have automatic rownumbers on a multi-page table reset on a page-break. So far I got this, but I dont know, why the counter does not reset:
\documentclass{article}
\usepackage{lipsum,ltablex}
\newcounter{rownumber}
\begin{document}
\begin{tabularx}{\textwidth}{|>{\stepcounter{rownumber}\arabic{rownumber}}c|X|}
\hline
\multicolumn{1}{|c|}{Rownumber\setcounter{rownumber}{0}}&Data\\\hline
\endhead
&Ok\newline\lipsum[1]\\\hline
&Ok\newline\lipsum[2]\\\hline
&Ok\newline\lipsum[3]\\\hline
&Ok\\\hline
&Ok\\\hline
&Should be 1\\\hline
&Should be 2\\\hline
&\ldots\\\hline
\end{tabularx}
\end{document}
tabularxas you have there, the entire table, has been set before any page breaking happens. – David Carlisle Dec 09 '14 at 22:27