From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/75743 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: [***SPAM***] Resetting Page Backgrounds Date: Thu, 19 Apr 2012 14:17:32 -0400 (EDT) Message-ID: References: <818B939E-2440-4566-A072-1A3A2DF00890@synterein.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1334859470 14787 80.91.229.3 (19 Apr 2012 18:17:50 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 19 Apr 2012 18:17:50 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Apr 19 20:17:46 2012 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SKvvN-00008n-Tj for gctc-ntg-context-518@m.gmane.org; Thu, 19 Apr 2012 20:17:45 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 0166F101F1; Thu, 19 Apr 2012 20:17:45 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with LMTP id bBdNll+Lbk8g; Thu, 19 Apr 2012 20:17:43 +0200 (CEST) Original-Received: from [127.0.0.1] (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 90DA3101E1; Thu, 19 Apr 2012 20:17:43 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 2D004101E1 for ; Thu, 19 Apr 2012 20:17:43 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Se2hDv+nbii9 for ; Thu, 19 Apr 2012 20:17:42 +0200 (CEST) Original-Received: from filter3-ams.mf.surf.net (filter3-ams.mf.surf.net [192.87.102.71]) by balder.ntg.nl (Postfix) with ESMTP id 7B679101E0 for ; Thu, 19 Apr 2012 20:17:42 +0200 (CEST) Original-Received: from tombraider.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.12.86]) by filter3-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id q3JIHeaJ010421 for ; Thu, 19 Apr 2012 20:17:41 +0200 Original-Received: FROM adi-netbook (bas3-montreal02-1096682554.dsl.bell.ca [65.94.12.58]) By tombraider.mr.itd.umich.edu ID 4F9056C3.1CBF.10074 ; Authuser adityam; 19 Apr 2012 14:17:39 EDT In-Reply-To: User-Agent: Alpine 2.02 (LNX 1266 2009-07-14) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=141.211.12.86; country=US; region=MI; city=Ann Arbor; postalcode=48109; latitude=42.2923; longitude=-83.7145; metrocode=505; areacode=734; http://maps.google.com/maps?q=42.2923,-83.7145&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0LGXShEHO - 9376741e18f5 - 20120419 X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.71 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:75743 Archived-At: On Thu, 19 Apr 2012, Aditya Mahajan wrote: > On Wed, 18 Apr 2012, Raymond LeClair wrote: > >> I have written Python classes to automate reading a Tumblr blog and writing >> a file for processing by ConTeXt. No manual editing of the ConTeXt input >> file is allowed. >> >> Photos are incorporated in a graphic created using METAPOST commands >> embedded in the ConTeXt input file. Then the graphic is used as a >> background. I need this background to appear only on one page. >> >> My current solution is to use TeX conditionals to test if the page number >> has incremented, then reset the background to empty. This approach fails in >> many cases. The code below provides a minimum working example of a failure. >> Photos are shown as squares to reduce the size of this post. >> >> Is there a better way to reset the background? If you know the page numbers in advance, you can also set the layer content in the preamble. \startuseMPgraphic{test-metapost-1} StartPage; fill Page withcolor 0.25[blue,white]; StopPage; \stopuseMPgraphic \startuseMPgraphic{test-metapost-2} StartPage; fill Page withcolor 0.25[green,white]; StopPage; \stopuseMPgraphic \definelayer [test-layer] [ width=\paperwidth, height=\paperheight, state=repeat, frame=on, ] \definelayer[test-layer:2][test-layer] \definelayer[test-layer:3][test-layer] \setMPlayer[test-layer:2]{\useMPgraphic{test-metapost-1}} \setMPlayer[test-layer:3]{\useMPgraphic{test-metapost-2}} \setupbackgrounds[page][background={test-layer}] \starttext \dorecurse{20}{\input knuth} \stoptext Aditya ___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________