[NTG-context] image across 2 page spread

Henning Hraban Ramm texml at fiee.net
Thu Apr 30 11:11:23 CEST 2020



> Am 30.04.2020 um 02:05 schrieb jbf <roma83537 at gmail.com>:
> 
> Hi list,
> 
> With 99% of work complete on a book, including single page images, I now find myself confronted with a final problem: how to run one image across facing pages or in other words, one image (plus its caption) across a two-page spread, such that there is no gap.

You need to use \clip and calculate the sections.
Thangalin already gave you an example. Here’s a convoluted one that I use:

% full double page image
% usage:
% \startpostponing[pagenumber]
% \doublepagefig[reference][left/right/width/height*]{caption}{filename}
% \stoppostponing
% * lw,lh,rw,rh - place as left/right page, adapt image to width/height
% default is lw
% postponing is important, otherwise the page numbering gets wrong

\newdimen\Bleed
\newdimen\maxWidth
\newdimen\maxHeight
\newdimen\doubleWidth
\newdimen\topOffset
\newdimen\bottomOffset

\Bleed=3mm
\setupbleeding[offset=\Bleed]
\maxWidth=\dimexpr\paperwidth + \Bleed\relax
\maxHeight=\dimexpr\paperheight + 2\Bleed\relax
\doubleWidth=\dimexpr2\maxWidth\relax
\topOffset=\dimexpr\topspace + \headerheight + \Bleed\relax
\bottomOffset=\dimexpr\bottomheight + \footerheight + \Bleed\relax

\definelayer[bgpicleft][x=-\Bleed,y=-\Bleed,width=\maxWidth,height=\maxHeight] % inkl. Beschnitt
\definelayer[bgpicright][x=0mm,y=-\Bleed,width=\maxWidth,height=\maxHeight] % inkl. Beschnitt

\definemakeup[fullpage][
  page=no,
  doublesided=no,
  headerstate=empty,
  footerstate=empty,
  pagestate=start,
]

\def\doublepagefig{\dodoubleempty\doDoublePagefig}
\def\doDoublePagefig[#1][#2]#3#4{
\startfullpagemakeup
	\setlayer[bgpicleft]{\textreference[#1]{}%
		\clip[
			hoffset=0mm, voffset=0mm,
			width=\maxWidth,
			height=\maxHeight,
		]{%
			\doifinstringelse{h}{#2}{%
				\externalfigure[#4][height=\maxHeight]%
			}{%
				\externalfigure[#4][width=\doubleWidth]%
			}%
		}%
	}
	% set caption into footer (left page)
  \doiftext{#3}{\doifinstring{l}{#2}{%
  	\setlayer[bgpicleft][
      x=\backspace,
      y=\dimexpr\makeupheight + \footerheight\relax,
    ]{%
      \doifmodeelse{blackcaption}{%
        \tfx\vbox{#3}%
      }{%
        \inframed[
        frame=off,background=shadow,
        foregroundcolor=captioncolor,]{%
          \bfx{#3}%\vbox{#3}%
        }%
      }%
    }%
	}}
	% debugging information
	\setlayer[bgpicleft][x=0mm,y=-\Bleed]{%
		\color[debugcolor]{~\tt\bfx #1 / #2 / #4}
	}
\stopfullpagemakeup
\startfullpagemakeup
	\setlayer[bgpicright]{%
		\clip[
			hoffset=\maxWidth,
			voffset=0mm,
			width=\maxWidth,
			height=\maxHeight,
		]{%
			\doifinstringelse{h}{#2}{%
				\externalfigure[#4][height=\maxHeight]%
			}{%
				\externalfigure[#4][width=\doubleWidth]%
			}%
		}%
	}
	% set caption into footer (right page)
  \doiftext{#3}{\doifinstring{r}{#2}{%
  	\setlayer[bgpicright][
      x=\backspace,
      y=\dimexpr\makeupheight + \footerheight\relax,
    ]{%
      \doifmodeelse{blackcaption}{%
        \tfx\vbox{#3}%
      }{%
        \inframed[
          frame=off,background=shadow,foregroundcolor=captioncolor]{%
          \bfx{#3}%\vbox{#3}%
        }%
      }%
    }%
	}}%
	% debugging information
	\setlayer[bgpicright][x=0mm,y=-\Bleed]{%
		\color[captioncolor]{~\tt\bfx #1 / #2 / #4}
	}
\stopfullpagemakeup
} % doublepagefig


You can see the outcome here:
https://www.dreiviertelhaus.de/architekturfuehrer/hicog/


Have fun,
Hraban



More information about the ntg-context mailing list