[NTG-context] Modes and conditional part of the source

Procházka Lukáš Ing. LPr at pontex.cz
Thu Feb 28 13:14:06 CET 2019


Hello Aditya,

thanks for the code, I'll try something like that.

Best regards,

Lukas


On Thu, 28 Feb 2019 12:54:06 +0100, Aditya Mahajan <adityam at umich.edu> wrote:

> On Thu, 28 Feb 2019, Procházka Lukáš Ing. wrote:
>
>> Hello,
>>
>> I'm struggling with using modes to make a part of the text conditional.
>>
>> Here is my code:
>>
>> ----
>> \def\b#1{\startmode[#1]}
>> \def\e{\stopmode}
>>
>> % \enablemode[100] % For optional usage
>>
>> \starttext
>> A
>> \b{100} % Should be start of some conditional text from here ...
>>   B
>> \e % ... to here
>> \stoptext
>
> Modes don't work that way. You can do something like this:
>
> \define[1]\bbb
>      {\doifnotmode{#1}
>          {\grabbufferdata[dummy][bbb][eee]}}
>
> \let\eee\relax
>
> \enablemode[100]
>
> \starttext
> A
>
> \bbb{100}
>    Inside mode 100
> \eee
>
> \bbb{101}
>    Inside mode 101
> \eee
>
> \stoptext
>
>
> Depending on the actual use case, there might be simpler ways.
>
> Aditya


-- 
Ing. Lukáš Procházka | mailto:LPr at pontex.cz
Pontex s. r. o.      | mailto:pontex at pontex.cz | http://www.pontex.cz | IDDS: nrpt3sn | IČO: 40763439
Bezová 1658
147 14 Praha 4

Mob.: +420 702 033 396



More information about the ntg-context mailing list