[texhax] A problem about \jobname
Rodolfo Medina
romeomedina at libero.it
Sat Aug 14 18:34:15 CEST 2004
Hartmut Henkel wrote:
>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
Thanks indeed for your suggestions, which worked perfectly both of them.
I should study carefully commands like
\csname... \endcsname, \expandafter, \string, \meaning and others:
I tried to, but found them quite hard to understand.
The problem you helped me with, though,
was just the first step of a final problem I want to work out in the end,
which is using the above \ifx... \else... \fi condition
with the eplain commands \refn{} and \definexref{}{}{} for cross references.
My final purpose is to say first:
\definexref{label}{\jobname}{}
and then achieve something like (trying to applying your indications):
\edef\tempa#1{\refn{#1}}
\edef\tempb{\jobname}
\edef\tempa#1{\meaning\tempa{#1}}
\edef\tempb{\meaning\tempb}
\ifx\tempa{label}\tempb yes\else no\fi
and get 'yes'. I get 'no' instead. I also tried with
\edef\tempc#1{\expandafter\string\csname pippo:#1\endcsname\refn{#1}}
\edef\tempd#1{\csname pippo:#1\endcsname}
\edef\tempe{\expandafter\string\csname \jobname\endcsname}
\ifx\tempd{label}\tempe yes\else no\fi
getting 'no' as well.
Is there a way to achieve this? Could you help me in this final step?
Thanks indeed,
Rodolfo
More information about the texhax
mailing list