3

pdfTeX added some new primitives, based on e-TeX, including \ifincsname. When this primitive is being expanded between a pair of \csname ... \endcsname, the result of expansion will be true, otherwise false will be the result.

As the successor of pdfTeX, LuaTeX conserves \ifincsname as its primitive; in terms of XeTeX, it implements the \ifincsname primitive, too. However, in (e-)upTeX (and also ApTeX), there is not a primitive named or equalling to pdfTeX's \ifincsname.

Hence, here is the question: how to implement a macro to define if a macro is being expanded between \csname ...\endcsname, in (e-)upTeX.

Ch'en Meng
  • 3,843
  • 1
  • 19
  • 45

1 Answers1

2

Short answer: you can't.

There is no way from TeX90/e-TeX primitives to tell that expansion is happening inside a \csname. One might imagine setting some flag, and replacing the 'real' \csname by a macro, but that would break expandability.

It's worth noting that \ifincsname is tricky to get right: there are various awkward edge case situations (for example nesting in \ifcsname) that make it a hard primitive to get right.

user202729
  • 7,143
Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036