Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!van-bc!ubc-cs!uw-beaver!zephyr.ens.tek.com!ogicse!hsdndev!husc6!zariski!grabiner From: grabiner@math.harvard.edu (David Grabiner) Newsgroups: comp.text.tex Subject: Re: TeX bug: optional spaces are mandatory Message-ID: Date: 8 Feb 91 17:43:29 GMT References: <4117@cernvax.cern.ch> Sender: news@husc6.harvard.edu Organization: Harvard University Dept. of Mathematics Lines: 35 In-reply-to: nath@cernvax.cern.ch's message of 8 Feb 91 14:51:35 GMT In article <4117@cernvax.cern.ch>, Alfred Nathaniel writes: > I discovered a bug in TeX3.0. It also shows up in TeX2.9. Going through the > change records I couldn't find any reference to it. So I suppose that it has > been there for much longer. > In sequences > ...\counter=\ifnum\counter... > and > ...\counter=\fi \ifnum\counter... > the \ifnum test fails if is not followed by a space. I don't think this is a bug; a similar situation is mentioned in the TeXbook, p. 208. TeX has to expand the \ifnum to see whether the expansion becomes part of the . For example: \newif\ifcents % Express monetary amounts in cents, not dollars \centstrue \def\addcents{\ifcents 00\fi} \newcount\money \money=15\addcents This sets \money to 15 or 1500, depending on the truth of \ifcents. The \addcents and \ifcents need to be expanded before TeX finishes reading the number; otherwise, this would set \money to 15 and then make the 00 part of the paragraph. -- David Grabiner, grabiner@zariski.harvard.edu "We are sorry, but the number you have dialed is imaginary." "Please rotate your phone 90 degrees and try again." Disclaimer: I speak for no one and no one speaks for me...