From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/84726 Path: news.gmane.org!not-for-mail From: Philipp Gesang Newsgroups: gmane.comp.tex.context Subject: Re: Code Called Twice? Date: Fri, 11 Oct 2013 13:00:31 +0200 Message-ID: <20131011110031.GA22197@tartaros> References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0836910145==" X-Trace: ger.gmane.org 1381489236 1584 80.91.229.3 (11 Oct 2013 11:00:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 11 Oct 2013 11:00:36 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Oct 11 13:00:40 2013 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([5.39.185.229]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VUaSV-0003aM-HE for gctc-ntg-context-518@m.gmane.org; Fri, 11 Oct 2013 13:00:39 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 6C974101EB; Fri, 11 Oct 2013 12:58:03 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 8pKv7CVkux3j; Fri, 11 Oct 2013 12:58:00 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id C5183101DE; Fri, 11 Oct 2013 12:58:00 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 33E8D101DE for ; Fri, 11 Oct 2013 12:58:00 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id dYq9Jy4K2s5t for ; Fri, 11 Oct 2013 12:57:58 +0200 (CEST) Original-Received: from filter2-til.mf.surf.net (filter2-til.mf.surf.net [194.171.167.218]) by balder.ntg.nl (Postfix) with ESMTP id A950410193 for ; Fri, 11 Oct 2013 12:57:58 +0200 (CEST) Original-Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by filter2-til.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r9BB0W8U003099 for ; Fri, 11 Oct 2013 13:00:33 +0200 Original-Received: from ix.urz.uni-heidelberg.de (cyrus-portal.urz.uni-heidelberg.de [129.206.100.176]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id r9BB0Vjd021928 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 11 Oct 2013 13:00:31 +0200 Original-Received: from extmail.urz.uni-heidelberg.de (extmail.urz.uni-heidelberg.de [129.206.100.140]) by ix.urz.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id r9BB0VZW023835 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 11 Oct 2013 13:00:31 +0200 Original-Received: from localhost (p4FFFD17E.dip0.t-ipconnect.de [79.255.209.126]) (authenticated bits=0) by extmail.urz.uni-heidelberg.de (8.13.4/8.13.1) with ESMTP id r9BB0TGk030402 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Fri, 11 Oct 2013 13:00:30 +0200 Mail-Followup-To: mailing list for ConTeXt users In-Reply-To: X-Operating-System: Linux tartaros 3.9.6-1-ARCH User-Agent: Mutt/1.5.21 (2010-09-15) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=129.206.100.212; country=DE; region=01; city=Heidelberg; latitude=49.4167; longitude=8.7000; http://maps.google.com/maps?q=49.4167,8.7000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0TKzL0wkV - e29289676c01 - 20131011 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.218 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:84726 Archived-At: --===============0836910145== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="MGYHOYXEY6WxJCY8" Content-Disposition: inline --MGYHOYXEY6WxJCY8 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable =C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7 >=20 > I noticed something unexpected with the following code: >=20 > \enabletrackers[metapost.showlog] >=20 > \startuseMPgraphic{heading:ThemeTitleStyle} > show "HEADING:THEMETITLESTYLE"; > show \MPstring{heading:title}; >=20 > draw textext( \MPstring{heading:title} ) rotated 5 > withcolor blue; > \stopuseMPgraphic >=20 > \defineframed[ThemeTitleStyle][ > background=3D\useMPgraphic{ThemeTitleStyle}, > ] >=20 > \def\processword#1{% > \setMPtext{heading:title}{#1}% > \useMPgraphic{heading:ThemeTitleStyle} > } >=20 > \define[1]\ThemeChapterTitle{\applytosplitstringword\processword{#1}} > \setuphead[chapter][deeptextcommand=3D{\ThemeChapterTitle}] >=20 > \starttext > \startchapter[title=3DWhy Is heading:ThemeTitleStyle Called Twice?] > \input knuth > \stopchapter > \stoptext >=20 > It appears as though heading:ThemeTitleStyle is being called twice: >=20 > metapost > info: > >> "HEADING:THEMETITLESTYLE" > >> "Why" > metapost > info: > >> "HEADING:THEMETITLESTYLE" > >> "Why" >=20 > I am trying to produce a random number that is not equal to the > previous random number. However, if the code is called twice, then I'd > have to add code to ignore one of the calls. >=20 > Any ideas why the code seems to be called twice and what can be done > to ensure that it is only called once? Don=E2=80=99t use text ;-) That=E2=80=99s a known issue: as soon as your Me= tapost code contains text, it will be processed twice. E.g.: \starttext \setMPtext{heading:title}{foo} \startMPcode show "This gets printed twice."; draw textext( \MPstring{heading:title} ); \stopMPcode \stoptext Same for labels, {b,e}tex. See also this thread: http://www.ntg.nl/pipermail/ntg-context/2011/056047.html Best regards, Philipp --MGYHOYXEY6WxJCY8 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.21 (GNU/Linux) iQEcBAEBAgAGBQJSV9pPAAoJEI7yfcKNwM1+3bQH/jnd3sx9qYAs41NTXHOGBBME oFqs6e5QLnw8MsMdnqw4bG9uuM3XD7HpnZYI9+9DG7RwMhgRKOA3w32/EHEEZ4Nz W5GioEIa0a8ypm//da2TCpw8nXKvltC4BC/6K7KEAbipN1I6JQrrjSlGnKYZ1l7t ub9rApvTpaj8DE/05kx3HwtlobBbIje8x57H6OX9QlEYUZchRItfO2fx2xuHHmu8 Luh/FVKf6SwbK4SxWJFDM4Ey3uer43vTMQhBWW+7b++mIBhoL2MqR9o+RiyCyeXZ BpDn92QiN6oBdqXc+gwawFdOrU516gzMjAm7rV3wDvHTerBdw7OrkedpMYUpN4s= =jwPZ -----END PGP SIGNATURE----- --MGYHOYXEY6WxJCY8-- --===============0836910145== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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 ___________________________________________________________________________________ --===============0836910145==--