[NTG-context] help with facing page image

jbf roma83537 at gmail.com
Mon Mar 7 04:49:28 CET 2022


I wonder if someone can help me untangle the current little mess I seem 
to be creating!

Author wants an image on facing page to each of 10 chapters in the 
bodypart of the document. Assume that everything else is working 
properly for this document (double-sided etc.), but other than before 
chapter 1, I can't seem to get my facing page image to appear where it 
should!

A question along these lines (but not quite the same) was asked back in 
2019, so I started with what seemed to me to be the simplest response to 
this question. Here is what I have to get the image before Chapter 1 in 
bodymatter:

\startbodymatter

\definelayer[mylayer] % name of the layer

[x=0mm, y=0mm, % from upper left corner of paper

width=\paperwidth,height=\paperheight] % let the layer cover the full paper

\setlayer[mylayer]

[hoffset=2.5cm, voffset=3cm]

{\externalfigure[Chapter1.jpg][width=.9\textwidth]}

\doifoddpageelse

{}

{\pushbackground[page]

\setupbackgrounds[page]%[background=color,backgroundcolor=red]

[background=mylayer]

\page[empty]

\popbackground}

\startchapter[title={Prelude}] etc.....

This correctly places the Chapter1.jpg on the facing page to Chapter 1. 
My problem comes with Chapter 2, since Chapter 1 finishes on an even 
page, and this means I would need a blank odd page to follow that so 
that Chapter2.jpg (a different image to the first) can be on the verso 
of that and the Chapter itself would then start on the odd page facing that.

I think the \doiffoddpageelse command above is only meant to work when a 
chapter ends on an odd, not an even page, but I do not know what 
alternative command to give.

Repeating the above set of commands prior to \startchapter for chapter 2 
places the image, naturally enough, behind the last page of text for 
Chapter 1, which is unacceptable, so I thought I could simply add a 
blank page or two after the chapter and it would all fall into place. I 
tried various ways of doing that (e.g. \page[+2], or using makeup 
pages), and while I can add pages that way, I can't get the image to 
appear.

No doubt the solution is simple enough. It might also lie in the 
\setuphead[chapter] arrangement too. I've tried page=yes there, but to 
no avail. I also tried \ startsetups[chapter:before] with the 
pushbackground etc command and added that in with 
before=\directsetup{chapter:before} as suggested in the wiki, but 
couldn't get that to work either. By that stage I was so tangled up in 
the problem I may not have been able to think straight :-). Somehow, 
though, I think most of the elements are there.

Any help would be appreciated.

Julian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20220307/dc7f5401/attachment.htm>


More information about the ntg-context mailing list