[NTG-context] \jobname and \doifelse
Wolfgang Schuster
wolfgang.schuster.lists at gmail.com
Sat Nov 5 16:55:47 CET 2022
Pablo Rodriguez via ntg-context schrieb am 05.11.2022 um 16:30:
> Dear list,
>
> using current latest (2022.10.22 11:23), I have the following sample:
>
> \starttext
> \doifelse{\jobname}{a}
> {yes}{no}
> \jobname
>
> \startluacode
> if tex.jobname == "a" then
> context("yes")
> else
> context("no")
> end
> \stopluacode
> \stoptext
>
> I get "no" as in TeX and "yes" with Lua, being "a.tex" the source file.
>
> The TeX conditional used to work before.
>
> Am I missing something or have I hit a bug?
Are you sure the check worked in the past?
The content of \jobname has catcode 12 while you "a" you check against
has catcode 11, and even when \jobname result in "a" they are different
because the catcodes differ.
You can see the same result in the example below where the second check
compares two a with different catcodes (11 and 12) while the first check
has the same catcode (11) for both a's.
\starttext
\edef\A{a}
\edef\B{a}
\ifx\A\B
yes
\else
no
\fi
\begingroup
\catcode`a=12
\gdef\B{a}
\endgroup
\ifx\A\B
yes
\else
no
\fi
\stoptext
Wolfgang
More information about the ntg-context
mailing list