From: Christoph Reller <christoph.reller@gmail.com>
To: Hans Hagen <j.hagen@xs4all.nl>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Typing within doifmode leads to error
Date: Sun, 21 Mar 2021 15:44:00 +0100 [thread overview]
Message-ID: <CAO8LnPGWrL0rJm9o2RytrNHeF6oOr5+0C+SwFCsG8X0ri=Kkxw@mail.gmail.com> (raw)
In-Reply-To: <9f6c1bc1-8aa6-7f69-6586-e8edab181097@xs4all.nl>
[-- Attachment #1.1: Type: text/plain, Size: 1827 bytes --]
On Sat, Mar 20, 2021 at 6:07 PM Hans Hagen <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.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
> > >> ...
> > >> 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
> > > <?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 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
> > <?lua if tex.modes['A'] then ?>
> > A
> > <?lua end ?>
> > \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
[-- Attachment #1.2: Type: text/html, Size: 2860 bytes --]
[-- Attachment #2: Type: text/plain, Size: 493 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
prev parent reply other threads:[~2021-03-21 14:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-19 3:58 Christoph Reller
2021-03-19 4:37 ` Aditya Mahajan
2021-03-19 6:59 ` Christoph Reller
2021-03-19 8:49 ` Hans Hagen
2021-03-20 5:24 ` Christoph Reller
2021-03-20 7:24 ` Aditya Mahajan
2021-03-20 11:11 ` Hans Hagen
2021-03-20 15:00 ` Christoph Reller
2021-03-20 17:07 ` Hans Hagen
2021-03-20 20:23 ` Aditya Mahajan
2021-03-20 20:49 ` Hans Hagen
2021-03-20 21:03 ` Aditya Mahajan
2021-03-21 1:43 ` Hans Hagen
2021-03-21 2:40 ` Aditya Mahajan
2021-03-21 14:44 ` Christoph Reller [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAO8LnPGWrL0rJm9o2RytrNHeF6oOr5+0C+SwFCsG8X0ri=Kkxw@mail.gmail.com' \
--to=christoph.reller@gmail.com \
--cc=j.hagen@xs4all.nl \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).