[texhax] A problem about \jobname

Hartmut Henkel 520011141241-0001 at t-online.de
Sat Aug 14 16:27:17 CEST 2004


On Sat, 14 Aug 2004, Rodolfo Medina wrote:

> Suppose I'm editing 'myfile.tex'. If I say
>
> \newtoks\filename
> \filename={myfile}
> \edef\tempa{\the\filename}
> \edef\tempb{\jobname}
> \ifx\tempa\tempb yes\else no\fi
>
> I get 'no', whereas I would expect 'yes'. Instead, I get 'yes' if I say

The items don't match by their catcodes. The \jobname consists of
catcode 12 (other) characters, whereas the filename has catcode 11
(letter) chars. Take e. g. \meaning or \string to align the catcodes of
the two items:

\newtoks\filename
\filename={myfile}

\edef\tempa{\the\filename}
\edef\tempb{\jobname}

---\tempa---\tempb---

\edef\tempa{\meaning\tempa}
\edef\tempb{\meaning\tempb}

---\tempa---\tempb---

\ifx\tempa\tempb yes\else no\fi

\hrule

\edef\tempc{\expandafter\string\csname \the\filename\endcsname}
\edef\tempd{\expandafter\string\csname \jobname\endcsname}

---\tempc---\tempd---

\ifx\tempc\tempd yes\else no\fi

\bye

Regards, Hartmut



More information about the texhax mailing list