[NTG-context] Re: How to span an image across two pages with a caption?

2025-03-21 Thread jbf
Here is a simple example that worked for me. I had to make some 
adjustments to the caption, but the key issue was to get the spread to 
work as it should, and it did.


%plates 12,13 facing
\startpostponing
    \setuppagenumbering[state=stop]
    \startspread
\startplacefigure[location=here,title={\framedtext[width=\textwidth,frame=off,align=right]{\switchtobodyfont[9.5pt] 
{\sc Plates 12/13.} Caption goes here}}]

    \externalfigure[plate12-13.jpg][height=.9\textheight]%
    \stopplacefigure
    \stopspread
    \setuppagenumbering[state=start]
\stoppostponing


Julian

On 22/3/25 06:55, Joel via ntg-context wrote:
I am trying to do this, basically my document has some floats, with 
captions, that appear within the text, but occasionally, I want some 
special images to be rendered across the full page (left and right). 
The text of the chapter should appear on the pages before this and 
after it, but not on the page with these images. And the page 
number/headings shouldn't appear. Ideally the caption just is 
displayed bottom left, on the left-side / verso page.


Is there a simple way to achieve that?

I found and modified this code on-line, which it works well, but it 
isn't flexible, in that my document might have 20 more such images, 
and this way that its defined means a lot of redundant code used:


%%% Full-Page Graphics

\unprotect

\useexternalfigure [railroad] [P1976-48-33b] [
  width=2\paperwidth,
  height=\paperheight,
]

\newcount\railcount

\def\pickhalfrail_cmd{%
  \setupclipping [nx=2,ny=1]%
  \ifnum\railcount>0
    \ifodd\pagenumber %% clip right half
  \clip[x=2,y=1]
    \else %% clip left half
  \clip[x=1,y=1]
    \fi{\externalfigure[railroad]}%
    \global \advance \railcount \minusone
  \fi%
}

\defineoverlay [pickhalfrail] [\pickhalfrail_cmd]
\setupbackgrounds [paper] [background=pickhalfrail]

\def\railbackgrounds{%
\pagebreak
\null
\pagebreak
\global\railcount=2
\page[imagetopagebreak]
\null
\page[imagetopagebreak]
\null
\page[imagetopagebreak]
\null
}

%% Adjust page style to hide text when images appear
\definepagebreak[imagetopagebreak][yes,header,footer]


___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist :[email protected] 
/https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  :https://www.pragma-ade.nl /https://context.aanhet.net (mirror)
archive  :https://github.com/contextgarden/context
wiki :https://wiki.contextgarden.net
__
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : [email protected] / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: How to span an image across two pages with a caption?

2025-03-21 Thread Henning Hraban Ramm

Am 21.03.25 um 20:55 schrieb Joel via ntg-context:
I am trying to do this, basically my document has some floats, with 
captions, that appear within the text, but occasionally, I want some 
special images to be rendered across the full page (left and right). The 
text of the chapter should appear on the pages before this and after it, 
but not on the page with these images. And the page number/headings 
shouldn't appear. Ideally the caption just is displayed bottom left, on 
the left-side / verso page.


Is there a simple way to achieve that?


Here’s some code that I use, oldfashioned and not complete.

The main tricks:
* postponing to reserve the space
* fullpagemakeup to clear the page
* clip to split the image


\definemeasure[Bleed][3mm]
\definemeasure[Trim][7.5mm]
\definemeasure[maxWidth][\paperwidth + \measured{Bleed}]
\definemeasure[maxHeight][\paperheight + 2\measured{Bleed}]
\definemeasure[doubleWidth][2\measured{maxWidth}]
\definemeasure[topOffset][\topspace + \headerheight + \measured{Bleed}]
\definemeasure[bottomOffset][\bottomheight + \footerheight + 
\measured{Bleed}]

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


% full double page image
% reference, placecode, caption, filename, see above
% usage:
% \startpostponing[pagenumber]
% \doublepagefig[reference][left/right/width/height*]{caption}{filename}
% \stoppostponing
% * lw,lh,rw,rh - place caption on left/right page, adapt image to 
width/height

% default is lw
% postponing is important, otherwise the page numbering gets wrong

\def\doublepagefig{\dodoubleempty\doDoublePagefig}
\def\doDoublePagefig[#1][#2]#3#4{
\startfullpagemakeup
\setlayer[bgpicleft]{\textreference[#1]{}%
\clip[
hoffset=0mm, voffset=0mm,
width=\measure{maxWidth},
height=\measure{maxHeight},
]{%
\doifinstringelse{h}{#2}{%
\externalfigure[#4][height=\measure{maxHeight}]%
}{%

\externalfigure[#4][width=\measure{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}%
  }{\bfx%
% \inframed[
%   frame=off,background=shadow,
%   foregroundcolor=captioncolor,
% ]{%
%   \bfx{#3}%\vbox{#3}%
% }%
{#3}%
  }%
}%
}}
% debugging information
\setlayer[bgpicleft][x=0mm,y=-\measure{Bleed}]{%
\color[debugcolor]{~\tt\bfx #1 / #2 / #4}
}
\stopfullpagemakeup
\startfullpagemakeup
\setlayer[bgpicright]{%
\clip[
hoffset=\measure{maxWidth},
voffset=0mm,
width=\measure{maxWidth},
height=\measure{maxHeight},
]{%
\doifinstringelse{h}{#2}{%
\externalfigure[#4][height=\measure{maxHeight}]%
}{%

\externalfigure[#4][width=\measure{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}%
  }{\bfx%
% \inframed[
%   frame=off,
%   background=shadow,
%   foregroundcolor=captioncolor,
% ]{%
%   \bfx{#3}%
% }%
{#3}%
  }%
}%
}}%
% debugging information
\setlayer[bgpicright][x=0mm,y=-\measure{Bleed}]{%
\color[captioncolor]{~\tt\bfx #1 / #2 / #4}
}
\stopfullpagemakeup
} % doublepagefig


Hraban

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : [email protected] / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___