N. Raghavendra
22. April 2018 um 17:23
I was wondering if it is alright to use underscores in the names of
macros, e.g, as in the following file. It looks like \startsetups, and
\def accept names with hyphens, underscores, and numerals, but
\starttexdefinition doesn't tolerate any of them.

1. In general, what characters are allowed in macro names? Are Unicode
characters admissible?

2. Apart from the fact that one can use whitespace freely in
\starttexdefinition, is there any reason to prefer it over \def?

Thanks,
Raghu.

------------------------------------------------------------
\starttext

\startsetups [hello-world_1]
Hello, world 1!
\stopsetups

\setups [hello-world_1]

\def\hello-world_2{Hello, world 2!}
You’re defining a command named \hello which has to be followed by the string "-world_2".


You can use the following example as test.

%%%% begin example
\starttext

\def\hello-1{Hello \letterhash 1}

\def\hello-2{Hello \letterhash 2}

\hello-1

\hello-2

\stoptext
%%%% end example

Here I create a command named \hello which has to be followed by “-1" and "-2".

When you run TeX on this example you get the following error message:

%%%% begin error message
tex error       > tex error on line 7 in file /Users/wolf/TeX/test/test.tex: ! Use of \hello doesn't match its definition

l.7 \hello-1
%%%% end error message

Wolfgang