ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
To: "Jan U. Hasecke" <juh+ntg-context@mailbox.org>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Let chapter start on odd page and make the even page before show an image
Date: Fri, 29 May 2020 15:35:21 +0200	[thread overview]
Message-ID: <74709d8a-9c24-cfe9-6d7e-86f5aed0e63a@gmail.com> (raw)
In-Reply-To: <91f5fd8f-5355-38b2-e079-806c4f4cad4a@mailbox.org>

Jan U. Hasecke schrieb am 29.05.2020 um 15:10:
> Am 29.05.20 um 12:45 schrieb Wolfgang Schuster:
>> 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
>>>
>>> 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.
> Thanks for this hint.
>
>>> 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?
> No, the additional image page shall appear only if the last chapter ends
> on an odd page. Then I need the image page to push the new chapter to
> the next odd page.
>
>> - Do you use full page images?
>> - Are the images cropped to fit the page dimension, stretched or
>> centered with margins?
> For this usecase images are blown up and cropped to fit the page
> dimension including the bleed.

\setuppagenumbering
   [alternative=doublesided]

\setupexternalfigures
   [location=default]

\definedataset [chapter]

\startsetups [chapter:before]

   \page[yes]

   \doglobal\increment\ChapterCounter

   \doifoddpageelse
     {}
     {\doifsomething
        {\datasetvariable{chapter}{\ChapterCounter}{image}}
        {\startlayout[page]
         \centerbox{\externalfigure
[\datasetvariable{chapter}{\ChapterCounter}{image}][factor=min]}
         \stoplayout}}

\stopsetups

\setuphead
   [chapter]
   [page=,
    beforesection=\directsetup{chapter:before},
insidesection={\setdataset[chapter][\ChapterCounter][image=\structureuservariable{image}]}]

\setupexternalfigure[location=default]

\starttext

\startchapter [title={Tufte}] [image=cow]
\dorecurse{4}{\samplefile{tufte}}
\stopchapter

\startchapter [title={Knuth}] [image=mill]
\dorecurse{8}{\samplefile{knuth}}
\stopchapter

\startchapter [title={Zapf}] [image=hacker]
\dorecurse{6}{\samplefile{zapf}}
\stopchapter

\stoptext

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
___________________________________________________________________________________

  reply	other threads:[~2020-05-29 13:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-29  8:29 juh
2020-05-29 10:45 ` Wolfgang Schuster
2020-05-29 13:10   ` Jan U. Hasecke
2020-05-29 13:35     ` Wolfgang Schuster [this message]
2020-05-29 15:42       ` Jan U. Hasecke
2020-05-29 16:03         ` Aditya Mahajan
2020-05-29 17:27           ` Jan U. Hasecke
2020-05-29 20:13             ` Henning Hraban Ramm
2020-05-29 20:18               ` Aditya Mahajan
2020-05-29 21:20                 ` Henning Hraban Ramm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74709d8a-9c24-cfe9-6d7e-86f5aed0e63a@gmail.com \
    --to=wolfgang.schuster.lists@gmail.com \
    --cc=juh+ntg-context@mailbox.org \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).