On Sat, 18 Dec 2010, Thomas Schmitz wrote:

i guess this is easy, but I can't find an example to help
me: I want to write a macro that will collect one of its
arguments in a buffer and then collect the other argument in a buffer. Difficult to make a minimal example since I don't know how to do this, so here is some pseudo-code; this is what I want to achieve:


{\item[#1] #2 \par
\appendtobuffer{MyBuffer}{\in[#1] #3}}


\resetbuffer[MyBuffer] % so I can reuse the buffer

What I want to do with this is typeset exercises for my students, with an itemization for problems and solutions which use the same numbering. In real life, this will involve xml, but I will try and figure that out myself once I know how to use buffers...

It looks like buffers.collectcontent should be able to do this, but I can't figure out how to use it. Any pointers? Thanks a lot!

I am not sure what you want to do, and why you want to use buffers. Wont a simple token list work?

% Define a token list

% Append to a token list
\appendtoks \in[#1] #3  \to\mytoks

% Recall a token list

% Reset a token list

For repeating question and answers, there is also blocks.


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

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

Reply via email to