* doifnumberelse
@ 2010-03-03 10:56 Hans van der Meer
2010-03-03 11:13 ` doifnumberelse Taco Hoekwater
0 siblings, 1 reply; 2+ messages in thread
From: Hans van der Meer @ 2010-03-03 10:56 UTC (permalink / raw)
To: NTG ConTeXt
[-- Attachment #1.1: Type: text/plain, Size: 998 bytes --]
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
[-- Attachment #1.2: Type: text/html, Size: 1856 bytes --]
[-- Attachment #2: Type: text/plain, Size: 486 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-03-03 11:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-03 10:56 doifnumberelse Hans van der Meer
2010-03-03 11:13 ` doifnumberelse Taco Hoekwater
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).