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: Blocks inside a conditional mode.
Date: Sun, 28 Nov 2021 13:39:27 -0500	[thread overview]
Message-ID: <31350963-95D3-421F-A069-CDE1D9730DF3@gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 3369 bytes --]

Dear list,

I have an error when I try to insert a block inside a conditional mode (but there is two nested conditional mode.. is this the problem ?).  

In my courses notes, I insert some blocks (named «  Complement » in the minimal exemple below) when in « Professor » mode. This works fine, as shown in the first «  \beginComplement … \endComplement  » of my example below. 

But now I have to use another condition for some blocks, depending of the number of the current course. So I insert my block with a condition, here « CourseOne » :

	\enablemode[CourseOne]
	\doifmode{CourseOne}{
		\beginComplement
		Another complementary slide. 
		\endComplement
	}

But this does not work :

% ————
tex error       > tex error on line 1 in file /Users/fabricel/context/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv: ! TeX capacity exceeded, sorry [input stack size=50000]
% ————

The problem can be summarized in this minimal non working example : 

% — MWE —————————————————————
\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]}]
\doifallmodes{Professor} {
    \keepblocks[Complement]
}

\starttext

	page 1
	
	\beginComplement
		A complementary slide. 
	\endComplement

	page 2

	\enablemode[CourseOne]
	\doifmode{CourseOne}{
		\beginComplement
		Another complementary slide but only for course number 1. 
		\endComplement
	}
	\disablemode[CourseOne]

	page 3

	\enablemode[CourseTwo]
	\doifmode{CourseTwo}{
		\beginComplement
		Another complementary slide but only for course number 2. 
		\endComplement
	}
	\disablemode[CourseTwo]

\stoptext
\stoptext

% — MWE —————————————————————

Blocks and modes usually works fine for me, but here, I do not understand my error.
Thanks for any help ! 

Fabrice. 


Note : in case this way of doing things seems a bit silly, here are more explanations. I do use mode « CourseOne »  here because in the real life, the content in the condition «  \doifmode{CourseOne}{ …} » is read in an external file, containing material for « CourseOne », « CourseTwo », etc. The setup is then, in the main file :

% Main file : begin ----------------

Bla bla bla ...

\enablemode[CourseOne]
\input ComplementMaterial.tex
\disablemode[CourseOne]

Bla bla bla ...

\enablemode[CourseOne]
\input ComplementMaterial.tex
\disablemode[CourseOne]

% Main file : end ----------------

And in the « ComplementMaterial.tex » there is :

% ComplementMaterial.tex —————————

	\doifmode{CourseOne}{
		\beginComplement
		A complementary slide but only for course number 1. 
		\endComplement

		\beginComplement
		Another complementary slide but only for course number 1. 
		\endComplement
	}

	\doifmode{CourseTwo}{
		\beginComplement
		A complementary slide but only for course number 2. 
		\endComplement

		\beginComplement
		Another complementary slide but only for course number 2. 
		\endComplement
	}
% ComplementMaterial.tex —————————


[-- Attachment #1.2: Type: text/html, Size: 9560 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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-28 18:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-28 18:39 Fabrice L via ntg-context [this message]
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

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=31350963-95D3-421F-A069-CDE1D9730DF3@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).