Re: Yet Another buffer question
Wolfgang Schuster <[email protected]>
| Newsgroups | gmane.comp.tex.context |
|---|---|
| Message-ID | <[email protected]> |
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
Another alternative is
%%%% begin example
% creates \startJim ... \stopJim
\defineuserdata[Jim][alternative=Jim]
% creates argument for alternative=Jim
\defineuserdataalternative[Jim][renderingsetup=Jim]
% creates argument for renderingsetup=Jim
\startsetups[Jim]
\startframedtext
\getuserdata[Jim]% load \startJim ... \stopJim content
\stopframedtext
\stopsetups
\starttext
\startJim
This is Jim’s userdata environment!
\stopJim
\stoptext
%%%% end example
Wolfgang
___________________________________________________________________________________
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
___________________________________________________________________________________