[NTG-context] start/stop executed conditionally on mode ?

Wolfgang Schuster wolfgang.schuster.lists at gmail.com
Mon Jun 8 22:22:28 CEST 2020

Fabrice L schrieb am 08.06.2020 um 21:53:

> Thanks to Aditya, I have succeeded, but it was not trivial for me. So, 
> in case somebody someday would need a detailed solution, here is a 
> minimal example, and an explanation.
> A buffer « Questions » is defined. If in « ClassRoom » mode, a 
> start/stop « Questions » is also defined. So when ConTeXt encounters the 
> \startQuestions / \stopQuestions, if the « ClassRoom » mode is enabled, 
> the buffer is processed (with some format if needed - framed here for 
> the example), and if the mode « ClassRoom » is disabled, then nothing is 
> process. You can add as many \startQuestions / \stopQuestions you wish.

Let me give a better explanation.

The line

     \definebuffer [Questions]

serves two purposes:

     1. It create a Questions environment (\startQuestions ... 

     2. I gobbles the content of the environment.

When you enable the ClassRoom mode ConTeXt encounters this line

     \definestartstop [Questions]

which redefines the Questions environment which uses now the 
startstop-mechanism but the previously created environment buffer based 
environment no longer exists.

The reason for this redefinition is to keep the content of the 
environment in the document although you could have used other methods 
to achieve the same as \definestartstop.


More information about the ntg-context mailing list