Which tokens does TeX not use as undelimited arguments (unless nested between an explicit character token of category code 1 and an explicit character token of category code 2)?
In the last but one dangerous bend paragraph before exercise 20.4 of the TeXbook you find the sentence:
After you have said ‘
\def\row#1#2{...}
’, you are allowed to put spaces between the arguments (e.g., ‘\row x n
’), because TeX doesn’t use single spaces as undelimited arguments.
In the double dangeorus bend paragraph before exercise 20.5 of the TeXbook you find the sentence:
How does TeX determine where an argument stops, you ask. Answer: [...] An undelimited parameter is followed immediately in the ⟨parameter text⟩ by a parameter token, or it occurs at the very end of the parameter text; in this case the corresponding argument is the next nonblank token, unless that token is ‘
{
’, when the argument will be the entire{...}
group that follows.
In the TeXbook I did find precise definitions neither for the term "single space" nor for the term "nonblank token".
Please enumerate all tokens which TeX does not use as undelimited arguments (unless nested between an explicit character token of category code 1 and an explicit character token of category code 2).
By now I found that TeX does not use explict character tokens of category code 10 and character code 32 as undelimited arguments - you need to focus on what TeX takes for \macro
's second argument:
\def\macro#1#2{\def\macrob{Arg 1:(#1) Arg 2:(#2)}}
\macro A B
\show\macrob
\bye
Implicit character tokens of category code 10 and character code 32 are used as undelimited macro arguments:
\def\macro#1#2{\def\macrob{Arg 1:(#1) Arg 2:(#2)}}
\catcode`\X=13
\uppercase{\let\space= } %
\uppercase{\letX= } %
\macro A\space B
\show\macrob
\macro AXB
\show\macrob
\bye
Explicit funny spaces are used as undelimited macro arguments:
\def\macro#1#2{\def\macrob{Arg 1:(#1) Arg 2:(#2)}}
\uccode`\ =`\a
\uppercase{\macro A B}%
\show\macrob
\bye
Implicit funny spaces are used as undelimited macro arguments:
\def\macro#1#2{\def\macrob{Arg 1:(#1) Arg 2:(#2)}}
\def\letcs#1#2{\let#1= #2}%
\catcode`\X=13
\uccode`\ =`\a
\uppercase{\letcs\space{ }}%
\uppercase{\letcsX{ }}%
\macro A\space B
\show\macrob
\macro AXB
\show\macrob
\bye
Implicit/explicit character tokens of category code 12 and character code 32 are used as undelimited macro arguments:
\def\macro#1#2{\def\macrob{Arg 1:(#1) Arg 2:(#2)}}
\catcode`\ =12\relax%
\let\space= %
\macro{A} {B}%
\show\macrob
\macro{A}\space{B}%
\show\macrob
\bye
Control-space is used as undelimited macro argument:
\def\macro#1#2{\def\macrob{Arg 1:(#1) Arg 2:(#2)}}
\macro A\ B
\show\macrob
\bye
So I tested a few cases, but testing edge cases does neither lead to a precise definition for the term "single space" nor lead to a precise definition for the term "nonblank token". ;-)
In other words: I don't know precisely which tokens TeX does not use as undelimited arguments (unless nested between a character token of category code 1 and a character token of category code 2).
It seems the quantity ⟨space token⟩ is not equal to "single space"/"nonblank token":
The TeXbook says in Chapter 24: Summary of Vertical Mode:
The quantity ⟨space token⟩, which was used in the syntax of ⟨optional spaces⟩ above, stands for an explicit or implicit space. In other words, it denotes either a character token of category 10, or a control sequence or active character whose current meaning has been made equal to such a token by
\let
or\futurelet
.
The mentioned "control sequence or active character", subsumeable under ⟨space token⟩, will be used as undelimited macro argument—the examples above show it—while "single space"/"nonblank token" is not used as undelimited macro argument.
Probably "single space"/"nonblank token" is a strict subset of ⟨space token⟩ ?
If so—which subset thereof exactly?