On 6/8/2021 16:11, Wolfgang Schuster wrote:
Rik Kabel schrieb am 08.06.2021 um 18:14:

Hello all,

Odd issue with LMTX (works fine with --luatex). \doifelsemode causes a failure if it is used to set a simple value such as on, off, yes, no, ..., but works with a dimension. Perhaps better illustrated by an example:

    \definemode        [aaa]
                       [keep]
    \setuplayout       [
                        marking=\doifmodeelse{aaa}{off}{on},
    %                   marking=on,
                        grid=\doifmodeelse{aaa}{yes}{no},
    %                   grid=yes,
                        bottom=\doifmodeelse{aaa}{10mm}{20mm},
                       ]
    \starttext
       This is only a test.
    \stoptext

The problem occurs whether or not the mode is enabled. In the example, it fails with the mode test in the either the marking= or grid= keys, but has no problem with it in the bottom= key.

The error message says:

    The control sequence marked <to be read again> should not appear
    between \csname and \endcsname.

pointing to the enabled \doifmodeelse line.

The same issue occurs with the following, using \doifmode:

    \definemode        [aaa]
                       [keep]
    \setuplayout       [
                        marking=on,
                        marking=\doifmode{aaa}{off},
                       ]
    \starttext
       This is only a test.
    \stoptext

This did work without complaint a few months ago.


You can never be sure if these combinations (\doifXXX within \setupXXX) work without problems. The only reliable method in this case is:

% default setup

\setuplayout
    [marking=on]

% mode dependent setup

\startmode[aaa]

    \setuplayout
        [marking=off]

\stopmode


Wolfgang

Yes, that works. Of course, to say that you can never be sure if such combinations will work is not a welcome statement about the state of ConTeXt.

More recent LMTX releases also now break older documents that worked (with LMTX and MkIV) before. If there is an error in what was previously written that is only noticed because of tighter enforcement, that is one thing, but an undocumented change to supported behaviour is less to be desired. And that it works with dimensions but not on/off/yes/no is very strange and suggests some other problem may be lurking.

--
Rik

___________________________________________________________________________________
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