From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/109393 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sylvain Hubert Newsgroups: gmane.comp.tex.context Subject: Re: \type{...} as macro argument Date: Sun, 8 Nov 2020 19:35:50 +0100 Message-ID: References: <2f550f37-ec5b-fee4-9b90-2ac5ae05fe4d@gmail.com> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4173068433866729781==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5704"; mail-complaints-to="usenet@ciao.gmane.io" To: Wolfgang Schuster , mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Nov 08 19:36:29 2020 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 1kbpYC-0001O6-88 for gctc-ntg-context-518@m.gmane-mx.org; Sun, 08 Nov 2020 19:36:28 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 8AB251A9D1E; Sun, 8 Nov 2020 19:36:05 +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 AXJcBFI98zpM; Sun, 8 Nov 2020 19:36:04 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id AAB521AA38E; Sun, 8 Nov 2020 19:36:04 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 8910A1A9F8F for ; Sun, 8 Nov 2020 19:36:03 +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 oBGky_3zGgtm for ; Sun, 8 Nov 2020 19:36:03 +0100 (CET) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.166.49; helo=mail-io1-f49.google.com; envelope-from=champignoom@gmail.com; receiver= Original-Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id CFE7C1A9D1E for ; Sun, 8 Nov 2020 19:36:02 +0100 (CET) Original-Received: by mail-io1-f49.google.com with SMTP id s24so7561420ioj.13 for ; Sun, 08 Nov 2020 10:36:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=VEJxu8Iy+9zQfV5+krfTkwG+Uhc0jKF9krzXvELguQs=; b=mR+2wlbrZT7t203Ui6TtyFWjoKdZZzAE1GyMe/JgNsuxXcqS9K4I+U1Z9ZOayOPff5 xN2hAcNZrVdriWyA+Eaj73Lx6iw0uvWvNG1i96DExtrR5zLX+h5PuSP+B61wdgO4xGL1 nB2tuKuQUMj11ctcJPlfKyISEg3+KL+U3yUDjJPvwFEYtZMa37L/7eTZlBfhiJ49v8ZN XtYlkX9DnKUe7NiewWHfknCP6L53i1OZ9khpHuQneRQ37Fr3WdwqpcsIMbLp54BuXZtp +BUoUN4gdye0UrZ3pxlp8LrUlCPpi2stI6DeTwaiYlKG4w6FudiVWaeKDhRzwKjsBNxF 4rZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=VEJxu8Iy+9zQfV5+krfTkwG+Uhc0jKF9krzXvELguQs=; b=qNEA/tpoi9YRC6UuyJ9dcXUC38vuADgTceL9BMMfu70Qgi5zrn+0hfN1PZogMMclBc AgZAqbRM2itmuZ+saGInmskkJPWFNMtK7R8IdKRm7dgbGIUUtdZ522fQz8+4ugaMYvtI Db9jTkUWxmuwfow11Vd5mb88jBKYAbis3h6HDhogPCSXgLewsujA93pqifVgdKmXTnFT yYj6g//eaX+woYvuDr55DpD1qvmhtD5OIJO5neoyCn/Xug1Igy8sN1NiTqEtIQDf4KE3 uzusJYam2uCqmObaV8ayrz5ALwIy7uGqWaG9vHWYalwl2YA9vHrQqms8aIi8sd1XQE9A P/0w== X-Gm-Message-State: AOAM53168srm0pz8j+WgzjEOXtB1KXkc28iBL8iOiZvAqHVQ5Uae5kEc zEb0UkhShw1vLTOQVgSN0vxs3/gCcJt4vR+3g1s= X-Google-Smtp-Source: ABdhPJwFX3qlIyg68WoJoxiEKhmHSnSzBbaaA5IcbX0VWtnD3m/gkRE8lpo8wyIKErONBbKOhhYFgxQcz1/lIhlLZxg= X-Received: by 2002:a05:6638:618:: with SMTP id g24mr8645508jar.53.1604860561172; Sun, 08 Nov 2020 10:36:01 -0800 (PST) In-Reply-To: <2f550f37-ec5b-fee4-9b90-2ac5ae05fe4d@gmail.com> 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:109393 Archived-At: --===============4173068433866729781== Content-Type: multipart/alternative; boundary="000000000000a9add605b39cb721" --000000000000a9add605b39cb721 Content-Type: text/plain; charset="UTF-8" On Sun, 8 Nov 2020 at 18:27, Wolfgang Schuster < wolfgang.schuster.lists@gmail.com> wrote: > Sylvain Hubert schrieb am 08.11.2020 um 17:56: > > Hi Wolfgang, > > > > I'm sorry that the question was not clear enough. Let me ask in this way: > > how to define a \dorecurse, such that \dorecurse{10}{\type{a b c}} > > does not squash the spaces? > > Verbatim in arguments of other commands is tricky because in case with > \dorecurse the loop reads the content before it is passed to type, as a > result of this process all spaces are collapsed. > > One way to work around this is to use a buffer for the content of the loop. > > \startbuffer[type] > \type{a b c} > \stopbuffer > > \starttext > \dorecurse{10}{\inlinebuffer[type]\par} > \stoptext > Many thanks for the answer! It seems that the buffer mechanism is quite a powerful resort for the macro language. Sylvain --000000000000a9add605b39cb721 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sun, 8 Nov 2020 at 18:27, Wolfgang Schuster <wolfgang.schuster.lists@gmail.com&g= t; wrote:
Sylvai= n Hubert schrieb am 08.11.2020 um 17:56:
> Hi Wolfgang,
>
> I'm sorry that the question was not clear enough. Let me ask in th= is way:
> how to define a \dorecurse, such that \dorecurse{10}{\type{a=C2=A0=C2= =A0=C2=A0 b c}}
> does not squash the spaces?

Verbatim in arguments of other commands is tricky because in case with
\dorecurse the loop reads the content before it is passed to type, as a result of this process all spaces are collapsed.

One way to work around this is to use a buffer for the content of the loop.=

\startbuffer[type]
\type{a=C2=A0 =C2=A0 b c}
\stopbuffer

\starttext
\dorecurse{10}{\inlinebuffer[type]\par}
\stoptext

Many thanks for the answer!
It seems that the buffer mechanism is quite a powerful resort for = the macro language.

Sylvain
--000000000000a9add605b39cb721-- --===============4173068433866729781== 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 X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============4173068433866729781==--