I have a pretty simple LaTeX document:
\documentclass{article}
\usepackage{booktabs}
\usepackage{array}
\usepackage{fancyhdr}
\usepackage[us,12hr]{datetime}
\usepackage{lastpage}
\pagestyle{fancy}
\fancyhf{}
\setlength\headheight{0.5pt}
\chead{\textbf{\huge{Hello}}}
\lhead{\textbf{Left}}
\rhead{\textbf{Right}}
\rfoot{\today \hspace{0.5pt} \currenttime}
\cfoot{Page \thepage\ of \pageref{LastPage}}
\lfoot{Lower Left}
\renewcommand{\headrulewidth}{1pt}
\usepackage{supertabular}
\newcommand{\SpecialText}{Hello\ldots}
\newcommand{\testIt}{The value of \texttt{SpecialText} is : "\SpecialText''.}
\begin{document}
\tablehead
{
\toprule
& \multicolumn{1}{p{24.5mm}}{\textbf{Gross Volume}}
& \multicolumn{1}{p{21mm}}{\textbf{Net Volume}}
& \multicolumn{1}{p{12mm}}{\textbf{Level}}
& \multicolumn{1}{p{21mm}}{\textbf{Temperature}}
& \multicolumn{1}{p{16mm}}{\centering{\textbf{Ullage}}}
& \multicolumn{1}{p{42mm}}{\centering{\textbf{Last Updated}}}\\
& \multicolumn{1}{p{24.5mm}}{\centering{\textbf{Gallons}}}
& \multicolumn{1}{p{21mm}}{\centering{\textbf{Gallons}}}
& \multicolumn{1}{p{12mm}}{\textbf{inches}}
& \multicolumn{1}{p{21mm}}{\centering{\textbf{Farenheit}}}
& \multicolumn{1}{p{16mm}}{\centering{\textbf{Gallons}}} & \\
\toprule
\multicolumn{6}{l}{\testIt}\\\\
}
\begin{supertabular}{p{35mm}*{6}{r}}
\renewcommand{\SpecialText}{New Text\textit{was}\ldots}
\\ \multicolumn{7}{l}{\textbf {Set 1}}\\\\
\textbf{Subset 1} & \multicolumn{6}{l}{Red}\\
Element 1& \multicolumn{6}{l}{(Disjoint)}\\
\multicolumn{1}{r}{\textbf{Results}} & 3797.08 & 3780.49 & 38.85 & 66.21 & 5721.31 & 4/8/2012 9:00:21AM \\
\multicolumn{1}{r}{\textbf{State}} & 7.24 & & 0.54 & & & \\\\
\toprule[2pt]\\
\end{supertabular}
\end{document}
I am trying to dynamically change the content on the \tablehead, so that at the beginning of each page the text is different. I tried \renewcommand but it did not work.
Any help will be great.
In the following example, the article has been expanded to the second page. The heading remains the same, however the renew command is ignored, since on the second page, the upper right text should be changed from:
The Value of SpecialText is: "Original Text".
to:
The Value of SpecialText is: "New Text".
Any comments are welcome.
\documentclass{report}
\usepackage[letterpaper,top=2.0cm,bottom=2.0cm,left=0.5cm,right=0.5cm]{geometry}
\usepackage{booktabs}
\usepackage{array}
\usepackage{fancyhdr}
\usepackage[us,12hr]{datetime}
\usepackage{lastpage}
\pagestyle{fancy}
\fancyhf{}
\setlength\headheight{0.5pt}
\chead{\textbf{\huge{Hello}}}
\lhead{\textbf{Left}}
\rhead{\textbf{Right}}
\rfoot{\today \hspace{0.5pt} \currenttime}
\cfoot{Page \thepage\ of \pageref{LastPage}}
\lfoot{Lower Left}
\renewcommand{\headrulewidth}{1pt}
\usepackage{supertabular}
\newcommand{\SpecialText}{Original Text}
\newcommand{\testIt}{The value of \texttt{SpecialText} is : "\SpecialText''.} \begin{document}
\tablehead
{
\toprule &
\multicolumn{1}{p{17mm}}{\textbf{Column 1}} &
\multicolumn{1}{p{17mm}}{\textbf{Column 2}} &
\multicolumn{1}{p{17mm}}{\textbf{Column 3}} &
\multicolumn{1}{p{17mm}}{\textbf{Column 4}} &
\multicolumn{1}{p{17mm}}{\centering{\textbf{Column 5}}} &
\multicolumn{1}{p{17mm}}{\centering{\textbf{Column 6}}}\\
& \multicolumn{1}{p{24.5mm}}{\centering{\textbf{Column 1}}} &
\multicolumn{1}{p{21mm}}{\centering{\textbf{Column 2}}} &
\multicolumn{1}{p{12mm}}{\textbf{Column 3}} &
\multicolumn{1}{p{21mm}}{\centering{\textbf{SubColumn 4}}} &
\multicolumn{1}{p{16mm}}{\centering{\textbf{SubColumn 5}}} & \\
\toprule
\multicolumn{6}{l}{\testIt}\\\\
}
\begin{supertabular}{p{35mm}*{6}{r}}
\renewcommand{\SpecialText}{New Text}
\\
\multicolumn{7}{l}{\textbf {Set 1}}\\\\
\textbf{Subset 1} & \multicolumn{6}{l}{Red}\\
Element 1 & \multicolumn{6}{l}{(Disjoint)}\\
\multicolumn{1}{r}{\textbf{Results}} & 3797.08 & 3780.49 & 38.85 & 66.21 & 5721.31 & 4/8/2012 9:00:21AM \\
\multicolumn{1}{r}{\textbf{State}} & 7.24 & & 0.54 & & & \\\\
\\
\multicolumn{7}{l}{\textbf {Set 1}}\\\\
\textbf{Subset 1} & \multicolumn{6}{l}{Red}\\
Element 1 & \multicolumn{6}{l}{(Disjoint)}\\
\multicolumn{1}{r}{\textbf{Results}} & 3797.08 & 3780.49 & 38.85 & 66.21 & 5721.31 & 4/8/2012 9:00:21AM \\
\multicolumn{1}{r}{\textbf{State}} & 7.24 & & 0.54 & & & \\\\
\\
\multicolumn{7}{l}{\textbf {Set 1}}\\\\
\textbf{Subset 1} & \multicolumn{6}{l}{Red}\\
Element 1 & \multicolumn{6}{l}{(Disjoint)}\\
\multicolumn{1}{r}{\textbf{Results}} & 3797.08 & 3780.49 & 38.85 & 66.21 & 5721.31 & 4/8/2012 9:00:21AM \\
\multicolumn{1}{r}{\textbf{State}} & 7.24 & & 0.54 & & & \\\\
\\
\multicolumn{7}{l}{\textbf {Set 1}}\\\\
\textbf{Subset 1} & \multicolumn{6}{l}{Red}\\
Element 1 & \multicolumn{6}{l}{(Disjoint)}\\
\multicolumn{1}{r}{\textbf{Results}} & 3797.08 & 3780.49 & 38.85 & 66.21 & 5721.31 & 4/8/2012 9:00:21AM \\
\multicolumn{1}{r}{\textbf{State}} & 7.24 & & 0.54 & & & \\\\
\\
\multicolumn{7}{l}{\textbf {Set 1}}\\\\
\textbf{Subset 1} & \multicolumn{6}{l}{Red}\\
Element 1 & \multicolumn{6}{l}{(Disjoint)}\\
\multicolumn{1}{r}{\textbf{Results}} & 3797.08 & 3780.49 & 38.85 & 66.21 & 5721.31 & 4/8/2012 9:00:21AM \\
\multicolumn{1}{r}{\textbf{State}} & 7.24 & & 0.54 & & & \\\\
\\
\multicolumn{7}{l}{\textbf {Set 1}}\\\\
\textbf{Subset 1} & \multicolumn{6}{l}{Red}\\
Element 1 & \multicolumn{6}{l}{(Disjoint)}\\
\multicolumn{1}{r}{\textbf{Results}} & 3797.08 & 3780.49 & 38.85 & 66.21 & 5721.31 & 4/8/2012 9:00:21AM \\
\multicolumn{1}{r}{\textbf{State}} & 7.24 & & 0.54 & & & \\\\
\\
\renewcommand{\SpecialText}{New Text}\\
\multicolumn{7}{l}{\textbf {Set 1}}\\\\
\textbf{Subset 1} & \multicolumn{6}{l}{Red}\\
Element 1 & \multicolumn{6}{l}{(Disjoint)}\\
\multicolumn{1}{r}{\textbf{Results}} & 3797.08 & 3780.49 & 38.85 & 66.21 & 5721.31 & 4/8/2012 9:00:21AM \\
\multicolumn{1}{r}{\textbf{State}} & 7.24 & & 0.54 & & & \\\\
\toprule[2pt]\\
\end{supertabular}
\end{document}
