# [OS X TeX] LastPage Reference

Herbert Schulz herbs at wideopenwest.com
Tue Mar 6 20:58:17 EST 2007

```On Mar 6, 2007, at 7:50 PM, Roussanka Loukanova wrote:

>
>> Howdy,
>>
>> Not sure, but do you need to explicitly have
>>
>> \usepackage{lastpage}
>>
>> to use LastPage? Maybe one of the other packages loads it?
>
> It seems that lastpage.sty doesn't get loaded after commenting it,
> i.e.,
> with
> % \usepackage{lastpage}
> I do not find
> (/usr/local/gwTeX/texmf.texlive/tex/latex/lastpage/lastpage.sty)
> resp.
> (/usr/local/texlive/2007/texmf-dist/tex/latex/lastpage/lastpage.sty)
> in the log file.
>
> However, the setting LastPage wold be available for an additional
> pass of latex, then in a 2nd round, the number of LastPage is not
> available. (This is my interpretation of what I see in the log
> file: I do not know if I'm right.)
>

The LastPage cross reference is defined in the lastpage package.
There are some comments about that in the hyperref package but it
wasn't clear to me that it was defined there.

>> 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).
>
> For strictness, you are right. But since  Maurino's tex code
> documentation: Without being absolutely sure, ifthenelse.sty is
> extending (they say compatible with) ifthen.sty and adds lasy
> evaluation of the logical operators:  in cases when P is true, "if
> P then Q else R" wouldn't look for the else proposition, i.e. it
> the same as "if P then Q".
>
>>
>> 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
>
> Again, because Maurino's tex code typeset ok (I've ran it several
> times), it looked to me that \not (number1 = number 2) has also
> abbreviated form
> \not number1 = number 2. The documentation is more clear to me in
> this aspect (than for the lasy evaluation). But they treat "number1
> = number 2" as a syntactic unit: atomic proposition, which hints to
> parsing of
> \not number1 = number 2 as equivalent to \not (number1 = number 2).
>
>>
>> \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)}}.
>
> I think, it is; and I think that one would be on the safe side by
> following the strict (and clear) syntax as you suggested. Esp. with
> the drawbacks of the lazy evaluation (or may I just do not like it).
>
> Roussanka

All I know is that I get different results if I define it one way or
the other and I get the expected one if I include the braces: \not{...}.

Good Luck,

Herb Schulz
(herbs at wideopenwest.com)