From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/116690 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Rik Kabel via ntg-context Newsgroups: gmane.comp.tex.context Subject: Re: Use section custom value in a header text. Date: Tue, 20 Dec 2022 15:48:39 -0500 Message-ID: <2e4571b7-bcb8-4a69-38ac-59a8fdbf88a2@rik.users.panix.com> References: Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3711025174187453308==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4272"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.6.0 Cc: Rik Kabel To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Tue Dec 20 21:49:14 2022 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p7jY2-0000vM-45 for gctc-ntg-context-518@m.gmane-mx.org; Tue, 20 Dec 2022 21:49:14 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 953692A4E5C; Tue, 20 Dec 2022 21:48:47 +0100 (CET) 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 anqfKSlT6AaE; Tue, 20 Dec 2022 21:48:45 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 0CA0E2A4CCF; Tue, 20 Dec 2022 21:48:45 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 810B22A4CBB for ; Tue, 20 Dec 2022 21:48:43 +0100 (CET) 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 vP_jYEvraTGt for ; Tue, 20 Dec 2022 21:48:42 +0100 (CET) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=166.84.1.89; helo=mailbackend.panix.com; envelope-from=context@rik.users.panix.com; receiver= Original-Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id A72362A4C42 for ; Tue, 20 Dec 2022 21:48:42 +0100 (CET) Original-Received: from [192.168.1.106] (cpe-69-204-136-231.nycap.res.rr.com [69.204.136.231]) by mailbackend.panix.com (Postfix) with ESMTPSA id 4Nc7vr6mKcz4NKM for ; Tue, 20 Dec 2022 15:48:40 -0500 (EST) Content-Language: en-US In-Reply-To: X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 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.io gmane.comp.tex.context:116690 Archived-At: This is a multi-part message in MIME format. --===============3711025174187453308== Content-Type: multipart/alternative; boundary="------------ePotViCaYHD6vlupvt1Jv1VK" Content-Language: en-US This is a multi-part message in MIME format. --------------ePotViCaYHD6vlupvt1Jv1VK Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2022-12-20 14:31, Pawel Urbanski via ntg-context wrote: > Hi, > Let me clarify my question more... > I need to attach some value to a chapter in that key. That custom > prefix + the value in the key is ment to be in the header or a footer > as a matter of fact. The case can apply to both headers and footers. > I tried: > \chapter[title={A sample title}][custom_random={custom_value}] > \setupheadertexts[{Prefix: \structureuservariable{custom_random}}] > ... > \stopchapter > I tried this code when trying to figure out the mechanism. The prefix > string in placed in the header, but hte custom value of the attached > key is not expanded.. > Evey page will contain just one section started by a \startchapter and > \stop chapter. I would like to put this custom attached value in the > right slot in the document header. > > I hope that htis time around htigs are more clear. > > On Tue, Dec 20, 2022 at 8:13 PM Henning Hraban Ramm via ntg-context > wrote: > > Am 20.12.22 um 19:44 schrieb Pawel Urbanski via ntg-context: > > Dear Friends, > > I s-- pent some time searching and coding simple documents, but > failed and > > therefore I'm asking for help... > > A section such as chapter cn have custom keys with values. One > uses the: > > \structureuservariable command to access such values. > > How can I use such a value to create a custom header in a format: > > Prefix: \structureuservariable{foo} > > > > I am asking for the only thing that worked when I tried was > calling the: > > \setupheadertexts command inside a chapter environment block > with some > > prefix. Unfortunately the value from the custom field was not > expanded. > > It was correctly inserted in a regular paragraph. > > For example: > > \startchapter > > [title={A sample title}][custom_something={random_value}] > > ... > > \stopchapter > > > > How can I put the value of: custom_something in the header with > some prefix? > > \define[2]\MyChapter{No.#1 – Prefix > \structureuservariable{custom_something}: #2} > > \setuphead[chapter][ >   command=\MyChapter, > ] > > Is this what you meant? > > Hraban > Perhaps: \setuppagenumbering[alternative=doublesided,location=bottom] \startsetups chapter:headings   \doifsomethingelse{\structureuservariable{custom}}                     {\setupheadertexts[RI]                                       [Prefix: \structureuservariable{custom}]                                       [Prefix: \structureuservariable{custom}]                                       [VO]}                     {\setupheadertexts[RI][RO][VO][VI]} \stopsetups \setuphead[chapter]           [style=\tfa,            after={\blank\setups{chapter:headings}},           ] \starttext \startchapter[title=Nothing special] \dorecurse{10}{\input knuth\par} \stopchapter \startchapter[title=Something special][custom={Hi there!}] \dorecurse{10}{\input knuth\par} \stopchapter \startchapter[title=More nothing special] \dorecurse{10}{\input knuth\par} \stopchapter \startchapter[title=More something special][custom={Bye Bye!}] \dorecurse{10}{\input knuth\par} \stopchapter \stoptext -- Rik --------------ePotViCaYHD6vlupvt1Jv1VK Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit


On 2022-12-20 14:31, Pawel Urbanski via ntg-context wrote:
Hi,
Let me clarify my question more...
I need to attach some value to a chapter in that key. That custom prefix + the value in the key is ment to be in the header or a footer as a matter of fact. The case can apply to both headers and footers.
I tried:
\chapter[title={A sample title}][custom_random={custom_value}]
\setupheadertexts[{Prefix: \structureuservariable{custom_random}}]
...
\stopchapter
I tried this code when trying to figure out the mechanism. The prefix string in placed in the header, but hte custom value of the attached key is not expanded..
Evey page will contain just one section started by a \startchapter and \stop chapter. I would like to put this custom attached value in the right slot in the document header.

I hope that htis time around htigs are more clear.

On Tue, Dec 20, 2022 at 8:13 PM Henning Hraban Ramm via ntg-context <ntg-context@ntg.nl> wrote:
Am 20.12.22 um 19:44 schrieb Pawel Urbanski via ntg-context:
> Dear Friends,
> I s-- pent some time searching and coding simple documents, but failed and
> therefore I'm asking for help...
> A section such as chapter cn have custom keys with values. One uses the:
> \structureuservariable command to access such values.
> How can I use such a value to create a custom header in a format:
> Prefix: \structureuservariable{foo}
>
> I am asking for the only thing that worked when I tried was calling the:
> \setupheadertexts command inside a chapter environment block with some
> prefix. Unfortunately the value from the custom field was not expanded.
> It was correctly inserted in a regular paragraph.
> For example:
> \startchapter
> [title={A sample title}][custom_something={random_value}]
> ...
> \stopchapter
>
> How can I put the value of: custom_something in the header with some prefix?

\define[2]\MyChapter{No.#1 – Prefix
\structureuservariable{custom_something}: #2}

\setuphead[chapter][
  command=\MyChapter,
]

Is this what you meant?

Hraban


Perhaps:

\setuppagenumbering[alternative=doublesided,location=bottom]
\startsetups chapter:headings
  \doifsomethingelse{\structureuservariable{custom}}
                    {\setupheadertexts[RI]
                                      [Prefix: \structureuservariable{custom}]
                                      [Prefix: \structureuservariable{custom}]
                                      [VO]}
                    {\setupheadertexts[RI][RO][VO][VI]}
\stopsetups
\setuphead[chapter]
          [style=\tfa,
           after={\blank\setups{chapter:headings}},
          ]
\starttext
\startchapter[title=Nothing special]
\dorecurse{10}{\input knuth\par}
\stopchapter
\startchapter[title=Something special][custom={Hi there!}]
\dorecurse{10}{\input knuth\par}
\stopchapter
\startchapter[title=More nothing special]
\dorecurse{10}{\input knuth\par}
\stopchapter
\startchapter[title=More something special][custom={Bye Bye!}]
\dorecurse{10}{\input knuth\par}
\stopchapter
\stoptext

--
Rik

--------------ePotViCaYHD6vlupvt1Jv1VK-- --===============3711025174187453308== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cHM6Ly93d3cubnRnLm5sL21haWxtYW4v bGlzdGluZm8vbnRnLWNvbnRleHQKd2VicGFnZSAgOiBodHRwczovL3d3dy5wcmFnbWEtYWRlLm5s IC8gaHR0cDovL2NvbnRleHQuYWFuaGV0Lm5ldAphcmNoaXZlICA6IGh0dHBzOi8vYml0YnVja2V0 Lm9yZy9waGcvY29udGV4dC1taXJyb3IvY29tbWl0cy8Kd2lraSAgICAgOiBodHRwczovL2NvbnRl eHRnYXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============3711025174187453308==--