I would like to create a macro \myjob
that has the same value as \jobname
, but with letters having catcode 11 instead of 12. The goal is to be able to do something like
\documentclass{article}
\edef\myjob{\jobname}
\makeatletter
\newcommand{\mytest}[1]{\begingroup%
\def\@tempa{#1}%
% \expandafter\def\expandafter\@tempa\expandafter{\detokenize{#1}}%
\meaning\@tempa\par%
\meaning\myjob\par%
\ifx\@tempa\myjob%
YES%
\else%
NO%
\fi%
\endgroup}
\begin{document}
\mytest{test}
\end{document}
where \ifx\@tempa\myjob
is true (assuming the correct string is passed to \mytest
). I would prefer not to detokenize the input string. Rather, I am looking for a different way of defining \myjob
that "retokenizes" \jobname
.
%
or similar: see e-TeX's\scantokens
%
or other nonsense in the\jobname
then I am fine with it causing problems.\@tempa
contents is much more safer. It can be done by a simple\@onelevel@sanitize\@tempa
, which does not even require e-TeX. The tokenization method via\scantokens
is not reliable at all. Depending on the current category code settings and the used characters, the latter method can break with a cryptic error message; also, the result is not even stable in general.