[NTG-context] repeat a page inside a document

Wolfgang Schuster wolfgang.schuster.lists at gmail.com
Thu Feb 6 19:14:54 CET 2020


On Thu, 6 Feb 2020 16:28:04 +0100
Pablo Rodriguez <oinos at gmx.es> wrote:

> Dear list,
> 
> I have the following sample:
> 
>     \starttext
>     \input knuth
>     \page[right]
>     \setuplayout[page]
>         \externalfigure[\jobname.pdf][page=1]
>     \stoptext
> 
> My question is how to get a page from the document you‘re compiling
> repeated inside the same document.
> 
> I have tried to search both i-context.pdf and the wiki, but “mirror” and
> “repeat” seem to be bad options.

You can store each finished page in a box and access the content
of the stored box afterwards.

\installshipoutmethod{savepages}
  {\dowithnextbox
     {\invokepagehandler{normal}{\copy\nextbox}%
      \putboxincache{savedpages}{\number\realpageno}\nextbox}
   \hbox}

\setuppaper[method=savepages]

\starttext

\dorecurse{8}
  {\expanded{\chapter{Chapter \recurselevel}}
   \dorecurse{\recurselevel}{\samplefile{weisman}}}

\startlayout[page]
\directboxfromcache{savedpages}{5}
\page
\directboxfromcache{savedpages}{2}
\stoplayout

\stoptext

Wolfgang


More information about the ntg-context mailing list