ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Unexpanded texdefinition produces “Undefined control sequence”
@ 2013-08-25 17:40 Marco Patzer
  2013-08-25 18:56 ` Wolfgang Schuster
  0 siblings, 1 reply; 6+ messages in thread
From: Marco Patzer @ 2013-08-25 17:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 689 bytes --]

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

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re:  Unexpanded texdefinition produces “Undefined control sequence”
  2013-08-25 17:40 Unexpanded texdefinition produces “Undefined control sequence” Marco Patzer
@ 2013-08-25 18:56 ` Wolfgang Schuster
  2013-08-25 19:09   ` Marco Patzer
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2013-08-25 18:56 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 25.08.2013 um 19:40 schrieb Marco Patzer <lists@homerow.info>:

> 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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Unexpanded texdefinition produces “Undefined control sequence”
  2013-08-25 18:56 ` Wolfgang Schuster
@ 2013-08-25 19:09   ` Marco Patzer
  2013-08-25 19:21     ` Wolfgang Schuster
  2013-08-26 10:10     ` Hans Hagen
  0 siblings, 2 replies; 6+ messages in thread
From: Marco Patzer @ 2013-08-25 19:09 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 427 bytes --]

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

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re:  Unexpanded texdefinition produces “Undefined control sequence”
  2013-08-25 19:09   ` Marco Patzer
@ 2013-08-25 19:21     ` Wolfgang Schuster
  2013-08-26 10:10     ` Hans Hagen
  1 sibling, 0 replies; 6+ messages in thread
From: Wolfgang Schuster @ 2013-08-25 19:21 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 25.08.2013 um 21:09 schrieb Marco Patzer <lists@homerow.info>:

> 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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re:  Unexpanded texdefinition produces “Undefined control sequence”
  2013-08-25 19:09   ` Marco Patzer
  2013-08-25 19:21     ` Wolfgang Schuster
@ 2013-08-26 10:10     ` Hans Hagen
  2013-08-26 23:17       ` Marco Patzer
  1 sibling, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2013-08-26 10:10 UTC (permalink / raw)
  To: ntg-context

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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Unexpanded texdefinition produces “Undefined control sequence”
  2013-08-26 10:10     ` Hans Hagen
@ 2013-08-26 23:17       ` Marco Patzer
  0 siblings, 0 replies; 6+ messages in thread
From: Marco Patzer @ 2013-08-26 23:17 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 421 bytes --]

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

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-08-26 23:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-25 17:40 Unexpanded texdefinition produces “Undefined control sequence” Marco Patzer
2013-08-25 18:56 ` Wolfgang Schuster
2013-08-25 19:09   ` Marco Patzer
2013-08-25 19:21     ` Wolfgang Schuster
2013-08-26 10:10     ` Hans Hagen
2013-08-26 23:17       ` Marco Patzer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).