Unexpanded texdefinition produces “Undefined control sequence”
Hi, the following example produces an “Undefined control sequence” error. If \def is used instead of \starttexdefinition then there is no error. Why? \starttexcode \installcommandhandler{foo}{foo}{foo} \appendtoks \setuevalue{start\currentfoo}{\foo@start[\currentfoo]}%% \setuevalue{stop\currentfoo }{\foo@stop}%% \to\everydefinefoo \starttexdefinition unexpanded foo@start [#1] \stoptexdefinition %% works %% \unexpanded\def\foo@stop{} %% produces undefined control sequence error \starttexdefinition unexpanded foo@stop \stoptexdefinition \stoptexcode \definefoo [myfoo] \starttext \startmyfoo Foobar \stopmyfoo \stoptext Marco
Am 25.08.2013 um 19:40 schrieb Marco Patzer
Hi,
the following example produces an “Undefined control sequence” error. If \def is used instead of \starttexdefinition then there is no error. Why?
The \starttexdefintion command looks for the “unexpanded” keyword only when you apply also a argument but not when the arguments are missing, i.e. \starttexdefintion unexpanded mycommand #1#2 … \stoptexdefinition works but \starttexdefintion unexpanded mycommand … \stoptexdefinition doesn’t. Wolfgang
On 2013–08–25 Wolfgang Schuster wrote:
The \starttexdefintion command looks for the “unexpanded” keyword only when you apply also a argument but not when the arguments are missing, i.e.
Thanks for the explanation. Is that a bug or expected behaviour? I think it's odd that \unexpanded\def\foo{} and \starttexdefintion unexpanded foo \stoptexdefinition don't behave the same. Marco
Am 25.08.2013 um 21:09 schrieb Marco Patzer
On 2013–08–25 Wolfgang Schuster wrote:
The \starttexdefintion command looks for the “unexpanded” keyword only when you apply also a argument but not when the arguments are missing, i.e.
Thanks for the explanation. Is that a bug or expected behaviour? I think it's odd that
\unexpanded\def\foo{}
and
\starttexdefintion unexpanded foo \stoptexdefinition
don't behave the same.
In the original definition of \starttexdefintion the only possible way to use it was \starttexdefinition mycommand #1#2 where you needed a argument, later a form without parameters was added. The “unexpanded” keyword came on another step and it’s possible Hans forgot it in the simple form without parameters. Wolfgang
On 8/25/2013 9:09 PM, Marco Patzer wrote:
On 2013–08–25 Wolfgang Schuster wrote:
The \starttexdefintion command looks for the “unexpanded” keyword only when you apply also a argument but not when the arguments are missing, i.e.
Thanks for the explanation. Is that a bug or expected behaviour? I think it's odd that
\unexpanded\def\foo{}
and
\starttexdefintion unexpanded foo \stoptexdefinition
don't behave the same.
not a bug ... just not implemented (as it's pretty complex to do that case efficiently at the tex end) anyhow, as it seems to be needed, i redid the code and now we have: \starttext \starttexdefinition unexpanded test #1 [here #1] \stoptexdefinition \test{oeps} \starttexdefinition global unexpanded test [here test] \stoptexdefinition \test \scratchcounter=123 \starttexdefinition global unexpanded expanded test #oeps [here #oeps: \the\scratchcounter] \stoptexdefinition \test{oeps} \stoptext so, three optional qualifiers (also in that order), so you'd better wikify it Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On 2013–08–26 Hans Hagen wrote:
not a bug ... just not implemented (as it's pretty complex to do that case efficiently at the tex end)
anyhow, as it seems to be needed, i redid the code and now we have:
[…]
so, three optional qualifiers (also in that order), so you'd better wikify it
http://wiki.contextgarden.net/starttexdefinition Thanks for the implementation. Marco
participants (3)
-
Hans Hagen
-
Marco Patzer
-
Wolfgang Schuster