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

2020-06-15 Thread Henning Hraban Ramm

> Am 10.06.2020 um 09:33 schrieb Hans Hagen :
> 
> the begin/end are used for marking blobs of content (kind of buffers) that 
> can be mixed in, reused, moved, while start/stop is for structure
> 
> so, begin/end is independent
> 
> it is an already old mechanism that was made for educational material where 
> one source had to result in teacher, student, examns, extra, materials
> 
> but it's there to stay ...

Wow, I think this is the first time I encounter blocks in my 20 years of using 
ConTeXt. Probably I just didn’t recognize they were special.

Astonished: Hraban
___
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
___


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

2020-06-10 Thread Hans Hagen

On 6/10/2020 8:42 AM, Jan Willem Flamma wrote:

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
the begin/end are used for marking blobs of content (kind of buffers) 
that can be mixed in, reused, moved, while start/stop is for structure


so, begin/end is independent

it is an already old mechanism that was made for educational material 
where one source had to result in teacher, student, examns, extra, materials


but it's there to stay ...

Hans

-
  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
___


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

2020-06-10 Thread Jan Willem Flamma
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\startquestionQuestion A\stopquestion\endquestion\beginanswer\startanswerAnswer A\stopanswer\endanswer Regards,Jan Willem Flamma  From: Hans HagenSent: Tuesday, 9 June 2020 09:37To: mailing list for ConTeXt users; Fabrice LSubject: 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 >> > 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-contextwebpage  : http://www.pragma-ade.nl / http://context.aanhet.netarchive  : https://bitbucket.org/phg/context-mirror/commits/wiki : http://contextgarden.net___ 
___
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
___


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

2020-06-09 Thread Fabrice L


> Le 9 juin 2020 à 03:37, Hans Hagen  a écrit :
> 
> On 6/8/2020 9:53 PM, Fabrice L wrote:
>>> Le 7 juin 2020 à 23:19, Aditya Mahajan >> > 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

You are right of course... In fact I already use blocks, for another purpose, 
but I did not think about this solution because I needed a lot of formatting 
(these blocks should occupy whole page, different background color…), but 
blocks can adapt to my current need (I have try this morning) using the 
\setupblock[][before=..,after=…] command. And there is a bonus; I can « collect 
» these blocks and put them all together at the end of my courses notes, this 
is perfect.


___
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
___


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

2020-06-09 Thread Hans Hagen

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



Le 7 juin 2020 à 23:19, Aditya Mahajan > 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
___


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

2020-06-08 Thread Wolfgang Schuster

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 ... 
\stopQuestions)


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.


Wolfgang
___
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
___


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

2020-06-08 Thread Fabrice L


> Le 7 juin 2020 à 23:19, Aditya Mahajan  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...
>> % 
>> 
>> 
>> So to be clear, I would like the result in the « ClassRoom » mode to be:
>> % 
>> Here are some questions:
>> 
>>  Question A….
>>  Question B….
>> 
>> Some other text...
>> % 
>> 
>> Otherwise to be:
>> % 
>> Some other text...
>> % 
> 
> If you only set `ClassRoom` mode at compile time (rather than setting and 
> unsetting it the middle of the document), then you can do:
> 
> \definebuffer[Questions]
> 
> \startmode[ClassRoom]
> \define\StopQuestionsList {...}
> 
> \definestartstop[Questions][...]
> \stopmode
> 

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. 


% --
\definebuffer[Questions]

\enablemode[ClassRoom] % Try "On / Off » to process "\startQuestions / 
\stopQuestions » or not.

\startmode[ClassRoom]
 
\definestartstop[Questions][before={\startframedtext\red},after={\stopframedtext\blue}]
\stopmode

\starttext

Before...

\startQuestions
The content of the buffer ! 
\stopQuestions

After...

\stoptext
% --

Thanks Aditya !
Fabrice.



> Aditya___
> 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 
> ___

___
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
___


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

2020-06-08 Thread Fabrice L
Dear Aditya,

> Le 7 juin 2020 à 23:19, Aditya Mahajan  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...
>> % 
>> 
>> 
>> So to be clear, I would like the result in the « ClassRoom » mode to be:
>> % 
>> Here are some questions:
>> 
>>  Question A….
>>  Question B….
>> 
>> Some other text...
>> % 
>> 
>> Otherwise to be:
>> % 
>> Some other text...
>> % 
> 
> If you only set `ClassRoom` mode at compile time (rather than setting and 
> unsetting it the middle of the document), then you can do:
> 
> \definebuffer[Questions]
> 
> \startmode[ClassRoom]
> \define\StopQuestionsList {...}
> 
> \definestartstop[Questions][...]
> \stopmode
> 


Thanks for your answer, I will try that.
Fabrice,


___
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
___


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

2020-06-07 Thread Aditya Mahajan

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...
% 


So to be clear, I would like the result in the « ClassRoom » mode to be:
% 
Here are some questions:

Question A….
Question B….

Some other text...
% 

Otherwise to be:
% 
Some other text...
% 


If you only set `ClassRoom` mode at compile time (rather than setting and 
unsetting it the middle of the document), then you can do:

\definebuffer[Questions]

\startmode[ClassRoom]
\define\StopQuestionsList {...}

\definestartstop[Questions][...]
\stopmode


Aditya___
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
___


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

2020-06-07 Thread Fabrice L
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...
% 


So to be clear, I would like the result in the « ClassRoom » mode to be:
% 
Here are some questions: 

Question A….
Question B…. 

Some other text...
% 

Otherwise to be:
% 
Some other text...
% 

Thanks for any help !
Fabrice.___
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
___