From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/95386 Path: news.gmane.org!not-for-mail From: Fabrice Couvreur Newsgroups: gmane.comp.tex.context Subject: Re: \currentheadnumber does not work Date: Sun, 10 Jul 2016 10:56:00 +0200 Message-ID: References: <5780C4B3.5050809@gmail.com> <5780D5CA.3050407@gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4696656914448179558==" X-Trace: ger.gmane.org 1468141009 14545 80.91.229.3 (10 Jul 2016 08:56:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 10 Jul 2016 08:56:49 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Jul 10 10:56:39 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 1bMAXW-000292-Kz for gctc-ntg-context-518@m.gmane.org; Sun, 10 Jul 2016 10:56:38 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 154B710EDB; Sun, 10 Jul 2016 10:56:19 +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 rkl823g23MIU; Sun, 10 Jul 2016 10:56:17 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id 9F2A111437; Sun, 10 Jul 2016 10:56:17 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id D02A61137F for ; Sun, 10 Jul 2016 10:56:16 +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 2s7LtczOzQ8b for ; Sun, 10 Jul 2016 10:56:15 +0200 (CEST) Original-Received: from mail-io0-f176.google.com (mail-io0-f176.google.com [209.85.223.176]) (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 C3D0A10EDB for ; Sun, 10 Jul 2016 10:56:04 +0200 (CEST) Original-Received: by mail-io0-f176.google.com with SMTP id q83so14380558iod.1 for ; Sun, 10 Jul 2016 01:56:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=aAcqIvYlfzBm7ky6r30RwCuDSRVLKmvCDygqTSQlqnw=; b=S4zTtWbefoY9+ayndsd7uzvENwKKdEKostBP76CaxpV6LKYL9215vfgCBLP/1vp4YB elzj0tF/Xyfgu5x/dYn+uC2seXtUJs3dq0t8D7Hxr0XYPXE5OHp4hnTpyFvoBQOyJb4m wD/PPp7lqK7TgYnKCOynREDZuqcSX1yJ1GsquDwFzN8HwkWZ0XhVqWh8gaLkXu0wjr4H YfXe2zuhTBK1SzMXRwgCBEkXfa/K15GWgejVYowMkzJX7TxW/+Bb5WUsCG/QUt2oWj44 qc5HpDujnfeURKrH68oic6CwHsTYk2V76NqUF+vD2qDrwPrDrtWbmVBZ8fFcBypfVD0X JKjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=aAcqIvYlfzBm7ky6r30RwCuDSRVLKmvCDygqTSQlqnw=; b=ZQ/hTs1VAk4aCl8RSzc7GwBBdDMKtJT/vA4Hh8Bmr72kpWBcZzYsnDwTYXkViDtzuQ 68S1DYIUUKKQXZJNcxWLSU/zDneD6jlBg4S6vjdH1VSyDjqZTZTCtStvV368+gaxhkE/ yp38zHftbKI7qFR9gFysB5PmQDw+zyiPjLZQDpC8h+c86ngZdNCHWTM0LoYdWb1fP1u8 qf3nBOsRPR/hGeh9RjKxcVNZwURq5TwTi+dy/gI5ZeynwFwLGYzEKophG/izlH4boCcQ wmPyF8SNvWYpFUZyqPGMGdw++tFv2pnEQxHJhUdp5AQ+XRc5PsxdNy7wdEA0D/L0Y1V5 hz9Q== X-Gm-Message-State: ALyK8tLVdNRj7JlsXPQq2oT72raaVVSuycNWrcayooP/vRDsolL+1XfkLMzSot7fiHOqgHQD9mWmkzqKt7+MlA== X-Received: by 10.107.168.229 with SMTP id e98mr3570802ioj.61.1468140961192; Sun, 10 Jul 2016 01:56:01 -0700 (PDT) Original-Received: by 10.64.10.2 with HTTP; Sun, 10 Jul 2016 01:56:00 -0700 (PDT) In-Reply-To: <5780D5CA.3050407@gmail.com> 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:95386 Archived-At: --===============4696656914448179558== Content-Type: multipart/alternative; boundary=001a11426a3678e0e00537443420 --001a11426a3678e0e00537443420 Content-Type: text/plain; charset=UTF-8 Hi Wolfgang, Thank you for the code and still as clear explanations. Fabrice 2016-07-09 12:45 GMT+02:00 Wolfgang Schuster : > 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 > > > ___________________________________________________________________________________ > 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 > > ___________________________________________________________________________________ > --001a11426a3678e0e00537443420 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Wolfgang,
Thank you for the code and<= /span> still as clear explanations.
Fabr= ice

2016-07-09 12:45 GMT+02:00 Wolfgang Schuster <schus= ter.wolfgang@gmail.com>:
9.=20 Juli 2016 um 12:17
=
Hi Wolfgang= ,

In the first example, so I do not need the command= =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 head= style=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=3Dfooter]
\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 4pt=
=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 p= encircle scaled 1pt ; ) ;
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 draw r ;
=C2=A0=C2=A0=C2=A0 \stopusableMPgraphic

\defineoverlay[= NumberHead][\uniqueMPgraphic{NumberHead}]

\def\processMPheadnumber#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 hea= dstyle=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{chapte= r}"
=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{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 ;
\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

_______________________________________________________________________= ____________
If your question is of interest to others as well, please add an entry to t= he Wiki!

maillist : ntg-context@ntg.nl / <= a href=3D"http://www.ntg.nl/mailman/listinfo/ntg-context" rel=3D"noreferrer= " target=3D"_blank">http://www.ntg.nl/mailman/listinfo/ntg-context
webpage=C2=A0 : http://www.pragma-ade.nl / http://tex.aanhet.net
archive=C2=A0 : http://foundry.supelec.fr/projects/con= textrev/
wiki=C2=A0 =C2=A0 =C2=A0: http://contextgarden.net
___________________________________________________________________________= ________

--001a11426a3678e0e00537443420-- --===============4696656914448179558== 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= --===============4696656914448179558==--