The macro \doifnumberelse is not behaving as I would have expected from the description in Taco Hoekwater's article "Context System Macros: part 1: General macros". There I read: The next macro executesa command depending of the outcome of a test on numerals. \doifnumberelse {string} {then ...} {else ...} This text suggest that the the test is on whether "string" as a whole is a number (taken as having digits 0123456789 only, I presume) of contains nondigits and thus isn't a number. However, it seems the macro tests on the first character only. Below follows a minimal example, the context version is: ConTeXt ver: 2010.02.18 14:48 MKIV fmt: 2010.2.20 int: english/ english % test result of \doifnumberelse \def\test#1{#1 is \doifnumberelse{#1}{a number}{not a number}\crlf} \starttext \test{1} % result: 1 is a number \test{a} % result: a is not a number \test{1a} % result: 1a is a number \test{a1} % result: a1 is not a number \stoptext Hans van der Meer
Hans van der Meer wrote:
This text suggest that the the test is on whether "string" as a whole is a number (taken as having digits 0123456789 only, I presume) of contains nondigits and thus isn't a number.
However, it seems the macro tests on the first character only.
The wiki page has that remark added as a corrigendum to the article. Best wishes, Taco
participants (2)
-
Hans van der Meer
-
Taco Hoekwater