Re: buffer question
Jim via ntg-context <[email protected]>
| Newsgroups | gmane.comp.tex.context |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Apr 16, 2026 at 14:41 (+0200), Hans Hagen via ntg-context wrote:
> On 4/16/2026 1:14 PM, Jim via ntg-context wrote:
>> Hi buffer experts,
>> Is it possible to combine two buffers into one?
>> Google (ha ha!) told me
>> %%%%%%%%%%%%%%%%%%%%
>> \starttext
>> \startbuffer[one]
>> Content from buffer one.
>> \stopbuffer
>> \startbuffer
>> Content from buffer two.
>> \stopbuffer
>> \startbuffer[combined]
>> \getbuffer[one]
>> \getbuffer
>> \stopbuffer
>> ...
>> %%%%%%%%%%%%%%%%%%%%
>> but that only combines them in a useful way if I do
>> \getbuffer[combined]
>> If I do
>> \typebuffer[combined]
>> I don't get
>> Content from buffer one.
>> Content from buffer two.
>> (I realize that if I have two named buffers "one" and "two" I can do
>> \typebuffer[one,two]
>> but what if I want to use the unnamed buffer?)
>> Thanks.
> It's baffling what usage patterns people can come up with.
Users are so weird. There's just no explaining it. :-)
> \starttext
> \startbuffer[one]
> Content from buffer one.
> \stopbuffer
> \startbuffer
> Content from buffer two.
> \stopbuffer
> \getbuffer[one,]
The above didn't work for me (yesterday while I was trying things and today
as well), but \getbuffer[one,,] did. However, I'd argue the empty braces
are more suggestive of what is going on (to the unwary reader) than two
commas.
> \getbuffer[one,{}]
> \getbuffer[one,,,one]
Thanks for your help, it is much appreciated.
Since today is International Buffer Day, here's another related (and maybe
even more baffling) question:
Suppose I have a buffer which I am going to hand to \typesetbuffer.
Suppose further that I have some "setup" code in another buffer which is to
be listed first:
\startbuffer[MyPremable]
...
\stopbuffer
\startbuffer[content]
...
\stopbuffer
\typesetbuffer[MyPreamble,content]
So far so good, especially since I now know I can do
\typesetbuffer[MyPreamble,{}]
But perhaps there is something in MyPreamble I would like to adjust.
Conceptually, I'd like
\def\pageHeight{200mm}
\startbuffer[MyPremable]
...
\definepapersize[ShowAndTypeset]
[width=..., height=\pageHeight]
\setuppapersize[ShowAndTypeset]
...
\stopbuffer
but rather than \the\pageHeight being expanded in the buffer, it is (of
course) entered literally, and when the buffer is typeset, \the\pageHeight
is undefined.
So... is there some way to get a parameter value (pageHeight in this
example) into the buffer contents?
(I realize I can create Yet Another buffer MyPrePreamble which defines a
macro (or sets a dimen) to the desired value and call
\typesetbuffer[MyPrePreamble,MyPreamble,content]
but I was wondering if there was something a bit more elegant.)
Thanks.
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
___________________________________________________________________________________