![](https://secure.gravatar.com/avatar/c454c7402b3c58eaddc7622147742a81.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/27c34cb91f1e92bd850fe60b3d9ef336.jpg?s=120&d=mm&r=g)
Am 07.09.2012 um 06:38 schrieb Troy Henderson
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
![](https://secure.gravatar.com/avatar/c454c7402b3c58eaddc7622147742a81.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
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 -----------------------------------------------------------------
participants (3)
-
Hans Hagen
-
Troy Henderson
-
Wolfgang Schuster