Given this approach: How to Repeat Cell Content on Next Page for \longtable using \multirow
What if I wanted to slightly "modify" the text that is repeating so that on the originating page I want to add something like "Continued on next page" below it in tiny script, then on the following subsequent pages, add "Continued from previous page" below it in tiny script.. How would I do that?
Thanks in advance!
Edited to add: I apologize, but it looks like I left out some key details here. Basically, I have two files involved - there's a TeX style sheet file, which contains the macro as follows:
\def\mytablebegin{
\begin{longtable}[c]{|>{\centering\bfseries\tablefontsize}p{0.15\fourtabwid}|>{\centering\bfseries\tablefontsize}p{0.15\fourtabwid}|>{\tablefontsize}p{0.35\fourtabwid}|>{\tablefontsize\arraybackslash}p{0.35\fourtabwid}|}
\hline
\multicolumn{4}{|>{\color{white}\columncolor{color2}}c|}{}\\[-2ex]
\multicolumn{4}{|>{\color{white}\columncolor{color2}}c|}{\textbf{\large TABLE HEADER}}\\\hline
%\rowcolor{color3}
\textbf{COLUMN1} &
\textbf{COLUMN2} &
\normfig \hfill\parbox[c]{0.35\fourtabwid - 4em}{\textbf{COLUMN3}} &
\caufig \hfill\parbox[c]{0.35\fourtabwid - 4em}{\textbf{COLUMN4}}\\\hline
\endhead
\hline
\endfoot
\endlastfoot
}
\def\mytableend{
\end{longtable}
}
\usepackage{zref-abspage}
% Counter `topic@label' for automatic generation of label names
\makeatletter
\newcounter{topic@label}
\renewcommand*{\thetopic@label}{topic@\the\value{topic@label}}
% \topic@previous: Macro for remembering the previous topic
\global\let\topic@previous\relax
\global\let\lasttopic\relax
\newcommand*{\topic}[1]{%
\begingroup
\def\topic@put{\topicformat{#1}}%
% Remember label name of previous topic
\edef\topic@previouslabel{\thetopic@label}%
% Set label to remember the page position
\stepcounter{topic@label}%
\zref@labelbyprops{\thetopic@label}{abspage}%
% Compare topic with previous topic
\def\topic@current{#1}%
\ifx\topic@current\topic@previous
% Check, whether is the previous topic with same name is
% on the same page.
\zifrefundefined{\topic@previouslabel}{%
\topic@put
}{%
\zifrefundefined{\thetopic@label}{%
\topic@put
}{%
\ifnum\zref@extractdefault{\topic@previouslabel}{abspage}{0}=%
\zref@extractdefault{\thetopic@label}{abspage}\relax
\else
\topic@put
\fi
}%
}%
\else
% New topic is always set
\topic@put
\fi
% Remember this topic as previous topic for next topic
\global\let\topic@previous\topic@current
\endgroup
\gdef\lasttopic{\topic{#1}}%
}
% Macro \topicformat formats the topic
\newcommand*{\topicformat}[1]{#1}
\makeatother
And then the actual TeX template file, which contains the table rendering code as follows:
\newpage
\mytablebegin
\topic{\footnotesize TOPIC1} & \footnotesize SUBTOPIC1 & \footnotesize SUBLIST1 \nl SUBLIST2 & \footnotesize SUBLIST1 \nl SUBLIST2 \\\cline{2-4}
\lasttopic & \footnotesize SUBTOPIC2 & \footnotesize SUBLIST1 & \footnotesize SUBLIST1 \nl SUBLIST2\\\cline{2-4}
\lasttopic & \footnotesize SUBTOPIC3 & \footnotesize SUBLIST1 & \footnotesize SUBLIST1 \nl SUBLIST2\\\cline{2-4}
\lasttopic & \footnotesize SUBTOPIC4 & \footnotesize SUBLIST1 & \footnotesize SUBLIST1 \nl SUBLIST2\\\cline{2-4}
\lasttopic & \footnotesize SUBTOPIC5 & \footnotesize SUBLIST1 & \footnotesize SUBLIST1 \nl SUBLIST2\\\cline{2-4}
\lasttopic & \footnotesize SUBTOPIC6 & \footnotesize SUBLIST1 & \footnotesize SUBLIST1 \nl SUBLIST2\\\cline{2-4}
\lasttopic & \footnotesize SUBTOPIC7 & \footnotesize SUBLIST1 & \footnotesize SUBLIST1 \nl SUBLIST2\\\hline
\topic{\footnotesize TOPIC2} & \footnotesize SUBTOPIC1 & \footnotesize SUBLIST1 \nl SUBLIST2 & \footnotesize \\\hline
\topic{\footnotesize TOPIC3} & \footnotesize SUBTOPIC1 & \footnotesize SUBLIST1 \nl SUBLIST2 & \footnotesize \\\hline
\topic{\footnotesize TOPIC4} & \footnotesize SUBTOPIC1 & \footnotesize SUBLIST1 \nl SUBLIST2 & \footnotesize \\\hline
\topic{\footnotesize TOPIC5} & \footnotesize SUBTOPIC1 & \footnotesize SUBLIST1 \nl SUBLIST2 & \footnotesize \\\hline
\topic{\footnotesize TOPIC6} & \footnotesize SUBTOPIC1 & \footnotesize SUBLIST1 \nl SUBLIST2 & \footnotesize SUBLIST1 \nl SUBLIST2 \\\cline{2-4}
\lasttopic & \footnotesize SUBTOPIC2 & \footnotesize SUBLIST1 & \footnotesize SUBLIST1 \nl SUBLIST2\\\cline{2-4}
\lasttopic & \footnotesize SUBTOPIC3 & \footnotesize SUBLIST1 & \footnotesize SUBLIST1 \nl SUBLIST2\\\hline
\topic{\footnotesize TOPIC7} & \footnotesize SUBTOPIC1 & \footnotesize SUBLIST1 \nl SUBLIST2 & \footnotesize SUBLIST1 \nl SUBLIST2 \\\cline{2-4}
\lasttopic & \footnotesize SUBTOPIC2 & \footnotesize SUBLIST1 & \footnotesize SUBLIST1 \nl SUBLIST2\\\cline{2-4}
\lasttopic & \footnotesize SUBTOPIC3 & \footnotesize SUBLIST1 & \footnotesize SUBLIST1 \nl SUBLIST2\\\hline
\lasttopic & \footnotesize SUBTOPIC4 & \footnotesize SUBLIST1 & \footnotesize SUBLIST1 \nl SUBLIST2\\\cline{2-4}
\lasttopic & \footnotesize SUBTOPIC5 & \footnotesize SUBLIST1 & \footnotesize SUBLIST1 \nl SUBLIST2\\\cline{2-4}
\lasttopic & \footnotesize SUBTOPIC6 & \footnotesize SUBLIST1 & \footnotesize SUBLIST1 \nl SUBLIST2\\\cline{2-4}
\lasttopic & \footnotesize SUBTOPIC7 & \footnotesize SUBLIST1 & \footnotesize SUBLIST1 \nl SUBLIST2\\\hline
\topic{\footnotesize TOPIC8} & \footnotesize SUBLIST1 & \footnotesize SUBLIST1 \nl SUBLIST2 & \footnotesize \\\hline
\topic{\footnotesize TOPIC9} & \footnotesize SUBLIST1 & \footnotesize SUBLIST1 \nl SUBLIST2 & \footnotesize \\\hline
\topic{\footnotesize TOPIC10} & \footnotesize SUBLIST1 & \footnotesize SUBLIST1 \nl SUBLIST2 & \footnotesize \\\hline
\mytableend
What I'm trying to do here as an example, say TOPIC1 (as it spans across 7 rows) has too much content to fit on the first page, so it starts up again on page 2. What I am trying to make it do is put a little tiny blurb under the actual text "TOPIC1" in \tiny font that reads "Continued on next page" on the first page of the report, and \tiny font that reads "Continued from previous page" below "TOPIC1" on the second page, and every subsequent page that this cell is repeated on.
\documentclass{..}and so on)? – MarcoG Jun 18 '15 at 20:24