[Tugindia] \ifnum....\@nameuse{..}\fi
David Kastrup
dak at gnu.org
Sat Apr 19 11:48:02 CEST 2003
Manoj Kummini <kummini at yahoo.com> writes:
> I have a counter revcnt that has value two, and a macro \v at rii, that
> has value 1.1. I tried printing the value of \v at rii by
> \ifnum\c at revcnt>0\@nameuse{v at r\romannumeral\therevcnt}\fi
> but the output was .1, without the 1 before the unit's place. If I
> gave a space between 0 and \@nameuse, it would work. Then I used \z@
> for 0 as in \ifnum\c at revcnt>\z@\@nameuse.......\fi (without the
> space), it worked.
>
> Is this because LaTeX takes 0\@nameuse{\v at r\romannumeral\therevcnt}
> as 01.1 (perhaps without the fractional part)? I thought thusly
> because on changing the value of revcnt to one, the \ifnum...\fi
> condition tested false.
>
> Can someone explain or give some pointers?
A number can be either something like a counter like \z@ (which is
not really a counter but can be used like one), or something written
in decimal.
TeX sees
\ifnum\c at revcnt>0
but "0" is not a complete number without a trailing space or an
unexpandable token following, so in order to complete the \ifnum, TeX
continues expanding until it has a complete number, as you said
leading to 01.1 from which 01 is the number used for comparison
(. can't be part of a number).
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
UKTUG FAQ: <URL:http://www.tex.ac.uk/cgi-bin/texfaq2html>
More information about the Tugindia
mailing list