[NTG-context] help with facing page image

Wolfgang Schuster wolfgang.schuster.lists at gmail.com
Fri Mar 11 13:36:16 CET 2022


jbf schrieb am 09.03.2022 um 23:02:
> Am endeavouring to explore Wolfgang's very 'elegant' solution to this 
> facing page challenge. The exploration has included a look at 
> base/mkxl/page-inj.mklx (thanks Sreeram for reminding me of this) 
> where I see immediately that the approach is experimental and where it 
> says also that 'probably more alternatives will be added'. I wonder if 
> that last phrase also includes the ability to manipulate the image(s) 
> either generally or in individual cases?

Keep your expectations low. I wrote the code (with some changes from 
Hans) to include full page images in novels and the code hasn't changed 
much since 2013.

> So, for example., say I need (and in fact I do!) to change some aspect 
> of individual images, e.g. I might want to scale=500, or fiddle with 
> width/height of a particular image. At the moment I cannot see a way 
> of doing this for each image. I wondered if the commented out setups 
> in the response to this question might be a clue, but so far haven't 
> been able to get that to have any effect.

You have to use a custom alternative (see below) to place the image on 
the page because the default alternative scales the image to fit on the 
available space. The best solution to change orientation, size etc. of 
the included images is to use the \useexternalfigure command and make 
all changes in the style file.


\definepageinjectionalternative
   [chapter:image]
   [renderingsetup=pageinjection:chapter:image]

\startsetups [pageinjection:chapter:image]
   \centerbox{\externalfigure[\dummyparameter{name}]}
\stopsetups

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

\definepageinjection
   [chapter:insert]
   [previouspage]
   [alternative=chapter:image,
    offset=1cm,
    pagestate=stop]

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

\setuppagenumbering
   [alternative=doublesided]

\setupexternalfigures
   [location=default]

\useexternalfigure [chapter-1] [mill]   [factor=max]
\useexternalfigure [chapter-2] [hacker] [orientation=90,scale=2000]
\useexternalfigure [chapter-3] [cow] [orientation=90,height=\framedwidth]

\starttext

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

\startchapter [title={Hacker}]
\dorecurse{11}{\samplefile{lorem}}
\stopchapter

\startchapter [title={cow}]
\dorecurse{7}{\samplefile{lorem}}
\stopchapter

\stoptext

Wolfgang



More information about the ntg-context mailing list