ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Fabrice L via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Fabrice L <fabrice.alpha@gmail.com>
Subject: Re: Blocks inside a conditional mode.
Date: Mon, 29 Nov 2021 08:54:27 -0500	[thread overview]
Message-ID: <0BEB6957-40A6-4131-8972-775EEEA83BBE@gmail.com> (raw)
In-Reply-To: <c6b60330-6237-ada1-9968-e4bd68ee7bb8@xs4all.nl>

Dear Hans,

> Le 29 nov. 2021 à 03:54, Hans Hagen <j.hagen@xs4all.nl> a écrit :
> 
> On 11/29/2021 2:54 AM, Fabrice L via ntg-context wrote:
> 
>> The only inconvenient of this solution if that I have to define 15 blocks (one for each week of the term): ComplementOne, ComplementTwo, 
> \defineblock[example]
> 
> \starttext
> 
> 	\beginexample[Two]
> 		Last course, we have seen A.
> 	\endexample
> 
> 	\beginexample[Three]
> 		Last course, we have seen B….
> 	\endexample
> 
> 	\beginexample[Three]
> 		Last course, we have seen C….
> 	\endexample
> 
>    \useblocks[example][Two]
> %     \useblocks[example][Three]
> 
> \stoptext
> 
> %————————————————————————————————


Thanks (again). ConTeXt is always full of ressource ! I did not know we could do this, even if I realized now that there is a similar example in the wiki. 

For the list, in case in the future this would be useful for another user, below is the complete minimal example using this approach.


% ----- Minimal working example :

\setuppapersize[S5][S5]
\enablemode[Professor]

\defineblock[Complement]
\setupblock[Complement][
	before={\page[yes]\setuppagenumber[state=stop]\setupheadertexts[]\setupbackgrounds[page][background=color,backgroundcolor=red]},
	after={\page[yes]\setuppagenumber[state=start]}]

\starttext

	% Let's process the summaries  ------------;
	\beginComplement[Two]
		Last course, we have seen A.
	\endComplement

	\beginComplement[Three]
		Last course, we have seen B….
	\endComplement

	\beginComplement[Three]
		Last course, we have seen C….
	\endComplementThree

	\beginComplement[Four]
		Last course, we have seen D….
	\endComplementFour
	\beginComplement
		and E !
	\endComplementFour
	% ---- summaries: end   ------------;

	Let's begin course 1. 
	This is course 1 : a lot of pages here about A! 
	\page[yes]
	
	Let's begin course 2. 
	\doifmode{Professor} {
		\useblocks[Complement][Two]
	}

	This is course 2 : a lot of pages here about B and C! 

	\page[yes]
	Let's begin course 3. 
	\doifmode{Professor} {
		\useblocks[Complement][Three]
	}	

	This is course 3 : a lot of pages here about D... ! 
	\doifmode{Professor} {
		\useblocks[Complement][Four]
	}	

	The course 4 ! 
\stoptext

% ----- Minimal working example  : end --------


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
___________________________________________________________________________________

      reply	other threads:[~2021-11-29 13:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-28 18:39 Fabrice L via ntg-context
2021-11-28 20:42 ` Henning Hraban Ramm via ntg-context
2021-11-29  1:54   ` Fabrice L via ntg-context
2021-11-29  8:54     ` Hans Hagen via ntg-context
2021-11-29 13:54       ` Fabrice L via ntg-context [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0BEB6957-40A6-4131-8972-775EEEA83BBE@gmail.com \
    --to=ntg-context@ntg.nl \
    --cc=fabrice.alpha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).