From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/110930 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: Sun, 21 Mar 2021 15:44:00 +0100 Message-ID: References: <41b732e4-b771-15a2-7fc1-5ead8086f4f9@xs4all.nl> <1628b6da-77e8-7935-9847-859317bec564@xs4all.nl> <9f6c1bc1-8aa6-7f69-6586-e8edab181097@xs4all.nl> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8256764527679062282==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7370"; mail-complaints-to="usenet@ciao.gmane.io" Cc: mailing list for ConTeXt users To: Hans Hagen Original-X-From: ntg-context-bounces@ntg.nl Sun Mar 21 15:44:45 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 1lNzJt-0001oV-If for gctc-ntg-context-518@m.gmane-mx.org; Sun, 21 Mar 2021 15:44:45 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 14DFE280E27; Sun, 21 Mar 2021 15:44:20 +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 hav5RCTuB53t; Sun, 21 Mar 2021 15:44:18 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id A0427281BA8; Sun, 21 Mar 2021 15:44:18 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id D8267281BA8 for ; Sun, 21 Mar 2021 15:44:17 +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 sf0TABA8fyPT for ; Sun, 21 Mar 2021 15:44:17 +0100 (CET) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.208.182; helo=mail-lj1-f182.google.com; envelope-from=christoph.reller@gmail.com; receiver= Original-Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (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 EC9EF280E27 for ; Sun, 21 Mar 2021 15:44:16 +0100 (CET) Original-Received: by mail-lj1-f182.google.com with SMTP id y1so17842817ljm.10 for ; Sun, 21 Mar 2021 07:44:16 -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 :cc; bh=kNI2x6rzCpstX17TpN3PGaWu+Lwv5ukiculk57du2O4=; b=FxKuOYWiH/6CLJO7T+E6GMMD8gkcn102QA2OFYdxAEoZfnolR8FuT0dd7C86h5G9cZ 1XJ2+ms1Ot6puIUtJratau+EsQdywLAGk+mELrxeRJ+CqpI+eNnNni+tDM1lxV8D1adz uZclWWKLJh5TJULL8Z96CiAz7DbvapLu88Wy43cqV/LNO/dcgiepW1SFJKu/q8OV0N7W Klzpo6qYWAiqANtquYlmWSchA5TdykkNQu6VLTKtD5v7/zz6T/ocvc6SJaVrbojgn6CX i29BuWApFlosv7j/F2grdD3oDmgcLl1dxKJcZX6wfBr1VlCasKvfEHOSk1B7+UnW3bYD QUlQ== 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:cc; bh=kNI2x6rzCpstX17TpN3PGaWu+Lwv5ukiculk57du2O4=; b=g7ZkUGYXoQYR1wqIyY9JgF1UMJe6BvMIyozPm1zql7lWoNA7eunQENd6URGKkXl7xQ 0FWxHaYhLuLNCQRxuqUoDQQvlE10Tjc5o2My02FGbVd96t/pJwI1IhlwHwOwPN3IzY4C TtqG90zrZDS36jNaThun4hhfKQ0x1ip8BkzzRVolvacOkHaQufKd+Nu6ipvAFcHigNa0 hZgARSI3gLBHE11ydJ8AwQpfKW9qP1dk7fdgaHhdgE0qKZnY9n1PX3SbpjUrvieRTJjQ vrmowz0vyFAowT/qZXCJcHQDm3qBmZIDl0M5lly9MJasXp0E2eJ+R4j4VZ7k8Hpvf7Xg /EOw== X-Gm-Message-State: AOAM531WTGi5Q4Vdq8mVQ4vg1ALFBobnfz4cz/Rz5RxUx3n0V0PrIfqE iYCuyTrGDswrLExmtEIq9K0WWHImXc/TvEctmN0= X-Google-Smtp-Source: ABdhPJyE+CpLxU9irlL54+l/2ktRdIJicmM7CvOV+rvcj0YqFmx1G5PkYOS46VqLJh4FFyZC36pDUTMlUPkAJ4IcJy0= X-Received: by 2002:a05:651c:28b:: with SMTP id b11mr6723758ljo.219.1616337856224; Sun, 21 Mar 2021 07:44:16 -0700 (PDT) In-Reply-To: <9f6c1bc1-8aa6-7f69-6586-e8edab181097@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:110930 Archived-At: --===============8256764527679062282== Content-Type: multipart/alternative; boundary="000000000000c1e24105be0cfb90" --000000000000c1e24105be0cfb90 Content-Type: text/plain; charset="UTF-8" On Sat, Mar 20, 2021 at 6:07 PM Hans Hagen wrote: > On 3/20/2021 4:00 PM, Christoph Reller wrote: > > 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? > > When the file gets preprocessed the mode is not known > > context --mode=A foo.tex > > it does of course also work when you set the mode in a parent file and > then include foo.tex For me this is good enough, because I define modes always in top-level files or in modules. Thank you! Christoph --000000000000c1e24105be0cfb90 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sat, Mar 20, 2021 at 6:07 PM Hans Hage= n <j.hagen@xs4all.nl> wrote:=
On 3/20/2021 4:00 PM, Christoph Reller wrote:
> On Sat, Mar 20, 2021 at 12:12 PM Hans Hagen <j.hagen@xs4all.nl
> <mailto:j.ha= gen@xs4all.nl>> wrote:
>
>=C2=A0 =C2=A0 =C2=A0On 3/20/2021 8:24 AM, Aditya Mahajan wrote:
>=C2=A0 =C2=A0 =C2=A0 > On Sat, 20 Mar 2021, Christoph Reller wrote:<= br> >=C2=A0 =C2=A0 =C2=A0 >> Of course we can do this in lua:
>=C2=A0 =C2=A0 =C2=A0 >>
>=C2=A0 =C2=A0 =C2=A0 >> if tex.modes["A"] and not tex.m= odes{"B"] then
>=C2=A0 =C2=A0 =C2=A0 >> ...
>=C2=A0 =C2=A0 =C2=A0 >> end
>=C2=A0 =C2=A0 =C2=A0 >
>=C2=A0 =C2=A0 =C2=A0 > ... which means that you can use that at the = context end as well
>=C2=A0 =C2=A0 =C2=A0(old feature).
>=C2=A0 =C2=A0 =C2=A0 > Save the following as test.mkix (or add "= ;% macros=3Dmkix" as the
>=C2=A0 =C2=A0 =C2=A0first line):
>=C2=A0 =C2=A0 =C2=A0 >
>=C2=A0 =C2=A0 =C2=A0 > ```
>=C2=A0 =C2=A0 =C2=A0 > \starttext
>=C2=A0 =C2=A0 =C2=A0 > <?lua if tex.modes["A"] and not = tex.modes["B"] then ?>
>=C2=A0 =C2=A0 =C2=A0 > \starttyping
>=C2=A0 =C2=A0 =C2=A0 > A and not B
>=C2=A0 =C2=A0 =C2=A0 > \stoptyping
>=C2=A0 =C2=A0 =C2=A0 > <?lua else ?>
>=C2=A0 =C2=A0 =C2=A0 > \starttyping
>=C2=A0 =C2=A0 =C2=A0 > not (A and not B)
>=C2=A0 =C2=A0 =C2=A0 > \stoptyping
>=C2=A0 =C2=A0 =C2=A0 > <?lua end ?>
>=C2=A0 =C2=A0 =C2=A0 > \stoptext
>=C2=A0 =C2=A0 =C2=A0a neat application!
>
>
> Thank you for this hint, Aditya. This would be a very nice solution > indeed. But it does not seem to work:
>
> % macros=3Dmkix
> \definemode[A][yes]
> \starttext
> \startluacode
>=C2=A0 =C2=A0 if tex.modes['A'] then
>=C2=A0 =C2=A0 =C2=A0 context("A")
>=C2=A0 =C2=A0 end
> \stopluacode
> <?lua if tex.modes['A'] then ?>
> A
> <?lua end ?>
> \stoptext
>
> With ConTeXt LMTX=C2=A02021.03.17 the output of the above is a single = "A". I
> would expect two.=C2=A0What am I doing wrong?

When the file gets preprocessed the mode is not known

context --mode=3DA foo.tex

it does of course also work when you set the mode in a parent file and
then include foo.tex

For me this is good en= ough, because I define modes always in top-level files or in modules. Thank= you!

Christoph
--000000000000c1e24105be0cfb90-- --===============8256764527679062282== 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== --===============8256764527679062282==--