On 2/6/20 8:17 PM, Wolfgang Schuster wrote:
> On Thu, 6 Feb 2020 19:02:08 +0100 Pablo Rodriguez wrote:
>> [...]
>> BTW, in my real-world document I use layers which are different for
>> first and other pages.
>
> How many pages has your document, first you write is has only
> one page but now you write about a document with many pages.

Sorry for the inaccuracies in my previous description, Wolfgang.

I use a single source combined with data read from CSV files to generate
documents which may contain a single or more than one page.

I assumed that modes were persistent across runs. And maybe they aren’t
or my approach is wrong.

>> Could you provide a minimal sample showing how a component may include a
>> page twice?
>
> Can you provide a minimal example of your document because
> there is no solution which works for all cases.

The sample that seems to work is the following (too tricky for my taste
and I have to adapt it to Windows):

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

    \setuppaper[method=savepages]

    \starttext

    \scale[width=\textwidth]{a}
    \scale[width=\textwidth]{b}

    \doifmode{*first}{\executesystemcommand{rm zikaasd.abh}}

    \startnotmode[*first]
      \ifnum\lastpagenumber<2
        \executesystemcommand{touch zikaasd.abh}
        \fi

      \doiffileexistselse{zikaasd.abh}{%
        \startlayout[page]
          \directboxfromcache{savedpages}{1}
        \stoplayout}{}
    \stopnotmode

    \stoptext

I wonder whether there is a better way of doing this.

At least, creating and removing empty files with Lua would be more
portable. And not having to use an external file would be better.

Many thanks for your help,

Pablo
--
http://www.ousia.tk
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to