Dear list,

 

I have seen the use of blocks mechanism with and without a start/stop combination.

 

It is not clear to me in which cases it is required to also include a start/stop combination in this mechanism.

 

\beginquestion

\startquestion

Question A

\stopquestion

\endquestion

\beginanswer

\startanswer

Answer A

\stopanswer

\endanswer

 

Regards,

Jan Willem Flamma

 

 

From: Hans Hagen
Sent: Tuesday, 9 June 2020 09:37
To: mailing list for ConTeXt users; Fabrice L
Subject: Re: [NTG-context] start/stop executed conditionally on mode ?

 

On 6/8/2020 9:53 PM, Fabrice L wrote:

>

>

>> Le 7 juin 2020 à 23:19, Aditya Mahajan <adityam@umich.edu

>> <mailto:adityam@umich.edu>> a écrit :

>> 

>> On Sun, 7 Jun 2020, Fabrice L wrote:

>> 

>>> Dear List,

>>> 

>>> I would like to insert a page using (ideally) start/stop

>>> instructions. The problem is that this page should be inserted only

>>> in a certain mode. Consulting the mailing list, I thought the

>>> following code was working, but it’s not ! The code is executed in

>>> the mode as expected, but the following instructions ("Some other

>>> text... » in the exemple) is not typeset.

>>> 

>>> Here is a minimal (not working!) example:

>>> 

>>> % ————————————————————————————————————

>>> \unexpanded\def\StartQuestionsList{

>>> \startmode[ClassRoom]  \page[yes] Here are some questions: \blank

>>> }

>>> \unexpanded\def\StopQuestionsList{

>>> \page[yes] \stopmode

>>> }

>>> \definestartstop[Questions][

>>> before=\StartQuestionsList,

>>> after=\StopQuestionsList

>>> ]

>>> 

>>> 

>>> \startQuestions

>>> Question A….

>>> Question B….

>>> \stopQuestions

>>> 

>>> Some other text...

>>> % ————————————————————————————————————

One of the oldest mechanism available ... blocks:

 

\enablemode[classroom] % comment this

 

\defineblock[Question]

 

\doifmode {classroom} {

     \keepblocks[Question]

}

 

\starttext

 

     Text A

 

     \beginQuestion

         Question A….

     \endQuestion

 

     Text B

 

     \beginQuestion

         Question B….

     \endQuestion

 

     \page

 

     \doifnotmode {classroom} {

         \useblocks[Question]

     }

 

\stoptext

 

-----------------------------------------------------------------

                                           Hans Hagen | PRAGMA ADE

               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands

        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl

-----------------------------------------------------------------

___________________________________________________________________________________

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

___________________________________________________________________________________