Re: [NTG-context] Disable overlay on chapter pages

2017-08-04 Thread Mikael P. Sundqvist
On Fri, Aug 4, 2017 at 9:53 AM, Hans Hagen  wrote:
> On 8/3/2017 8:11 PM, Mikael P. Sundqvist wrote:
>
>> that solves the other problem that appeared. What about the one I
>> originally posted in this thread? Is it possible to pause backgrounds
>> on chapter pages?
>
> one of the many ways ...
>
> \definelayer
>   [chapter]
>   [width=\paperwidth,
>height=\paperheight]
>
> \defineoverlay
>   [pagebackground]
>   [\directsetup{pagebackground}]
>
> \setupbackgrounds
>   [page]
>   [background=pagebackground]
>
> \startsetups pagebackground
> \doifelsemode {chapterpage} {
> \setlayer
>   [chapter]
>   [preset=middle]
>   {\scale[width=\textwidth]{CHAPTER}}
> \globaldisablemode[chapterpage]
> } {
> \setlayer
>   [chapter]
>   [preset=middle]
>   {\scale[width=\textwidth]{WHATEVER}}
> }
> \placelayer[chapter]
> \stopsetups
>
> \startsetups chapter:before
> \globalenablemode[chapterpage]
> \stopsetups
>
> \setuphead
>   [chapter]
>   [before=\setup{chapter:before}]
>
> \starttext
> \chapter{foo} test \page test
> \chapter{bar} test \page test
> \stoptext
>
> -
>   Hans Hagen | PRAGMA ADE
>   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
> ___
> 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
> ___

Many thanks! It now works as expected. Just if someone finds this
thread in the future, to get the texts into the margin, I ended up
with something like the code below.

/Mikael


\showframe

\setuppagenumbering[alternative=doublesided]

\setuplayout[
%alternative=doublesided,
location=middle,
width=10cm,
backspace=2in,
]


\definelayer
  [chapter]
  [width=\paperwidth,
   height=\paperheight,
   location=right]

\defineoverlay
  [pagebackground]
  [\directsetup{pagebackground}]

\setupbackgrounds
  [page]
  [background=pagebackground]

\startsetups pagebackground
\doifelsemode {chapterpage} {
\setlayer
  [chapter]
  [x=\dimexpr\backspace+\textwidth+\rightmargindistance\relax,
   y=3in,
   location={right,bottom}]
  {\getmarking[chapternumber]}
\globaldisablemode[chapterpage]
} {
\setlayer
  [chapter]
   [x=\dimexpr\backspace+\textwidth+\rightmargindistance\relax,
   y=3in,
   location={right,bottom}]
  {\doifrightpageelse{\getmarking[chapter]}{}}
}
\placelayer[chapter]
\stopsetups

\startsetups chapter:before
\globalenablemode[chapterpage]
\stopsetups

\define[2]\mychaptercommand{\midaligned{#2}}

\setuphead
  [chapter]
  
[align=middle,style=\tfa,align=middle,command=\mychaptercommand,before=\setup{chapter:before}]

\starttext
\chapter{foo} test \page test \page test \page test
\chapter{bar} test \page test \page test \page test


\stoptext
___
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
___

Re: [NTG-context] source code and result side by side

2017-08-04 Thread Henning Hraban Ramm
Am 2017-08-04 um 06:30 schrieb Henri Menke :

> On 08/04/2017 07:46 AM, Henning Hraban Ramm wrote:
>> Am 2017-07-31 um 03:26 schrieb Aditya Mahajan :
>> 
>>> You can't do that with buffers. If you need to define your own macros that 
>>> behave like buffers, you need to use \grabbufferdata (see buff-ini.mkiv). 
>>> But in this case, there is a simpler solution:
>>> 
>>> \defineframed
>>> [CodeExampleFramed]
>>> [
>>>   frame=off,
>>>   width=0.5\textwidth,
>>>   align=normal,
>>> ]
>>> 
>>> \definebuffer
>>>   [CodeExample]
>>> 
>>> \define\stopCodeExample
>>>   {\placesidebyside
>>> {\CodeExampleFramed{\typeCodeExample}}
>>> {\CodeExampleFramed{\getCodeExample}}}
>> 
>> Oh, I overlooked something:
>> Can I get pretty printing back, like in \startTEX ... \stopTEX?
>> 
>> I couldn’t find any suitable setup options.
> 
> \typebuffer[whatever][option=tex]

\typebuffer[CodeExample][option=tex] doesn’t do anything,
but \typeCodeExample[option=tex] actually works, I didn’t expect that.
Thank you!


Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
GPG Key ID 1C9B22FD

___
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
___

Re: [NTG-context] Disable overlay on chapter pages

2017-08-04 Thread Hans Hagen

On 8/3/2017 8:11 PM, Mikael P. Sundqvist wrote:


that solves the other problem that appeared. What about the one I
originally posted in this thread? Is it possible to pause backgrounds
on chapter pages?

one of the many ways ...

\definelayer
  [chapter]
  [width=\paperwidth,
   height=\paperheight]

\defineoverlay
  [pagebackground]
  [\directsetup{pagebackground}]

\setupbackgrounds
  [page]
  [background=pagebackground]

\startsetups pagebackground
\doifelsemode {chapterpage} {
\setlayer
  [chapter]
  [preset=middle]
  {\scale[width=\textwidth]{CHAPTER}}
\globaldisablemode[chapterpage]
} {
\setlayer
  [chapter]
  [preset=middle]
  {\scale[width=\textwidth]{WHATEVER}}
}
\placelayer[chapter]
\stopsetups

\startsetups chapter:before
\globalenablemode[chapterpage]
\stopsetups

\setuphead
  [chapter]
  [before=\setup{chapter:before}]

\starttext
\chapter{foo} test \page test
\chapter{bar} test \page test
\stoptext

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
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
___