As intentioned in the title I want a macro \skipfirstletters
in plain-TeX, that skips the first letters (catcode 11) from the \jobname.
For instance if the TeX-file is named Test0xy.tex it should expand to just 0xy.
I tried the following lines as Test0xy.tex:
\def\skipfirstletters#1{\ifcat A#1\expandafter\skipfirstletters\else#1\fi}
\skipfirstletters Test0xy\par
\skipfirstletters\jobname\par
\expandafter\skipfirstletters\jobname
\bye
I don't understand alot, e.g. why the expanded \jobname
in Line 4 (is it expanded before \skipfirstletters
?) does not behave like the plain tokens in Line 2.
I want to use the expanded macro as argument for others if this matters.
Thanks a lot to the community and sorry for my poor knowledge of TeX.
\jobname
, its category code will be 10.\jobname
have catcode 12 (other) to avoid trouble with special characters like\
or%
in it. The only exception is the space. I guess this is because file name strings once saved internally do not have catcodes anymore, as there are not material to be typeset but to be used internally. If you reinsert them into the typeset content a neutral catcode is selected to be on the save side, I guess. The TeXBook surely states the reason.