[OS X TeX] Textures TeXShop paradox

Peter Vamos P.Vamos at exeter.ac.uk
Wed Jun 15 17:20:10 CEST 2005

(See Textures -> TeXShop migration message for background)
A number of my files give me the green light in Textures but produced 
the error message: '!missing number treated as zero' in TeXShop (any 
typesetting engine). Going to the error line shows perfectly good 
code. Nothing fancy in these files except the fancy headers package. 
After some investigation,  it turns out that the offending line is


I produce handouts, exercise sheets etc and don't like pagenumbers 
showing when I have only one page so I wrote the above pagenumber 
instruction; it puts the pagenumber in the bottom centre if that 
number is >1 and nothing otherwise. The document ends with: 

Many of you must have worked out by now what happens (it took me some 
time) but if not, here is the solution to this apparent paradox. When 
TeX comes to the end of a page it tries to construct the footer but, 
on the first run, doesn't know what \pageref{fin} is so cannot 
evaluate \ifnum1=\pageref{fin} and produces the error message, 
nothing to do with the line in the input file it is on, except that 
it is approximately at a page break. But I see none of this in 
Textures because I run  in (Flash and) LaTeX mode, the errors on the 
first run are ignored and by the second run everything is OK. Hence 
the green light.

But in TeXShop I am stopped during the first run every time TeX comes 
to a page break. So I must somehow stop TeX complaining. In fact the 
solution is an even shorter code, change the above to


this works, of course you have to typeset twice to get the correct result.

I have been using the first version for ages (well, certainly since 
LaTex Mode in Textures) but now that I ran into trouble in TeXShop I 
looked around and found, to my surprise, that there is a package on 
CTAN doing this pagenumber style called onepagem.sty but in a 
different, more complicated and longer way.

Now some of you might say, why bother with all this, just do it 
manually and put in \pagestyle{empty} at the end if your document 
fits on one page. Perfectly good solution of course but, IMHO, 
defeats the purpose of programming computers. And not elegant.

We spend minutes on devising code which will only save seconds and 
then, as in this case, even more minutes to try to debug (and read 
lists like this) if it goes wrong. But hey, isn't this all about the 
lure and strange attraction of computing?

Peter Vamos

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>

More information about the macostex-archives mailing list