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_ADSP_CUSTOM_MED, 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 0FCF92EF3C for ; Tue, 22 Oct 2024 18:58:10 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id C4D9848595C for ; Tue, 22 Oct 2024 18:57:40 +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:content-language:in-reply-to:mime-version:user-agent :date:date:message-id:from:from:references:received:received :received:received:received:received:received; s=cgl; t= 1729616260; x=1732208261; bh=TDji59R5kBhsNzcR6RIxmGDFFJEsa4lyS6G YriytJxw=; b=pqdJo+45KqdwTC+9FFrFFLux0MFXP+iFK9K+jJeA/tu3zB7L+T7 JXGDsFMQ/XTMtQIZdPaPCyPe7lIXrhSM7H6i3fqMfMTLkU1yQtn+1u1rO1dPWXuL eP5Dg/cqkOL8HpmzLdRFQfU3X1Q/O5THg96DbVtlDcI6xh02J3mXj6AI= X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Authentication-Results: cgl.ntg.nl (amavisd-new); dkim=fail (2048-bit key) reason="fail (message has been altered)" header.d=gmail.com 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 gmK-wstRlZKO for ; Tue, 22 Oct 2024 18:57:40 +0200 (CEST) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 9F3C948579F for ; Tue, 22 Oct 2024 18:57:05 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 01708485685 for ; Tue, 22 Oct 2024 18:56:45 +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 nKRCu7mkyrIc for ; Tue, 22 Oct 2024 18:56:44 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.167.50; helo=mail-lf1-f50.google.com; envelope-from=wolfgang.schuster.lists@gmail.com; receiver= Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cgl.ntg.nl (Postfix) with ESMTPS id A6CF1485684 for ; Tue, 22 Oct 2024 18:56:44 +0200 (CEST) Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-539f58c68c5so9047195e87.3 for ; Tue, 22 Oct 2024 09:56:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729616204; x=1730221004; darn=ntg.nl; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:to:subject:from:to:cc :subject:date:message-id:reply-to; bh=XM3L5L2mWKRo88//eYJJ7yEXVt4dUAfIZAMqCUtyyck=; b=IDjshlmznEcGBu2Eg+TcZC6kIrh/XdlIBLaloiRNO3dfRu8RO7PAF4vaBJ3p1cUY9H LnkOe/Anzs73LH3aKGZwhK7rDZ3ug/cf9qSvUpKz4OYLw/FMzJj45b0xueJBZtZw1SIy QwDcSiekH0pfAv4n51khhAx1KaqimTUsOJItoqyC8dhurvfXiJiJ1o0gagvS7qCfqIaw JglcGffjBXuVmXBZNSjjqJ+scEqUwy46KYEpAnyFKd39NnwmqmPhSnn6g4IHchu4W7Wd ynfs3NSEKmbnhTMF8RqT4yS+1z87Gce9ECNvMD7JHL/gO3PkLk8awX7iZB/kxK5SG298 E68A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729616204; x=1730221004; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:to:subject :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=XM3L5L2mWKRo88//eYJJ7yEXVt4dUAfIZAMqCUtyyck=; b=XiGHedZsz/7kfQNRzXDy49h/MNwc/RGJuEtlhxmap6DO4NKO8yKetkhZCv0aaUaMwY mZnzImZ12b94XaCIG8mUtp2EB8npt/fwHUvOJC7PkDsU9NifSz7wyxXyO+8snoM5aCtG gXht9YyyC4LMlNDWCmD08MLhY+HENfDZ62SKhmhYM4kTBcUA2DzmviNZu2qMBuCZWiWm WaG0iZgflqXxiGiGCWTKKjdb6KZS5YsqqAGNbV7vtWnNj8OwlzHwpXykGpkqcX03xVey qQHaS2oqiJv3lKHXsYNixOvksXypqxI0WbB6d2qb/YnyDREu+nH2DgAQFh4Hs0GKhJRo 5BpQ== X-Gm-Message-State: AOJu0Yyvo5oziLkryoUnrNGBnzbnP6U7wWfSkQNu7bDBejFC4W76F3dC ZjRZnnMC5mQlg6zaGSeD9Pz6h0QbslRAA40pZhnyANmTsyF7GHGI X-Google-Smtp-Source: AGHT+IGxzDyGiZ7zUXTg7jFqU+j0iS25tgSuSG8mVc6YdTCP99Pfveerihxo78e4ukUP5jywG/2IyA== X-Received: by 2002:a05:6512:3c9d:b0:536:a4f1:d214 with SMTP id 2adb3069b0e04-53b191f7ef4mr234232e87.19.1729616203560; Tue, 22 Oct 2024 09:56:43 -0700 (PDT) Received: from ?IPv6:2a02:810d:a8bf:e1a8::4b99? ([2a02:810d:a8bf:e1a8::4b99]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9a913704d2sm362319466b.119.2024.10.22.09.56.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Oct 2024 09:56:43 -0700 (PDT) To: mailing list for ConTeXt users , ai2472206007@yeah.net References: <3a6bd5a4-0948-52b8-60da-af7824f2891e@gmail.com> <172957513082.1601626.6637189551431635250@cgl.ntg.nl> From: Wolfgang Schuster Message-ID: Date: Tue, 22 Oct 2024 18:56:41 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 PostboxApp/7.0.64 MIME-Version: 1.0 In-Reply-To: <172957513082.1601626.6637189551431635250@cgl.ntg.nl> Content-Language: en-US Message-ID-Hash: QQR6GAQDWDJF6FOVOOLGUXHHB2DPQMMS X-Message-ID-Hash: QQR6GAQDWDJF6FOVOOLGUXHHB2DPQMMS X-MailFrom: wolfgang.schuster.lists@gmail.com 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] Re: 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"; format="flowed" Content-Transfer-Encoding: 7bit ai2472206007@yeah.net schrieb am 22.10.2024 um 07:32: > Thank you so much. I think I understand its usage. > > Also, regarding the "ifargument" command you mentioned, > is it counting from 0 and then checking the arguments one by one? > Because I only learned "iffirstargument", "ifsecondargument" from the wiki. > Perhaps we should update the section on the wiki on defining optional parameters. You can check individual argument with the old and new method but there are differences because the new \ifparameter conditional gives a false result when you set the optional argument but leave it empty. %%%% begin example \def\oldargumentcheck {\dotripleempty\dooldargumentcheck} \def\dooldargumentcheck[#1][#2][#3]% {\iffirstargument First optional argument is used.\par \else First optional argument isn't used.\par \fi \ifsecondargument Second optional argument is used.\par \else Second optional argument isn't used.\par \fi \ifthirdargument Third optional argument is used.\par \else Third optional argument isn't used.\par \fi} \tolerant\def\newargumentcheck[#1][#2][#3]% {\ifparameter#1\or First optional argument is used.\par \else First optional argument isn't used or empty.\par \fi \ifparameter#2\or Second optional argument is used.\par \else Second optional argument isn't used or empty.\par \fi \ifparameter#3\or Third optional argument is used.\par \else Third optional argument isn't used or empty.\par \fi} \starttext \oldargumentcheck[][foo] \blank \newargumentcheck[][bar] \stoptext %%%% end example When you care only about the number of argument you would use nested argument checks in the old system but the new \ifarguments conditional uses branches for each case like \ifcase. The order for the number of arguments is also reversed, the old system starts with the case for all argument and ends with zero arguments while the new check start with zero arguments and ends with all of them. %%%% begin example \def\oldcommand {\dotripleempty\dooldcommand} \def\dooldcommand[#1][#2][#3]% {\ifthirdargument Three optional arguments are used.\par \else\ifsecondargument Two optional arguments are used.\par \else\iffirstargument One optional argument is used.\par \else No optional argument is used.\par \fi\fi\fi} \tolerant\def\newcommand[#1][#2][#3]% {\ifarguments No optional argument is used.\par \or One optional argument is used.\par \or Two optional arguments are used.\par \or Three optional arguments are used.\par \fi} \starttext \oldcommand[][] \blank \newcommand[][] \stoptext %%%% end example Wolfgang ___________________________________________________________________________________ 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 ___________________________________________________________________________________