Styling of included buffers or files
![](https://secure.gravatar.com/avatar/2349dcb0bed02a89d589125ccc301859.jpg?s=120&d=mm&r=g)
Hi all, I am currently writing a text where I want to include text snippets either by including files or including buffers. What is the best way to style all these included buffers? I know that I can do something like this: \startcolumns \getbuffer[Muenchen] \stopcolumns Or do something with \defineparagraph Is it somehow possible to apply styles to all buffers that gets included via \getbuffer by defining a special getbuffer-style? TIA juh
![](https://secure.gravatar.com/avatar/57c17c28c61c03706efc4a9112fad09b.jpg?s=120&d=mm&r=g)
On Sun, 17 May 2020 18:16:13 +0200
"Jan U. Hasecke"
I am currently writing a text where I want to include text snippets either by including files or including buffers.
What is the best way to style all these included buffers?
I know that I can do something like this:
\startcolumns \getbuffer[Muenchen] \stopcolumns
Or do something with \defineparagraph
Is it somehow possible to apply styles to all buffers that gets included via \getbuffer by defining a special getbuffer-style?
\setupbuffer has before and after keys which can be used. Example: \setupbuffer [before=\blank\blackrule\startnarrower\BufferStyle, after=\stopnarrower\blackrule\blank] %% alternatively define custom buffers \definebuffer [foobar] \setupblackrules [width=1cm, height=1pt, color=gray] \definehighlight [BufferStyle] [style=smallitalic, color=blue] \startbuffer \samplefile{knuth} \stopbuffer \starttext \samplefile{knuth} \getbuffer \samplefile{knuth} \stoptext Marco
![](https://secure.gravatar.com/avatar/2349dcb0bed02a89d589125ccc301859.jpg?s=120&d=mm&r=g)
Am 17.05.20 um 19:04 schrieb Marco Patzer:
Is it somehow possible to apply styles to all buffers that gets included via \getbuffer by defining a special getbuffer-style?
\setupbuffer has before and after keys which can be used. Example:
\setupbuffer [before=\blank\blackrule\startnarrower\BufferStyle, after=\stopnarrower\blackrule\blank]
%% alternatively define custom buffers \definebuffer [foobar]
\setupblackrules [width=1cm, height=1pt, color=gray]
\definehighlight [BufferStyle] [style=smallitalic, color=blue]
\startbuffer \samplefile{knuth} \stopbuffer
\starttext \samplefile{knuth} \getbuffer \samplefile{knuth}
\stoptext
So easy! I am humbled. For some reason I wasn't able to find this in setup-en.pdf. Thanks a lot. juh
![](https://secure.gravatar.com/avatar/74d41c3215dcdd377343cdc47311757c.jpg?s=120&d=mm&r=g)
Marco Patzer schrieb am 17.05.2020 um 19:04:
On Sun, 17 May 2020 18:16:13 +0200 "Jan U. Hasecke"
wrote: I am currently writing a text where I want to include text snippets either by including files or including buffers.
What is the best way to style all these included buffers?
I know that I can do something like this:
\startcolumns \getbuffer[Muenchen] \stopcolumns
Or do something with \defineparagraph
Is it somehow possible to apply styles to all buffers that gets included via \getbuffer by defining a special getbuffer-style?
\setupbuffer has before and after keys which can be used. Example:
\setupbuffer [before=\blank\blackrule\startnarrower\BufferStyle, after=\stopnarrower\blackrule\blank]
[...]
\definehighlight [BufferStyle] [style=smallitalic, color=blue]
Use the highlight-environment or create a new startstop-environment to apply style and color settings to the buffer. \definestartstop [BufferStyle] [style=smallitalic, color=blue] \setupbuffer [before={... \startBufferStyle ...}, after={... \stopBufferStyle ...}] Wolfgang
participants (3)
-
Jan U. Hasecke
-
Marco Patzer
-
Wolfgang Schuster