[NTG-context] help with facing page image

Wolfgang Schuster wolfgang.schuster.lists at gmail.com
Mon Mar 7 19:35:15 CET 2022


jbf via ntg-context schrieb am 07.03.2022 um 09:27:
> 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!

The example below uses a different mechanism to add images at the start 
of a chapter. In the example you have to pass the name of image as 
userdata argument of \startchapter but in the commented \setuphead 
setting you can see how this can be automated.

%%%% begin example
% \definepageinjectionalternative
%   [chapter:image]
%   [renderingsetup=pageinjection:chapter:image]
%
% \startsetups [pageinjection:chapter:image]
%   \clip
%     [width=\framedwidth,height=\framedheight]
%     {\centerbox{\externalfigure[\dummyparameter{name}][factor=min]}}
% \stopsetups

\definepageinjection
   [chapter:start]
   [empty]
   [page=left]

\definepageinjection
   [chapter:insert]
   [previouspage]
   [%alternative=chapter:image,
    pagestate=stop]

\setuphead
   [chapter]
   [beforesection={\pageinjection[chapter:start]},
insidesection={\pageinjection[chapter:insert][name=\structureuservariable{image}]}]

% \setuphead
%   [chapter]
%   [beforesection={\pageinjection[chapter:start]},
% 
insidesection={\pageinjection[chapter:insert][name={chapter\namedheadnumber{chapter}}]}]

\setuppagenumbering
   [alternative=doublesided]

\setupexternalfigures
   [location=default]

\starttext

\startchapter [title={Mill}] [image=mill]
\dorecurse{7}{\samplefile{lorem}}
\stopchapter

\startchapter [title={Mill}] [image=mill]
\dorecurse{11}{\samplefile{lorem}}
\stopchapter

\startchapter [title={Mill}] [image=mill]
\dorecurse{7}{\samplefile{lorem}}
\stopchapter

\stoptext
%%%% end example

Wolfgang



More information about the ntg-context mailing list