On Fri, Mar 19, 2021 at 9:49 AM Hans Hagen <j.ha...@xs4all.nl> wrote:

> On 3/19/2021 4:58 AM, Christoph Reller wrote:
> > Hi,
> >
> > Consider the following MWE:
> >
> > \definetyping[T]
> > \definemode[mode][yes]
> > \starttext
> > \doifmode{mode}{%
> >    \startT
> >      Bla
> >    \stopT}
> > \stoptext
> >
> > Compilation with the currently latest ConTeXt LMTX (ver: 2021.03.17
> > 17:46 LMTX  fmt: 2021.3.18) fails with:
> >
> > tex error       > runaway error: end of file encountered
> > mtx-context     | fatal error: return code: 1
> >
> > Compilation is successful if I replace doifmode{mode}{...} by
> > \startmode[mode]...\stopmode.
> >
> > Is there anything I'm missing? (This could be a bug.)
> not a bug, just the way tex works .. modes cannot know that what goes
> into an argument is something verbose
>
> but you can use this (also more efficient here):
>
> \definetyping[T]
> \definemode[mode][yes]
> \starttext
> \startmode[mode]
> \startT
>      Bla
> \stopT
> \stopmode
> \stoptext
>
> % there's also \startnotmode
>
>
Thank you for hinting at the environment form. The problem with this is,
that it cannot be nested, and that there is no "else" form.
E.g:

\startmode[A]
... mode A
\startmode[B]
... mode A and mode B
\elsemode
... mode A and not mode B
\stopmode
\stopmode

I know that there is \start(not)mode and \start(not)allmodes, but there
seems to be no way to use a general boolean expression such as:

\startmodes[A and not B]
...
\stopmodes

Of course we can do this in lua:

if tex.modes["A"] and not tex.modes{"B"] then
...
end

Keep up your excellent work! Cheers,

Christoph
___________________________________________________________________________________
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
___________________________________________________________________________________

Reply via email to