[Tugindia] \@namedef
David Kastrup
dak at gnu.org
Wed Feb 5 17:37:44 CET 2003
Manoj Kummini <kummini at yahoo.com> writes:
> Hello.
>
> I have a piece the following piece of code in a file
>
> \def\address#1#2{%
> \global\@namedef{addridx@#1}{\theaddrcount}%
> \global\@namedef{addr at ss\romannumeral\theaddrcount}{#2}%
> \stepcounter{addrcount}}
> ...
> \address{foo1}{1, Foo Bar, Fubar}
> ...
> When I try printing \addridx at foo1 in the text, I get the error that
> \addridx at foo is not defined. I changed the code to
>
> \address{foo}{1, Foo Bar, Fubar}
>
> and was able to print \addridx at foo. Can someone explain this?
Numbers are not part of TeX's input syntax for control sequences.
That means that \addridx at foo1 is encountered in the text, it is
interpreted as \addridx at foo 1, even though you have actually defined a
control sequence \addridx at foo1. But you can only call it by using
something like \@nameuse{addridx at foo1}, the control sequence name
itself is not enterable in TeX's normal syntax for its input
conventions.
On the upside, you can enter things like \sqrt2 without having to
type a space between \sqrt and 2.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
UKTUG FAQ: <URL:http://www.tex.ac.uk/cgi-bin/texfaq2html>
More information about the Tugindia
mailing list