Re: Yet Another buffer question
Jim via ntg-context <[email protected]>
| Newsgroups | gmane.comp.tex.context |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Apr 16, 2026 at 19:53 (+0200), Wolfgang Schuster wrote:
> Am 16.04.2026 um 19:46 schrieb Wolfgang Schuster:
>> Am 16.04.2026 um 19:33 schrieb Jim via ntg-context:
>>> Possibly the last buffer question for IBD 2026...
>>> Suppose someone wants to use a buffer in a solution to some typesetting
>>> problem which involves more than a simple \getbuffer or \typebuffer or
>>> \typesetbuffer.
>>> They could define something like
>>> \def\usebuf#1{...use buffer #1 as needed...}
>>> and later do
>>> \startbuffer[mybuf]
>>> <content>
>>> \stopbuffer
>>> \usebuf{mybuf}
>>> But this isn't in the spirit of the
>>> \startsomething
>>> <content>
>>> \stopsomething
>>> paradigm.
>>> How does one define a \start-\stop "environment" that
>>> -> collects some content into a buffer, and then
>>> -> does whatever one needs to do with that content ?
>> There is
>> %%%% begin example
>> \definebuffer[Jim]
>> \starttext
>> \startJim
>> This is Jim’s buffer!
>> \stopJim
>> \typeJim \getJim
>> \stoptext
>> %%%% end example
> You can also define a \stopXXX command where you can load the buffer content
> and do something with it once you reach the end of the buffer, this is a
> feature of the environment itself.
> %%%% begin example
> \definebuffer[Jim]
> \protected\def\stopJim
> {\startframedtext
> \getJim
> \stopframedtext}
> % alternative way to define \stopJim
> %\starttexdefinition protected stopJim
> % \startframedtext
> % \getJim
> % \stopframedtext
> %\stoptexdefinition
> \starttext
> \startJim
> This is Jim’s buffer!
> \stopJim
> \stoptext
> %%%% end example
Wolfgang,
thanks very much for this and your previous answer.
This one, which executes a macro upon \stopJim, is what I was really
thinking of when I asked the question.
Your previous answer does have the virtue that it points out a few more
commands that I could go and try to figure out.
Cheers.
Jim
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : [email protected] / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________