From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: from cgl.ntg.nl (Cgl.ntg.nl [5.39.185.202]) by inbox.vuxu.org (Postfix) with ESMTP id 03F982F1B5 for ; Mon, 21 Oct 2024 19:31:46 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id AE3754852E9 for ; Mon, 21 Oct 2024 19:28:00 +0200 (CEST) Authentication-Results: cgl.ntg.nl (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=ntg.nl DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ntg.nl; h= content-transfer-encoding:content-type:content-type :list-unsubscribe:list-subscribe:list-post:list-owner:list-help :list-archive:archived-at:list-id:subject:subject:reply-to :precedence:user-agent:message-id:date:date:from:from :mime-version:received:received:received:received:received; s= cgl; t=1729531680; x=1732123681; bh=TmXyWG/OMjYLvIx4oHxK6OZ04ZSG TXos7kdWrHC1HKw=; b=jqYwsZ7ldW5UDqE4E2n5weqXGuGeDewo/YyY2CvYZyIC lCotb8eYOevIfsK9rijaCjGjGmTP4uLhunNb2ALqHnso7EStlhhbf3NhKjrTvqdi iBQaqkCT//LY2+6zXhmtdJyvarTaQGQxxjN5D+woAbUoQlfBDl91lQGKPAC5pl4= X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AY03cr5tClFL for ; Mon, 21 Oct 2024 19:28:00 +0200 (CEST) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id AAB274850D7 for ; Mon, 21 Oct 2024 19:27:07 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 58D4D484F97 for ; Mon, 21 Oct 2024 19:26:23 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id odjO6Jtl6jeC for ; Mon, 21 Oct 2024 19:26:22 +0200 (CEST) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id D6278484F94 for ; Mon, 21 Oct 2024 19:26:22 +0200 (CEST) MIME-Version: 1.0 From: ai2472206007@yeah.net To: ntg-context@ntg.nl Date: Mon, 21 Oct 2024 17:26:22 -0000 Message-ID: <172953158287.1601626.2482296264759389824@cgl.ntg.nl> User-Agent: HyperKitty on http://mailman.ntg.nl/ Message-ID-Hash: YBF2NE5K24SNPHQT44MXYJG34BTHUP5H X-Message-ID-Hash: YBF2NE5K24SNPHQT44MXYJG34BTHUP5H X-MailFrom: ai2472206007@yeah.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list Reply-To: mailing list for ConTeXt users Subject: [NTG-context] Why didn't I get the correct ordinal number, after defining an environment via command "installcounterassociation". List-Id: mailing list for ConTeXt users Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit hi, everyone I defined a command to unite counters by the method of defining counters that I saw on other posts. When I wanted to modify the start parameter of the counter, I found that it did not inherit the settings of the current environment, but inherited the settings of the previous environment. For example, in the first chapter, I set the counter for the environment to start counting from 5, but it inherited the original count of 9, and in the second chapter, it inherited the setting from the first chapter, and its counter became 5. The same happens in Chapter 3. Pls can someone fix this? Since the command to unite with the counter is what I found through previous posts and source files, I don't know exactly how it is used. If my question or the mistake I made was too stupid, be sure to let me know. Many thanks. Muyik. %%%% example %%%% I've cut out other parts of the environment that aren't relevant to this issue. \unprotect \installnamespace {material} \installcommandhandler \????material {material} \????material \installcounterassociation {material} \appendtoks \registermaterialcounter\currentmaterial \definecounter[\currentmaterial]% \to \everydefinematerial \appendtoks \synchronizematerialcounters \to \everysetupmaterial \definematerial [material] \definematerial [number] \setupmaterial [\c!title=, \c!author=, \c!source=, \c!start=8,] \setupmaterial [\c!number] [\c!before={(},\c!after={)}, \c!prefix=no,\c!start=9, \c!numberconversion=n, \c!way=\v!by\v!chapter] \def\material_counter_parameter#1% {\begingroup \def\currentmaterial{#1}% \usematerialstyleandcolor\c!style\c!color \namedmaterialparameter\currentmaterial\c!before \convertedcounter[\currentmaterial]% \incrementcounter[\currentmaterial]% \namedmaterialparameter\currentmaterial\c!after \endgroup} \def\startmaterial{\begingroup\dosingleempty\startmaterial_indeed} \def\startmaterial_indeed[#1]{% \iffirstargument\setupcurrentmaterial[#1]\fi \usematerialstyleandcolor\c!style\c!color% \convertedcounter[\currentmaterial]% number seq=(5 3 3) : real num=\material_counter_parameter\c!number => get previous parameter,not right start number\\ number seq=(5 3 3) : real num=\namedmaterialparameter{number}\c!start => get right number\\ material seq=(8 8 8) : real num=\convertedcounter[material] => work well %%%%%%%%%%But I don't want to set the number directly by \setupmaterial, %%%%%%%%%%because there are other elements of this environment, %%%%%%%%%%and they are set by their respective names,like "title" and so on. \incrementcounter[material]} \def\stopmaterial{\par\blackrule% \endgroup} \protect \setuplayout[margin=5mm,width=fit,] \setuphead[chapter][page=no] \starttext \chapter{} \setupmaterial[number][style=tfb,color=red,start=5] \startmaterial \color[gray]{ knuthmath } \stopmaterial \startmaterial \color[gray]{ knuthmath } \stopmaterial \chapter{} \setupmaterial[number][way=bychapter,start=3] \startmaterial \color[gray]{ knuthmath } \stopmaterial \startmaterial \color[gray]{ knuthmath } \stopmaterial \chapter{} \startmaterial \color[gray]{ knuthmath } \stopmaterial \startmaterial \color[gray]{ knuthmath } \stopmaterial \stoptext %%% example ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________