* Nested Macro
@ 2012-09-07 4:38 Troy Henderson
2012-09-07 5:17 ` Wolfgang Schuster
0 siblings, 1 reply; 5+ messages in thread
From: Troy Henderson @ 2012-09-07 4:38 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 413 bytes --]
I would like to create a macro that defines a display formula, and then
redefine the same macro such that the redefinition includes the original
display formula followed by another display formula. Here is my attempt.
\def\foo{\startformula a = b \stopformula} \foo
\edef\foo{\foo \startformula c = d \stopformula} \foo
This fails, and I would appreciate help in getting this to work.
Thanks,
Troy Henderson
[-- Attachment #1.2: Type: text/html, Size: 447 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] 5+ messages in thread
* Re: Nested Macro
2012-09-07 4:38 Nested Macro Troy Henderson
@ 2012-09-07 5:17 ` Wolfgang Schuster
2012-09-07 5:42 ` Troy Henderson
0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Schuster @ 2012-09-07 5:17 UTC (permalink / raw)
To: mailing list for ConTeXt users
Am 07.09.2012 um 06:38 schrieb Troy Henderson <thenders@gmail.com>:
> I would like to create a macro that defines a display formula, and then redefine the same macro such that the redefinition includes the original display formula followed by another display formula. Here is my attempt.
>
> \def\foo{\startformula a = b \stopformula} \foo
> \edef\foo{\foo \startformula c = d \stopformula} \foo
>
> This fails, and I would appreciate help in getting this to work.
Your example works for me when I process it with mkiv but I would use a token list and not a macro to store the content.
\starttext
% macro
\def\foo{\startformula a = b \stopformula} \foo
\blank[2*line]
\edef\foo{\foo \startformula c = d \stopformula} \foo
\blank[2*line]
% token list
\newtoks\mytoks
\appendtoks
\startformula a = b \stopformula
\to \mytoks
\the\mytoks
\blank[2*line]
\appendtoks
\startformula c = d \stopformula
\to \mytoks
\the\mytoks
\stoptext
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] 5+ messages in thread
* Re: Nested Macro
2012-09-07 5:17 ` Wolfgang Schuster
@ 2012-09-07 5:42 ` Troy Henderson
2012-09-07 9:28 ` Hans Hagen
0 siblings, 1 reply; 5+ messages in thread
From: Troy Henderson @ 2012-09-07 5:42 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 235 bytes --]
The \newtoks works great. Can values be assigned to tokens directly
instead of appending? Obviously one way it to use \newtoks followed by
\appendtoks, but once a token has already been defined, can its content be
overwritten?
Troy
[-- Attachment #1.2: Type: text/html, Size: 248 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] 5+ messages in thread
* Re: Nested Macro
2012-09-07 5:42 ` Troy Henderson
@ 2012-09-07 9:28 ` Hans Hagen
2012-09-07 12:49 ` Troy Henderson
0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2012-09-07 9:28 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 7-9-2012 07:42, Troy Henderson wrote:
> The \newtoks works great. Can values be assigned to tokens directly
> instead of appending? Obviously one way it to use \newtoks followed by
> \appendtoks, but once a token has already been defined, can its content be
> overwritten?
\newtoks\mytoks
\mytoks{xx}
-----------------------------------------------------------------
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] 5+ messages in thread
* Re: Nested Macro
2012-09-07 9:28 ` Hans Hagen
@ 2012-09-07 12:49 ` Troy Henderson
0 siblings, 0 replies; 5+ messages in thread
From: Troy Henderson @ 2012-09-07 12:49 UTC (permalink / raw)
To: Hans Hagen; +Cc: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 53 bytes --]
>
> \newtoks\mytoks
>
> \mytoks{xx}
>
Thanks!
Troy
[-- Attachment #1.2: Type: text/html, Size: 231 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] 5+ messages in thread
end of thread, other threads:[~2012-09-07 12:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-07 4:38 Nested Macro Troy Henderson
2012-09-07 5:17 ` Wolfgang Schuster
2012-09-07 5:42 ` Troy Henderson
2012-09-07 9:28 ` Hans Hagen
2012-09-07 12:49 ` Troy Henderson
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).