User talk:Christian.Dekant

From Wiki
Jump to navigation Jump to search

Layout for part double pages: title on odd page, full size image on even page

This is an example of setting up the opening double page of a new part so, that the title of the new part is placed on the right/odd side and a full page image (including bleed) is placed on the even/left page.

Just replace all occurrences of "part" by "chapter" to do this for ... chapters :)

Thanks and credits go to Wolfgang Schuster who originally answered this question on the mailing list (https://www.mail-archive.com/ntg-context@ntg.nl/msg94587.html)

\definedataset[part]

\startsetups [part:before]
  \page[yes]
  \doglobal\increment\PartCounter
  \doifoddpageelse
    {\page[empty]
    \doifsomething
       {\datasetvariable{part}{\PartCounter}{image}}
       {\startlayout[page]
        \centerbox{\externalfigure
        	[\datasetvariable{part}{\PartCounter}{image}][factor=min,width=\printpaperwidth,height=\printpaperheight]}
        \stoplayout}}
    {\doifsomething
       {\datasetvariable{part}{\PartCounter}{image}}
       {\startlayout[page]
        \centerbox{\externalfigure
        	[\datasetvariable{part}{\PartCounter}{image}][factor=min,width=\printpaperwidth,height=\printpaperheight]}
        \stoplayout}}
\stopsetups

\setuphead
  [part]
  [placehead=yes,
  page=,
  beforesection=\directsetup{part:before},
  insidesection={\setdataset[part][\PartCounter][image=\structureuservariable{image}]}
  ]

\setupexternalfigure[location=default]

\starttext

\startpart [title={Tufte}] [image=cow]
\dorecurse{4}{\samplefile{tufte}}
\stoppart

\startpart [title={Knuth}] [image=mill]
\dorecurse{8}{\samplefile{knuth}}
\stoppart

\startpart [title={Zapf}] [image=hacker]
\dorecurse{6}{\samplefile{zapf}}
\stoppart

\stoptext