From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/110914 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christoph Reller Newsgroups: gmane.comp.tex.context Subject: Re: Typing within doifmode leads to error Date: Sat, 20 Mar 2021 16:00:04 +0100 Message-ID: References: <41b732e4-b771-15a2-7fc1-5ead8086f4f9@xs4all.nl> <1628b6da-77e8-7935-9847-859317bec564@xs4all.nl> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0182920204369087727==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7140"; mail-complaints-to="usenet@ciao.gmane.io" To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sat Mar 20 16:01:04 2021 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 1lNd67-0001m7-TT for gctc-ntg-context-518@m.gmane-mx.org; Sat, 20 Mar 2021 16:01:03 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 5C267281B2B; Sat, 20 Mar 2021 16:00:24 +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 fyhb86XWTc-W; Sat, 20 Mar 2021 16:00:22 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 9B452281B2E; Sat, 20 Mar 2021 16:00:22 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id C271F281B06 for ; Sat, 20 Mar 2021 16:00:21 +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 FmRkXiv0Jcjm for ; Sat, 20 Mar 2021 16:00:21 +0100 (CET) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.167.44; helo=mail-lf1-f44.google.com; envelope-from=christoph.reller@gmail.com; receiver= Original-Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (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 211892818A6 for ; Sat, 20 Mar 2021 16:00:20 +0100 (CET) Original-Received: by mail-lf1-f44.google.com with SMTP id g8so7389925lfv.12 for ; Sat, 20 Mar 2021 08:00:20 -0700 (PDT) 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=+PcgsNkTp1SrgatCCYVZXgwj6I+2R53/jE8roefKCaQ=; b=L9zTlco6aGKVirzNGNj7TOXjsUKv41PxklmrroZfDMNTYtwr1jgWzOAgcsneCirwCn kzehd8670vWLI12kaB2+jgoMVdZnWmJmopJOtwkF/DnNhxgkEJi/kTJF2NMlp+NZHq+X sTBuza/CSSujMzcebSnSZxEGgvmKw9vzTHyEeEpsJbsym8ljAEa/XGY11+k7k7ZO7OmH VIAXrg8mVvAaIZAvapH50mjfhL8qcZ7aIalJ4w/WwVR9j/5GlYQMpT4YxOwQUDuOmNFC uUF22rNSkGW+jPfjuPyJFtV1T8vkdYdciwWT7Sa6i7Rx9JG2/ZM16c2+ItZjUnvLcaOe yxxA== 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=+PcgsNkTp1SrgatCCYVZXgwj6I+2R53/jE8roefKCaQ=; b=HqP03kSqvKs0KKUZkIRPz5E3kH69YGe/1l1JoZy/2JFTPqySTHIpOM/DGK6GigwFWI UIkXK37jelXd8ZUP7EG9aI2e5ymiYaTrHmxP1LoJGSByeOnOybnmHGjwNRATt/BJuWrb jplHJ5MF58g9cdT6kNpUkvMDOsNh8uPOWP35LzNtOOFboXheC7gU+q2Mc0MJyiUb4Cxo YScdalF4jJMwIbrgT/8eaxEBdHar0mDK1wcbRNQ9nbo0ZPxoal/vbWydw/xOh7H64yog CyL3s2F5Er3E/b2Ym7kNBnjcdk+7JKoHfymcxL006VJg7T4epZl3oC00l4+yiRByuseJ J+xw== X-Gm-Message-State: AOAM533xZLq6uI4HtVLtfaO47ide2Dyhhfge9MlLDchK5U+XgNeNNQ0I v8bZi+/oJZS4nRB7Ln9pq+waevwyrdKZRD3401i357ypCVU= X-Google-Smtp-Source: ABdhPJwm4gl/xZXH+FRrqcX4/qzU6OijBo/FCF0W9Cc9c/kScckkwvWEhtKsM/TW8qm4i5Mpyw8qotVxabPAMCrVXzM= X-Received: by 2002:a19:c1cf:: with SMTP id r198mr3784186lff.11.1616252420004; Sat, 20 Mar 2021 08:00:20 -0700 (PDT) In-Reply-To: <1628b6da-77e8-7935-9847-859317bec564@xs4all.nl> 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:110914 Archived-At: --===============0182920204369087727== Content-Type: multipart/alternative; boundary="0000000000005c9fce05bdf9176f" --0000000000005c9fce05bdf9176f Content-Type: text/plain; charset="UTF-8" On Sat, Mar 20, 2021 at 12:12 PM Hans Hagen wrote: > On 3/20/2021 8:24 AM, Aditya Mahajan wrote: > > On Sat, 20 Mar 2021, Christoph Reller wrote: > >> Of course we can do this in lua: > >> > >> if tex.modes["A"] and not tex.modes{"B"] then > >> ... > >> end > > > > ... which means that you can use that at the context end as well (old > feature). > > Save the following as test.mkix (or add "% macros=mkix" as the first > line): > > > > ``` > > \starttext > > > > \starttyping > > A and not B > > \stoptyping > > > > \starttyping > > not (A and not B) > > \stoptyping > > > > \stoptext > a neat application! > > Thank you for this hint, Aditya. This would be a very nice solution indeed. But it does not seem to work: % macros=mkix \definemode[A][yes] \starttext \startluacode if tex.modes['A'] then context("A") end \stopluacode A \stoptext With ConTeXt LMTX 2021.03.17 the output of the above is a single "A". I would expect two. What am I doing wrong? Christoph --0000000000005c9fce05bdf9176f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sat, Mar 20, 2021 at 12:12 PM Hans Hag= en <j.hagen@xs4all.nl> wrote= :
On 3/20/2021 8:24 AM, Aditya Mahajan wrote:
> On Sat, 20 Mar 2021, Christoph Reller wrote:
>> Of course we can do this in lua:
>>
>> if tex.modes["A"] and not tex.modes{"B"] then<= br> >> ...
>> end
>
> ... which means that you can use that at the context end as well (old = feature).
> Save the following as test.mkix (or add "% macros=3Dmkix" as= the first line):
>
> ```
> \starttext
> <?lua if tex.modes["A"] and not tex.modes["B"] = then ?>
> \starttyping
> A and not B
> \stoptyping
> <?lua else ?>
> \starttyping
> not (A and not B)
> \stoptyping
> <?lua end ?>
> \stoptext
a neat application!


Thank you for t= his hint, Aditya. This would be a very nice solution indeed. But it does no= t seem to work:

% macros=3Dmkix
\definemode[A][yes]<= br>\starttext
\startluacode
=C2=A0 if tex.modes['A'] then
= =C2=A0 =C2=A0 context("A")
=C2=A0 end
\stopluacode
<?= lua if tex.modes['A'] then ?>
A
<?lua end ?>
\sto= ptext

With ConTeXt LMTX=C2=A02021.03.17 the output o= f the above is a single "A". I would expect two.=C2=A0What am I d= oing wrong?

Christoph
--0000000000005c9fce05bdf9176f-- --===============0182920204369087727== 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== --===============0182920204369087727==--