[NTG-context] Let chapter start on odd page and make the even page before show an image

Wolfgang Schuster wolfgang.schuster.lists at gmail.com
Fri May 29 12:45:31 CEST 2020


juh schrieb am 29.05.2020 um 10:29:
> Dear all,
>
> with your help I can colorize the empty even page right before a chapter starts
> on the odd page. The mwe below shows it.
>
> Now I would like to redefine the contents of the left page on the fly in the text
> so that I could place images on this page.
>
> I thought that I could get a simple solution by inserting a TEXpage as even
> page, but this does not work for several reasons. First a TEXpage is not counted
> correctly like a normal page.  And secondly I found now way to put it on the
> even page.
>
> So what I really want to achieve is a way to redefine this setups at some point
> in the text to insert eg. a picture on the even page before a chapter.
>
> \startsetups [chapter:before]
>    \doifoddpageelse
>      {}
>      {\pushbackground[page]
>       \setupbackgrounds[page][background=color,backgroundcolor=blue,]
>       \page[empty,right]
>       \popbackground}
> \stopsetups
>
> Here comes the not so mwe:
>
> %% start mwe
> \setuplayout [ location=doublesided ]
> \setuppagenumbering[alternative=doublesided]
> \definepagebreak [chapter] [footer,yes,header,footer,right]
>
> \startsetups [chapter:before]
>    \doifoddpageelse
>      {}
>      {\pushbackground[page]
>       \setupbackgrounds[page][background=color,backgroundcolor=blue,]
>       \page[empty,right]
>       \popbackground}
> \stopsetups
>
> \setuphead
>    [chapter]
>    [
>     page=yes,
>     before=\directsetup{chapter:before},
>    ]
>
> \setupexternalfigure[location=default]
>
> \starttext
>
> \startchapter
>    [title={foo}]
>
>    \dorecurse{2}{\input tufte \par}
>
> \stopchapter
>
> \startchapter
>    [title={foo2}]
>
>    \dorecurse{6}{\input tufte \par}
>
> \stopchapter
>
> \startchapter
>    [title={bar}]
>
>      \input knuth
>
> \startTEXpage
>    \externalfigure[cow.pdf][height=\paperheight,width=\paperwidth]
> \stopTEXpage
>
> \stopchapter
>
>
> \startchapter
>    [title={baz}]
>
>      \input knuth
>
> \stopchapter
>
> \stoptext
> %% stop mwe
>
> As you see the image is not in the right place and of course the pagenumbering
> is wrong.
Use \startTEXpage[pagestate=start] to increase the page number with TEX 
pages.
> I want that one of these blue pages shows an image. Is this possible?
Yes but there are different ways for different requirements.

- Do you you have a picture before *every* chapter?
- Do you use full page images?
- Are the images cropped to fit the page dimension, stretched or 
centered with margins?
- ...

Wolfgang



More information about the ntg-context mailing list