[NTG-context] Can I simplify this to some sort of logic so it scales better?

Wolfgang Schuster wolfgang.schuster.lists at gmail.com
Mon Jun 6 14:18:42 CEST 2022


Gerben Wierda via ntg-context schrieb am 06.06.2022 um 13:34:
> I have this:
>
> \definemode[EN,FR,RU,PT][keep]
> \doifmodeelse{EN}
> {
>     \disablemode[FR]
>     \disablemode[RU]
>   \disablemode[PT]
>   }
>   {
> \doifmodeelse{FR}
>     {
>       \disablemode[EN]
>       \disablemode[RU]
>       \disablemode[PT]
>     }
>     {
>       \doifmodeelse{RU}
>       {
>       \disablemode[EN]
> \disablemode[FR]
> \disablemode[PT]
>       }
>       {
>       \doifmodeelse{PT}
>         {
>           \disablemode[EN]
>           \disablemode[FR]
>           \disablemode[RU]
>         }
>       {
> \enablemode[EN]
>         }
>       }
>   }
>   }
>
> But for every language added this becomes more and more complex. I was 
> wondering what would be a good approach to simplify it.
>
> I want to make sure that one and only one of these modes is active and 
> that if no mode is entered on the command line the mode is EN.

%\enablemode[EN]
\enablemode[FR]
%\enablemode[RU]
%\enablemode[PT]

\definemode[EN,FR,RU,PT][keep]

\startmodeset
     [EN]      {\disablemode[FR,RU,PT]}
     [FR]      {\disablemode[EN,RU,PT]}
     [RU]      {\disablemode[EN,FR,PT]}
     [PT]      {\disablemode[EN,FR,RU]}
     [default] {\enablemode[EN]}
\stopmodeset

\starttext
\doifmode{EN}{english}
\doifmode{FR}{french}
\doifmode{RU}{russian}
\doifmode{PT}{portuguese}
\stoptext

Wolfgang

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20220606/d665c5b8/attachment.htm>


More information about the ntg-context mailing list