[OS X TeX] LastPage Reference

Herbert Schulz herbs at wideopenwest.com
Tue Mar 6 17:14:45 EST 2007


On Mar 6, 2007, at 3:31 PM, Maurino Bautista wrote:

> I copied the following code from Roussanka's posting which works
> properly. I added the lines marked with %%%  and I commented the right
> footer command. I now get the following error:
>
> AED: lastpage setting LastPage
> ! Missing number, treated as zero.
> <to be read again>
>                   \protect
> l.46 \end{document}
>
> Anybody knows what is wrong? All I know is that the package hyperref
> uses (or modifies-redefines-omits?? ) the LastPage reference.
>
> Here is Roussanka's code with the modifications:
>
> ********************************************************************** 
> *************************************************************
>
> \documentclass[12pt]{article}
>
> \usepackage[total={6.5in,9.3in},top=1in, left=1in]{geometry} %%%
>
> \usepackage{lmodern}
> \usepackage[T1]{fontenc}
> \usepackage[latin9]{inputenc}
> \usepackage{textcomp}
>
> \usepackage{url}
> \usepackage[unicode,bookmarks,colorlinks]{hyperref}
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> \usepackage{fancyhdr}
> \pagestyle{fancy}
>
> \usepackage{lastpage} %%%
> \usepackage{ifthen} %%%
>
> \renewcommand{\headrulewidth}{0.4pt}
> \renewcommand{\footrulewidth}{0pt}
>
> \addtolength{\headheight}{14pt} % space for the rule
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> \lhead{\small Roussanka Loukanova \hfill
> $<$\href{mailto:rloukano at stp.lingfil.uu.se}%
> {rloukano at stp.lingfil.uu.se }$>$}
>
> \chead{}
> \rhead{}
> \lfoot{\ifthenelse{\value{page}=\pageref{LastPage}}{\tiny\today}} %%%
> \cfoot{\ifthenelse{\not\value{page}=\pageref{LastPage}}{\scriptsize  
> (over)}} %%%
> %\rfoot{\thepage}
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> \begin{document}
> ...

Howdy,

Not sure, but do you need to explicitly have

\usepackage{lastpage}

to use LastPage? Maybe one of the other packages loads it?

Also \ifthenelse has three arguments:

\ifthenelse{test}{true commands}{else commands}

so

\lfoot{\ifthenelse{\value{page}=\pageref{LastPage}}{\tiny\today}}

should have an extra {} pair for the else (assuming it should be  
blank if it's not the last page).

Finally, in the command

\cfoot{\ifthenelse{\not\value{page}=\pageref{LastPage}}{\scriptsize  
(over)}}

the \not is only acting on \value{page} and I believe you mean it to be

\not{\value{page}=\pageref{LastPage}} as well as missing the extra  
{}; i.e., it should be

\cfoot{\ifthenelse{\not{\value{page}=\pageref{LastPage}}}{\scriptsize  
(over)}{}}

which is the same as the simpler

\cfoot{\ifthenelse{\value{page}=\pageref{LastPage}}{}{\scriptsize  
(over)}}.

Hope I got that right.

Good Luck,

Herb Schulz
(herbs at wideopenwest.com)



------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/





More information about the MacOSX-TeX mailing list