[NTG-context] \jobname and \doifelse

Pablo Rodriguez oinos at gmx.es
Sun Nov 6 14:11:01 CET 2022


On 11/5/22 16:55, Wolfgang Schuster via ntg-context wrote:
> Pablo Rodriguez via ntg-context schrieb am 05.11.2022 um 16:30:
>>
>>    \doifelse{\jobname}{a}
>>      {yes}{no}
>>
>> I get "no" as in TeX and "yes" with Lua, being "a.tex" the source file.
>>
>> The TeX conditional used to work before.
>>
> Are you sure the check worked in the past?

Many thanks for your reply, Wolfgang.

I thought this used to work before.

Now I realize I have to check the use of \doif{\jobname} and
\doifelse{\jobname} in all my documents.

> 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.

I see now. Not that I fully understand what catcodes are, but
\doifsamestringelse should be what I have used here (as suggested in
https://wiki.contextgarden.net/System_Macros/Branches_and_Decisions#.5Cdoifsamestringelse.2C.5Cdoifsamestring.2C.5Cdoifnotsamestring).

Just a final question: \doif compares both strings and catcodes and
\doifsamestring compares only strings. Or am I missing something here too.

Many thanks for your help,

Pablo


More information about the ntg-context mailing list