ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Pablo Rodriguez <oinos@gmx.es>
To: ntg-context@ntg.nl
Subject: Re: repeat a page inside a document
Date: Thu, 6 Feb 2020 22:04:47 +0100	[thread overview]
Message-ID: <224177fa-90ca-fca9-fa9c-eecd7cd20b40@gmx.es> (raw)
In-Reply-To: <20200206201759.5b5b2a29abf968d9cde9a95a@gmail.com>

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	other threads:[~2020-02-06 21:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-06 15:28 Pablo Rodriguez
2020-02-06 16:15 ` Henning Hraban Ramm
2020-02-06 18:02   ` Pablo Rodriguez
2020-02-06 19:17     ` Wolfgang Schuster
2020-02-06 21:04       ` Pablo Rodriguez [this message]
2020-02-06 21:26         ` Wolfgang Schuster
2020-02-07 20:04           ` Pablo Rodriguez
2020-02-06 16:39 ` Thomas Savary
2020-02-06 18:15   ` Pablo Rodriguez
2020-02-06 18:14 ` Wolfgang Schuster
2020-02-06 19:00   ` Pablo Rodriguez
2020-02-27 14:24 ` context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=224177fa-90ca-fca9-fa9c-eecd7cd20b40@gmx.es \
    --to=oinos@gmx.es \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).