The table I have been tasked with reproducing in LaTeX has a column of child parameters, and to the left of that a column of parents. Since it is organized by parent, the parent is not repeated unless the table breaks. Rows will be variable in height, so I can't just predict where the page will break. Here is an example of what the behavior should be:
---page break---
I've already figured out how to get the left column to 'remember' which parent it should show, by using the collcell
package. I need help determining whether a row is the first non-header row on a new page. My instinct was to define the longtable
\endfirsthead
and \endhead
commands differently, so headings after a page break would set a 'newPage' flag, but all headings are calculated at the beginning of setting a longtable, and aren't recalculated on the fly, as I discovered with the following code:
\documentclass{article}
\usepackage{longtable,array}
\begin{document}
\gdef\newPage{0}
\begin{longtable}{| c%
<{\ifnum\newPage=1%
(continued)\gdef\newPage{0}%
\fi
}%
| c | }
\hline\multicolumn{2}{|c|}{Header}\\\hline\endfirsthead
\hline\multicolumn{2}{|>{\gdef\newPage{1}} c |}{Header}\\\hline\endhead
%\multicolumn{2}{>{\bfseries} c }{Header}\endhead
A & A1\\\hline
& A2\\\hline
& A3\\\hline\newpage
& A4\\\hline
& A5\\\hline
& A6\\\hline
\end{longtable}
\end{document}
---page break---
Because it calculates the second header at the beginning, page 1 gets the (continued) instead of page 2.
I know this wouldn't be an issue if I used the supertabular
package instead of longtable
, but unfortunately elsewhere I have to use the arydshln
package, which is incompatible with supertabular
. I realize this is very similar to question 46205, and to this discussion but I am not yet familiar enough with LaTeX to understand how to go about this.
Since my ultimate goal is to just know when a page break has happened, not necessarily to recalculate the header on-the-fly, maybe there is another way? If not, maybe someone could be so kind as to explain in more detail what commands I would use?