[Tugindia] \ifnum....\@nameuse{..}\fi

Radhakrishnan CV cvr at river-valley.org
Sat Apr 19 16:21:59 CEST 2003

>>>>> "Manoj" == Manoj Kummini <kummini at yahoo.com> writes:

    Manoj> I have a counter revcnt that has value two, and a macro
    Manoj> \v at rii, that has value 1.1. I tried printing the value of
    Manoj> \v at rii by
    Manoj> \ifnum\c at revcnt>0\@nameuse{v at r\romannumeral\therevcnt}\fi
    Manoj> but the output was .1, without the 1 before the unit's
    Manoj> place. If I gave a space between 0 and \@nameuse, it would
    Manoj> work. Then I used \z@ for 0 as in
    Manoj> \ifnum\c at revcnt>\z@\@nameuse.......\fi (without the space),
    Manoj> it worked.

    Manoj> Is this because LaTeX takes
    Manoj> 0\@nameuse{\v at r\romannumeral\therevcnt} as 01.1 (perhaps
    Manoj> without the fractional part)? I thought thusly because on
    Manoj> changing the value of revcnt to one, the \ifnum...\fi
    Manoj> condition tested false.

You're right. The value of \v at ii becomes part of the condition and not
the function to be executed as you expected. You can easily understand
this if you increase the value of \v at ii to a big number. See the error

 ! Number too big.
\v at rii ->9999999999
l.26 ...vcnt>0\@nameuse{v at r\romannumeral\c at revcnt}

It is clear that the expanded value of \v at rii becomes the number to
which \ifnum does the comparison.



More information about the Tugindia mailing list