ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Styling of included buffers or files
@ 2020-05-17 16:16 Jan U. Hasecke
  2020-05-17 17:04 ` Marco Patzer
  0 siblings, 1 reply; 4+ messages in thread
From: Jan U. Hasecke @ 2020-05-17 16:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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




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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Styling of included buffers or files
  2020-05-17 16:16 Styling of included buffers or files Jan U. Hasecke
@ 2020-05-17 17:04 ` Marco Patzer
  2020-05-18  7:37   ` Jan U. Hasecke
  2020-05-18 16:32   ` Wolfgang Schuster
  0 siblings, 2 replies; 4+ messages in thread
From: Marco Patzer @ 2020-05-17 17:04 UTC (permalink / raw)
  To: ntg-context

On Sun, 17 May 2020 18:16:13 +0200
"Jan U. Hasecke" <juh+ntg-context@mailbox.org> 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]

%% 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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Styling of included buffers or files
  2020-05-17 17:04 ` Marco Patzer
@ 2020-05-18  7:37   ` Jan U. Hasecke
  2020-05-18 16:32   ` Wolfgang Schuster
  1 sibling, 0 replies; 4+ messages in thread
From: Jan U. Hasecke @ 2020-05-18  7:37 UTC (permalink / raw)
  To: ntg-context

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

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Styling of included buffers or files
  2020-05-17 17:04 ` Marco Patzer
  2020-05-18  7:37   ` Jan U. Hasecke
@ 2020-05-18 16:32   ` Wolfgang Schuster
  1 sibling, 0 replies; 4+ messages in thread
From: Wolfgang Schuster @ 2020-05-18 16:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Marco Patzer

Marco Patzer schrieb am 17.05.2020 um 19:04:
> On Sun, 17 May 2020 18:16:13 +0200
> "Jan U. Hasecke" <juh+ntg-context@mailbox.org> 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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-18 16:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-17 16:16 Styling of included buffers or files Jan U. Hasecke
2020-05-17 17:04 ` Marco Patzer
2020-05-18  7:37   ` Jan U. Hasecke
2020-05-18 16:32   ` Wolfgang Schuster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).