[NTG-context] Doubled annotation content
In the following example the content of the annotation is printed twice. Bug? \usemodule [annotation] \defineannotation [myannotation] [alternative=command, command=\cmd] \def\cmd {\placeannotationcontent} \starttext \startmyannotation foo \stopmyannotation \stoptext Marco ___ 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 ___
Re: [NTG-context] Doubled annotation content
Hi Marco, It seems that your command \cmd places again the content… Why do you want that command? This works fine: \usemodule [annotation] \defineannotation [myannotation] \starttext \startmyannotation foo \input knuth.tex \stopmyannotation \stoptext Best regards: OK On 6 déc. 2012, at 21:24, Marco Patzer wrote: > In the following example the content of the annotation is printed > twice. Bug? > > \usemodule [annotation] > > \defineannotation > [myannotation] > [alternative=command, > command=\cmd] > > \def\cmd > {\placeannotationcontent} > > \starttext > \startmyannotation >foo > \stopmyannotation > \stoptext > > > Marco > > ___ > 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 > ___ ___ 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 ___
Re: [NTG-context] Doubled annotation content
On 2012–12–06 Otared Kavian wrote: > It seems that your command \cmd places again the content… That's not the case. Check this example: \usemodule [annotation] \defineannotation [first] [alternative=command, command=\cmdFirst] \defineannotation [second] [alternative=command, command=\cmdSecond] \def\cmdFirst{} \def\cmdSecond {\placeannotationcontent} \starttext \startfirst first %% not printed \stopfirst \startsecond second %% printed twice \stopsecond \stoptext > Why do you want that command? ??? It allows for flexible placement of the content. > This works fine: > > \usemodule [annotation] > \defineannotation > [myannotation] > > \starttext > \startmyannotation >foo > >\input knuth.tex > \stopmyannotation > \stoptext Try to use a custom command. Marco ___ 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 ___
Re: [NTG-context] Doubled annotation content
On Thu, 6 Dec 2012, Marco Patzer wrote: On 2012–12–06 Otared Kavian wrote: It seems that your command \cmd places again the content… That's not the case. Check this example: \usemodule [annotation] \defineannotation [first] [alternative=command, command=\cmdFirst] \defineannotation [second] [alternative=command, command=\cmdSecond] \def\cmdFirst{} \def\cmdSecond {\placeannotationcontent} Untested: Does \unexpanded\def\cmdSecond ... help? \starttext \startfirst first %% not printed \stopfirst \startsecond second %% printed twice \stopsecond \stoptext Aditya___ 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 ___
Re: [NTG-context] Doubled annotation content
Am 06.12.2012 um 21:24 schrieb Marco Patzer : > In the following example the content of the annotation is printed > twice. Bug? > > \usemodule [annotation] > > \defineannotation > [myannotation] > [alternative=command, > command=\cmd] > > \def\cmd > {\placeannotationcontent} The argument for the command keys has to be a macro with two parameters, the first parameters contains the formatted header and the second argument the formatted content of the environment. You have to change your definition of \cmd to \define[2]\cmd{#2} or \define[2]\cmd{\placeannotationcontent} 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 ___
Re: [NTG-context] Doubled annotation content
Am 06.12.2012 um 23:00 schrieb Marco Patzer : >> Why do you want that command? > > ??? > It allows for flexible placement of the content. You can also use \defineannotationalternative to create your own styles, see - http://www.ntg.nl/pipermail/ntg-context/2012/070019.html and - http://www.ntg.nl/pipermail/ntg-context/2012/070327.html 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 ___
Re: [NTG-context] Doubled annotation content
On 2012–12–07 Wolfgang Schuster wrote: > The argument for the command keys has to be a macro with two parameters, > the first parameters contains the formatted header and the second argument > the formatted content of the environment. That's how I used it in the past, but after an update I got an error which vanished after I removed the two arguments. I thought the interface might have changed. I used it as follows. What's wrong with that? %% macros=mkvi \usemodule [annotation] \defineannotation [myannotation] [alternative=command, command=\cmd] \starttexdefinition cmd #first #second \placeannotationcontent \stoptexdefinition \starttext \startmyannotation foo \stopmyannotation \stoptext Thanks for the annotationalternative tip, I didn't know that one. Marco ___ 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 ___
Re: [NTG-context] Doubled annotation content
Am 07.12.2012 um 10:26 schrieb Marco Patzer : > On 2012–12–07 Wolfgang Schuster wrote: > >> The argument for the command keys has to be a macro with two parameters, >> the first parameters contains the formatted header and the second argument >> the formatted content of the environment. > > That's how I used it in the past, but after an update I got an error > which vanished after I removed the two arguments. I thought the > interface might have changed. > > I used it as follows. What's wrong with that? > > %% macros=mkvi > \usemodule [annotation] > > \defineannotation > [myannotation] > [alternative=command, > command=\cmd] > > \starttexdefinition cmd #first #second > \placeannotationcontent > \stoptexdefinition Commands need to be unexpandable because when you use the “command”. This is necessary because I check for a command and this needs \unexpanded\def to work. You can create a unexpandable command with \starttexdefintion by adding the unexpanded keyword as first argument to the environment. \starttexdefinition unexpanded cmd #first #second \placeannotationcontent \stoptexdefinition 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 ___
Re: [NTG-context] Doubled annotation content
On 2012–12–07 Wolfgang Schuster wrote: > Commands need to be unexpandable because when you use the “command”. > > This is necessary because I check for a command and this needs > \unexpanded\def to work. > > You can create a unexpandable command with \starttexdefintion by adding > the unexpanded keyword as first argument to the environment. > > \starttexdefinition unexpanded cmd #first #second > \placeannotationcontent > \stoptexdefinition That does the trick. Thanks Wolfgang! Marco ___ 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 ___