From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/95377 Path: news.gmane.org!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: \currentheadnumber does not work Date: Sat, 09 Jul 2016 12:45:30 +0200 Message-ID: <5780D5CA.3050407@gmail.com> References: <5780C4B3.5050809@gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8534185106347338109==" X-Trace: ger.gmane.org 1468061178 18120 80.91.229.3 (9 Jul 2016 10:46:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 9 Jul 2016 10:46:18 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sat Jul 09 12:46:06 2016 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bLplu-00035k-DQ for gctc-ntg-context-518@m.gmane.org; Sat, 09 Jul 2016 12:46:06 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id F0A0D1149C; Sat, 9 Jul 2016 12:45:45 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X8GcqrVHoX3M; Sat, 9 Jul 2016 12:45:43 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id C1E6211489; Sat, 9 Jul 2016 12:45:43 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 610BA1142D for ; Sat, 9 Jul 2016 12:45:42 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3HulhbjJK0x6 for ; Sat, 9 Jul 2016 12:45:41 +0200 (CEST) Original-Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id CFB03113CC for ; Sat, 9 Jul 2016 12:45:31 +0200 (CEST) Original-Received: by mail-wm0-f43.google.com with SMTP id f65so12552855wmi.0 for ; Sat, 09 Jul 2016 03:45:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to; bh=hrlZkGNf+8wabIqtk2xy5kjUu1KM8TFRxqt6NJyO9yo=; b=TxA1ySCruOh71NQ8BBiuhEVienUgKTphrHpYprnjFJVgj3Z8BsG9S1QnRBZu5q2hyk aVR1h80lGyx24cJ6wkqUd6eDt2ASiArPfxbIozH5dwxVQrx4LPKo6W9lZ5aDm24wJGWZ iRh+S3HswuDt1Mk2ol6W1VbsMj4PaNa1pKs5z3VUo2lQksJudUGCIirKtVOaRU94IJoD 2uq1F2cbXcHILeYng1pWXFIDZLaHubmEnt7R3SypkqmtpGLXrG0fQkmrQK5nFuAsQDpL CEUEZNFWCiRrMsmlOAIZzrSW/9wlyw5Hbo7x+rlQdNv5Xj7ny2zpwbeDGlcM3DwHJ7t2 mlkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to; bh=hrlZkGNf+8wabIqtk2xy5kjUu1KM8TFRxqt6NJyO9yo=; b=F7wMLM3FqnpLmVtFzllYIunn+elTJZlkyEw0JhF0ujfUN/iiN6Tiqy/d5aCbyKfdyZ pZdCzXTGS7jsW2B1ixM8yu9AuWP5PeZbFjfFXsohQ8c8h06zIxqcMaaKxRL/8LO+uDkV F085pmxogFuSLgyDBiKypPO3jR2vRqZ/cg6Z3nHOQhgobOZoFwbPmipTMc8mv6bhmi0t dOHJb6vrOu1yr1ONzHY0Hmkka1QRitRGfkRZYcKnFpzNjv8rRwuLbrupFf4EPreCM3RX nSlv37jvSrpzqqEyyE7FP8kp5kUr71c4qJ36Lvx25pcsZbsCMTOfW6gXLwoolKm1WdrE JHLQ== X-Gm-Message-State: ALyK8tLrYuNw5NpukGbHGu54zdrhLI/72kZR8ApbaJCXtqYqJM4J4XwN5jDVDHqR1MQonw== X-Received: by 10.195.30.3 with SMTP id ka3mr9210190wjd.9.1468061131111; Sat, 09 Jul 2016 03:45:31 -0700 (PDT) Original-Received: from keima.localdomain (x2f2bc54.dyn.telefonica.de. [2.242.188.84]) by smtp.gmail.com with ESMTPSA id k6sm6109357wjz.28.2016.07.09.03.45.30 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 09 Jul 2016 03:45:30 -0700 (PDT) User-Agent: Postbox 4.0.8 (Macintosh/20151105) In-Reply-To: X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 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" Xref: news.gmane.org gmane.comp.tex.context:95377 Archived-At: This is a multi-part message in MIME format. --===============8534185106347338109== Content-Type: multipart/alternative; boundary="------------060006000201030008050604" This is a multi-part message in MIME format. --------------060006000201030008050604 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit > Fabrice Couvreur > 9. Juli 2016 um 12:17 > Hi Wolfgang, > > In the first example, so I do not need the command \currentheadnumber > but just do: > > \setuphead > [chapter] > [command=\HeadTitle, > headstyle=\ss, > numbercommand=\Headed] ConTeXt passes the section number to the argument of the \Headed command. > But in this second example, using the command > \determineheadnumber[chapter], the chapter number is always 0 You need \determineheadnumber[...] each time when the value for \currentheadnumber should change. > \setuppagenumbering[location=footer] > > \startusableMPgraphic{NumberHead} > picture r ; > r := image ( graphictext > \MPstring{chapter} > scaled 4pt > withfillcolor \MPcolor{lightgray} > withpen pencircle scaled 1pt ; ) ; > draw r ; > \stopusableMPgraphic > > \defineoverlay[NumberHead][\uniqueMPgraphic{NumberHead}] > > \def\processMPheadnumber#1% > {\setMPtext{chapter}{\bf#1} > \useMPgraphic{NumberHead}} > > \setuphead > [chapter] > [command=\HeadTitle, > headstyle=\ss, > numbercommand=\processMPheadnumber{\currentheadnumber}] The following works here. \startusableMPgraphic{NumberHead} picture r ; r := image ( graphictext "\bf\namedheadnumber{chapter}" scaled 4pt withfillcolor \MPcolor{lightgray} withpen pencircle scaled 1pt ; ) ; draw r ; \stopusableMPgraphic \def\processMPheadnumber#1% {\useMPgraphic{NumberHead}} \setuphead [chapter] [command=\HeadTitle, headstyle=\ss, numbercommand=\processMPheadnumber] Wolfgang --------------060006000201030008050604 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
9.= =20 Juli 2016 um 12:17
Hi Wolfgang,
In the first e= xample, so I do not need the comman= d=C2=A0 \currentheadnumber=C2=A0= but just do :

\setuphead
=C2=A0= =C2=A0=20 [chapter]
=C2=A0=C2=A0 [command=3D\HeadTitle,
=C2=A0=C2=A0=C2=A0 he= adstyle=3D\ss,
=C2=A0=C2=A0=C2=A0=20 numbercommand=3D\Headed]

ConTeXt passes the section number to the argument of the \Headed=20 command.
But in this second example, using the=20 command \determineheadnumber[chapter], the chapter number is always 0
You need \determineheadnumber[...] each time when the value for=20 \currentheadnumber should change.
\setuppagenumbering[location=3Df= ooter]

\startusableMPgraphic{NumberHead}
=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 picture r ;
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 r :=3D image ( graphictext=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=20 \MPstring{chapter}
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 scaled 4= pt
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 withfillcolor=20 \MPcolor{lightgray}
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 withpen= pencircle scaled 1pt ; ) ;
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 draw r ;
=C2=A0=C2=A0=C2=A0 \stopusableMPgraphic

\defineoverla= y[NumberHead][\uniqueMPgraphic{NumberHead}]

\def\processMPheadnumb= er#1%
=C2=A0 {\setMPtext{chapter}{\bf#1}
=C2=A0=C2=A0 \useMPgraphic{NumberHead}}
\setuphead
=C2=A0=C2=A0 [chapter]
=C2=A0=C2=A0 [command=3D\HeadTitle,
=C2=A0=C2=A0=C2=A0 h= eadstyle=3D\ss,
=C2=A0=C2=A0=C2=A0=20 numbercommand=3D\processMPheadnumber{\currentheadnumber}]

The following works here.

\startusableMPgraphic{NumberHead}
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 picture r ;
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 r :=3D image ( graphictext
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "\bf\namedheadnumber{chapter}"=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 scaled 4pt
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 withfillcolor \MPcolor{lightgr= ay}
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 withpen pencircle scaled 1pt ;= ) ;
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 draw r ;
\stopusableMPgraphic

\def\processMPheadnumber#1%
=C2=A0 {\useMPgraphic{NumberHead}}

\setuphead
=C2=A0=C2=A0 [chapter]
=C2=A0=C2=A0 [command=3D\HeadTitle,
=C2=A0=C2=A0=C2=A0 headstyle=3D\ss,
=C2=A0=C2=A0=C2=A0 numbercommand=3D\processMPheadnumber]

Wolfgang
--------------060006000201030008050604-- --===============8534185106347338109== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly90ZXguYWFuaGV0Lm5ldAphcmNoaXZlICA6IGh0dHA6Ly9mb3VuZHJ5LnN1cGVsZWMu ZnIvcHJvamVjdHMvY29udGV4dHJldi8Kd2lraSAgICAgOiBodHRwOi8vY29udGV4dGdhcmRlbi5u ZXQKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX18= --===============8534185106347338109==--