Appreciate your assistance. I'll do my best with what you offer here. Of course, I've always said these images are at the beginning, not "the end of their respective chapters" and I've already indicated how the images are named, simply as Chapter1.jpg and so on, so I'll need to work around these differences in your example. But with trial and error, let's hope I get there! Thank you, Julian On 7/3/22 18:01, śrīrāma wrote:
On Monday, March 7, 2022 11:50 AM jbf wrote:
All ten images are different, though, in my case (Chapter1.jpg, Chapter2.jpg... Chapter10.jpg all in a pics directory, so I'd point \setupexternalfigures to that). I wonder if there is a way to list them so that they get called in order as chapters proceed. A kind of "if such and such then \setlayer 1,2,3...." I think that should be easy. Suppose you have images {chap-cover-1.jpg, chap-cover-2.jpg, ... chap-cover-10.jpg} each of which appear at the ends of their respective chapters, then the following achieves what you want (once you point ConTeXt to the right directory for figures of course):
% kate: hl ctx %%% SOF \setuppagenumbering[alternative=doublesided]
\definelayer [chapCover] [x=0mm, y=0mm, width=\paperwidth, height=\paperheight,repeat=yes]
\startsetups chapter:before \doifoddpageelse{} {\pushbackground[page] \resetlayer[chapCover] \setlayer [chapCover] {\determineheadnumber[chapter] \externalfigure [chap-cover-\currentheadnumber] [width=\paperwidth]} \setupbackgrounds[page][background=chapCover] \page[empty] \popbackground} \stopsetups
\startsetups chapter:after \doifoddpageelse{} {\page[empty]} \stopsetups
\setuphead [chapter] [page=yes, before=\directsetup{chapter:before}, aftersection=\directsetup{chapter:after}]
\starttext \dorecurse{10}{ \startchapter[title={Chapter \convertnumber{word}{\recurselevel}}] \input knuth \ifnum\headnumber[chapter]=5 {\bfd five} \fi \blank \input tufte \blank \input ward \blank \ifnum\recurselevel=5 \page \input zapf \input zapf \fi \stopchapter } \stoptext %%% EOF
So we figure out which chapter we are in and then set the layer to the corresponding picture. Personally, I much prefer to collect all the images into a separate PDF with:
%%% chap-covers.tex \starttext \dorecurse{10}{\startTEXpage \externalfigure[chap-cover-\recurselevel] \stopTEXpage} \stoptext %%% EOF
[and get 'chap-covers.pdf' from context]
... and then modify the 'before' setup to read as below
%%% \startsetups chapter:before \doifoddpageelse{} {\pushbackground[page] \resetlayer[chapCover] \setlayer [chapCover] {\determineheadnumber[chapter] \externalfigure [chap-covers] [page=\currentheadnumber,width=\paperwidth]} \setupbackgrounds[page][background=chapCover] \page[empty] \popbackground} \stopsetups %%%
Sreeram