[NTG-context] repeat a page inside a document

Pablo Rodriguez oinos at gmx.es
Thu Feb 6 20:00:11 CET 2020


On 2/6/20 7:14 PM, Wolfgang Schuster wrote:
> On Thu, 6 Feb 2020 16:28:04 +0100 Pablo Rodriguez wrote:
>> [...]
>> 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.

Huge thanks for your reply and the code, Wolfgang.

I have just checked “TeX for the Impatient” to understand what shipout
methods and boxes were. I think I can barely grasp their meaning.

Which are other usages for shipouts and boxes? I guess they are used to
add pages in the final PDF document, but I don’t see which other uses
they may have.

BTW, “invokepagehandler” reads “invokepageheandler” in the following
files from the ConTeXt Suite (I don’t know whether the first is the real
source of the rest of them):

* texmf-context/tex/context/interface/mkiv/i-imposition.xml
* texmf-context/tex/context/interface/mkiv/context-en.xml
*
texmf-context/context/data/vscode/extensions/context/syntaxes/context-syntax-tex.json
*
texmf-context/context/data/textadept/context/data/scite-context-data-interfaces.lua
*
texmf-context/context/data/scite/context/lexers/data/scite-context-data-interfaces.lua
*
texmf-context/context/data/scite/context/scite-context-data-interfaces.properties

Many thanks again for your help,

Pablo


> \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

--
http://www.ousia.tk


More information about the ntg-context mailing list