From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/99977 Path: news.gmane.org!.POSTED!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: Expansion help needed, getvariable and TABLE Date: Wed, 31 Jan 2018 07:04:51 +0100 Message-ID: <5A715C83.3030206@gmail.com> References: <510aff38-9cc5-bebd-107d-a569695a4403@rik.users.panix.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3451704059133397531==" X-Trace: blaine.gmane.org 1517378677 10427 195.159.176.226 (31 Jan 2018 06:04:37 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 31 Jan 2018 06:04:37 +0000 (UTC) User-Agent: Postbox 5.0.22 (Macintosh/20171208) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed Jan 31 07:04:33 2018 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 blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eglVT-00028j-BG for gctc-ntg-context-518@m.gmane.org; Wed, 31 Jan 2018 07:04:27 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 3EE8A425D16; Wed, 31 Jan 2018 07:05:54 +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 yJppGRy6b8i3; Wed, 31 Jan 2018 07:05:39 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id B2649425D05; Wed, 31 Jan 2018 07:05:31 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 8EB91425D07 for ; Wed, 31 Jan 2018 07:05:30 +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 42r2xcFV1kF7 for ; Wed, 31 Jan 2018 07:05:14 +0100 (CET) Original-Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) (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 DFC0D425D05 for ; Wed, 31 Jan 2018 07:04:55 +0100 (CET) Original-Received: by mail-wm0-f68.google.com with SMTP id t74so5629640wme.3 for ; Tue, 30 Jan 2018 22:04:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to; bh=DZ8hR+0mvrS1yLO7yhTc5Mp5EUE4BYgW90tB0xw6E3E=; b=HnDdIFegRb4SvS6s09Ktm3+YbVgs37gD49L7vniA/EZWLVnHMpVr4Vei1ihxFwoMdQ sJ8CLWtt5ZkGMinFW8O+JUeept5x4DqN7Kv0jOmHc9cEGchD1T0Svv+iLPxvaQPoDLzI 1yf8u2ihG8Xd644+xKa8mrilt3uYrIzMmaCuox0VXxKtASuo80T87PnrOTgoOIomi7aU D48Sm2lBe2KP5nFRAaVtqOz5/28oriZJtHXvR20xOs7ui6hIr3eVMnR8KUutB9lwzM5l 6ZPT96h7r89rDRq8t0oeZSQDASkTXmDNsHjiNkuXF2ZjaU1sngpxxM5ECfGjsdQPBMXU iwyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to; bh=DZ8hR+0mvrS1yLO7yhTc5Mp5EUE4BYgW90tB0xw6E3E=; b=Gu4k9H0RCyB6ezdLjkfJaJD0j3ZhVQFetQ9g6Hq2tKNC9K3UjMRl3Glon4xpg+6Ji0 CnyVWLD5siMd3xlmVDy35PHOC/hJiHGl4pgYgQ/nlS7Zm8ywQMT9xkbQXMQdR/AUz/Bi diJUrSWO57j79O+e9jLGKMldQhz2By/xoY+zGgArtgUpLvUaF2gyltLiaZG58Yk++dc4 5w4pCC96bWt1v4/zVODiA9VkvUVZiyerCVSUsLUtP4DQM1ScjH/OK0Tn8j9VFGl7+YJp psLwcLGhONKcU0K4ZGh2YNXQcsHz+tu+oYCB8ZwFUDcsDqPacEBpBGJjgpPV3g2O8a81 8P5Q== X-Gm-Message-State: AKwxytcZSidWV5YxsCcMuN8q5rT6ldvFw5OBg5XnRwifap1vgSS7jtlc spdBfKCuTt5FfHgOqFsNnpSQRLnz X-Google-Smtp-Source: AH8x225b/XSmvWVg7uk9kpzLTzo+oACZbSyvw3c6s1GqeYxN7cmMZ9RPfrSVEXBgk15PlX6z+cZXAw== X-Received: by 10.28.180.4 with SMTP id d4mr24986692wmf.13.1517378695089; Tue, 30 Jan 2018 22:04:55 -0800 (PST) Original-Received: from [192.168.1.11] (x4dbd03ab.dyn.telefonica.de. [77.189.3.171]) by smtp.gmail.com with ESMTPSA id q18sm7470278wrc.36.2018.01.30.22.04.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jan 2018 22:04:54 -0800 (PST) In-Reply-To: <510aff38-9cc5-bebd-107d-a569695a4403@rik.users.panix.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:99977 Archived-At: This is a multi-part message in MIME format. --===============3451704059133397531== Content-Type: multipart/alternative; boundary="------------030509090505080209070002" This is a multi-part message in MIME format. --------------030509090505080209070002 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit > Rik Kabel > 31. Januar 2018 um 03:10 > > Listers, > > I have a problem, and a question on ConTeXt programming efficiency. > > In the example below, I have a set of variables. When these are > reference directly via \getvariable, everything works as expected in > simple text and in TABLEs. When I \define a macro to the \getvariable, > that works in simple text, but only the value of the last iteration > appears in the TABLE. The macro definition is saved and when it is > used, that is the value that it has. > > So, how can I \define (or \def, ...) a macro to the expanded value to > avoid this? That is the problem. > > The question is, Is there is any advantage to be had in doing this? > Assume that the value is referenced many (tens of) times. There seems > to be an aesthetic value of factoring out the multiple identical > instances of the \getvariable syntax and assigning a more semantically > informative name, but beyond that, is there any other value? > > Natural tables collect the content of all cells to perform the width and height calculations and you have to expand the content of the cells to get the current value of \getvariable. \starttexdefinition unexpanded doTableRow #SET \bTR \expanded{\bTC\getvariable{#SET}{a}\eTC} \expanded{\bTC\getvariable{#SET}{b}\eTC} \eTR \stoptexdefinition BTW: You can use the \processcommacommand command when you save your lists in a macro (no need for \expandafter). \defineexpandable\Sets{one,two} \processcommacommand[\Sets]\doInlineTextExp Wolfgang --------------030509090505080209070002 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
31. Januar 2018 um 03:10

Listers,

I have a problem, and a question on ConTeXt programming efficiency.

In the example below, I have a set of variables. When these are reference directly via \getvariable, everything works as expected in simple text and in TABLEs. When I \define a macro to the \getvariable, that works in simple text, but only the value of the last iteration appears in the TABLE. The macro definition is saved and when it is used, that is the value that it has.

So, how can I \define (or \def, ...) a macro to the expanded value to avoid this? That is the problem.

The question is, Is there is any advantage to be had in doing this? Assume that the value is referenced many (tens of) times. There seems to be an aesthetic value of factoring out the multiple identical instances of the \getvariable syntax and assigning a more semantically informative name, but beyond that, is there any other value?


Natural tables collect the content of all cells to perform the width and height calculations
and you have to expand the content of the cells to get the current value of \getvariable.

\starttexdefinition unexpanded doTableRow #SET
    \bTR
      \expanded{\bTC\getvariable{#SET}{a}\eTC}
      \expanded{\bTC\getvariable{#SET}{b}\eTC}
    \eTR
\stoptexdefinition


BTW: You can use the \processcommacommand command when you save your lists in a macro (no need for \expandafter).

\defineexpandable\Sets{one,two}

\processcommacommand[\Sets]\doInlineTextExp


Wolfgang
--------------030509090505080209070002-- --===============3451704059133397531== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f --===============3451704059133397531==--