From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/113578 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Fabrice L via ntg-context Newsgroups: gmane.comp.tex.context Subject: Re: Blocks inside a conditional mode. Date: Sun, 28 Nov 2021 20:54:24 -0500 Message-ID: <13B3FA56-541A-47C2-91EA-45E5FFB5648B@gmail.com> References: <31350963-95D3-421F-A069-CDE1D9730DF3@gmail.com> <41b6060c-0f46-6b90-91c7-f9d6588e66d3@fiee.net> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.20.0.1.32\)) Content-Type: multipart/mixed; boundary="===============3137767282945990797==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12934"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Fabrice L To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Mon Nov 29 02:54:58 2021 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mrVsg-00038V-Nr for gctc-ntg-context-518@m.gmane-mx.org; Mon, 29 Nov 2021 02:54:58 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id EA3F1282543; Mon, 29 Nov 2021 02:54:37 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FgWg4Ai0ZNMm; Mon, 29 Nov 2021 02:54:36 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 56C01282FD6; Mon, 29 Nov 2021 02:54:36 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 26E37282543 for ; Mon, 29 Nov 2021 02:54:33 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0NaZr3ByD9Vv for ; Mon, 29 Nov 2021 02:54:28 +0100 (CET) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.160.182; helo=mail-qt1-f182.google.com; envelope-from=fabrice.alpha@gmail.com; receiver= Original-Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 282F42800F1 for ; Mon, 29 Nov 2021 02:54:28 +0100 (CET) Original-Received: by mail-qt1-f182.google.com with SMTP id n15so15009232qta.0 for ; Sun, 28 Nov 2021 17:54:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:mime-version:subject:date:references:to:in-reply-to:message-id; bh=2Web0vFKgFxo3RHlnwREZMucVk20BCfLVyHd7Mq1RF8=; b=Kml0ympyxTFwBXk1R/rHVwkpeHyPsritfoZeCz0DiHh9JwHFSYtjkeJ/7VKJZ4Hkr6 rMXSZrO8OcWquOR0UIUugNwWaqGavw1nX3xRu9mwvpb672ndIkS6sCtO5sJzRCKy/45L N2crBxzFqsL5ouSdCO4b7iba/7RWJFFXpdWiPAorVdzmdjuwiR7Xx0Y5YjOoYgClEZJF pdrf+QFh9bJ2MXx97WfraTwYDIKFwxw0s8rF1byMRSpmHEla++OumZVXws/QZA9Dyhp0 +x7LrR5YuLlJW820ppRCJ/wpLLvfSuMuaZN62uCJ5GKNO+czR/ZJVRQivPt81g/Ys0AN w8vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:mime-version:subject:date:references:to :in-reply-to:message-id; bh=2Web0vFKgFxo3RHlnwREZMucVk20BCfLVyHd7Mq1RF8=; b=16+Q/G4BsnFCxwooIIfk62o42w5wOmnZNCWCZEWdMcH7/jAF6UPJR/9j9rJHsY4jj3 3MNzaX1+KSuIsV6pf3n371azXyLGGk6PdHowRRCAFFydpyMzvfqoTavkEwGFtzHZfMkY QCRFrvK6V1q52NeN+SQkjBMVb2Wh3fnjAfvcohRKZryLaZQrRxSBZWorxUoR/W4if45Y xPD+sPUJqMhwIONh67uuXUhzUxuVlmQTP3u7H71B+oAKyNREFSP1s1bKtm/THg0xI+ww s6lnC6+w6SJ9dkWrGrSkf0DWYRpfqdvqDwDCuUPQ79EOCOVBb1kJUlZrZHS4ZQnoLKIb Yvmg== X-Gm-Message-State: AOAM530HQr3QYNIQYLVY7bjbkE4+9QPafzc0PvqMHX6rqI2pWQYNy92M u11G2wJ1I1WFsFhnFR2EmlifktahyFU= X-Google-Smtp-Source: ABdhPJzHI0aSTfn+NObEn0dL8WyRbju0YFASgggi3htZHmOvDKOcSEql4AHotGloZnNDK9pXCduZwA== X-Received: by 2002:ac8:4e8c:: with SMTP id 12mr40630424qtp.45.1638150866283; Sun, 28 Nov 2021 17:54:26 -0800 (PST) Original-Received: from smtpclient.apple ([38.74.28.141]) by smtp.gmail.com with ESMTPSA id s13sm7586832qki.23.2021.11.28.17.54.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Nov 2021 17:54:25 -0800 (PST) In-Reply-To: <41b6060c-0f46-6b90-91c7-f9d6588e66d3@fiee.net> X-Mailer: Apple Mail (2.3693.20.0.1.32) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:113578 Archived-At: --===============3137767282945990797== Content-Type: multipart/alternative; boundary="Apple-Mail=_0A5C20F0-7315-41C6-81A4-F02BA78F133B" --Apple-Mail=_0A5C20F0-7315-41C6-81A4-F02BA78F133B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Thanks Hraban for your answer,=20 > Le 28 nov. 2021 =C3=A0 15:42, Henning Hraban Ramm via ntg-context = a =C3=A9crit : >=20 > Am 28.11.21 um 19:39 schrieb Fabrice L via ntg-context: >> 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 ?). >=20 > You can=E2=80=99t nest modes in \startmode ... \stopmode. > I don=E2=80=99t know what are the limitations of \doifmode. According to the wiki, we cannot nest several \startmode =E2=80=A6\stopmod= e, but there is no limitation with \doifmode. >=20 > Maybe it helps to use additional grouping with {}, \bgroup .. \egroup = or \start .. \stop. Following your advice, I tried with several {}, but no luck.=20 >=20 >> In my courses notes, I insert some blocks (named =C2=AB Complement = =C2=BB in the minimal exemple below) when in =C2=AB Professor =C2=BB = mode. This works fine, as shown in the first =C2=AB \beginComplement = =E2=80=A6 \endComplement =C2=BB of my example below. >=20 > Maybe you can work with buffers or (ConTeXt) blocks (the latter were = recently discussed here, it=E2=80=99s a quite unknown mechanism). I already use blocks, but following your message, I tried to think = differently. One solution would be to define a block for each course. = Something like this (a working minimal example, redone in order this = would be more easier to understand (I hope!) what I=E2=80=99m trying to = do): % =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94= =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94 \setuppapersize[S5][S5] \enablemode[Professor] \defineblock[ComplementTwo] \defineblock[ComplementThree] \setupblock[ComplementTwo,ComplementThree][ = before=3D{\page[yes]\setuppagenumber[state=3Dstop]\setupheadertexts[]\setu= pbackgrounds[page][background=3Dcolor,backgroundcolor=3Dred]}, after=3D{\page[yes]\setuppagenumber[state=3Dstart]}] \starttext % Let's process the summaries ; \beginComplementTwo Last course, we have seen A. \endComplementTwo \beginComplementThree Last course, we have seen B=E2=80=A6. \endComplementThree \beginComplementThree Last course, we have seen C=E2=80=A6. \endComplementThree % ----=20 Let's begin course 1.=20 This is course 1 : a lot of pages here about A!=20 \page[yes] =09 Let's begin course 2.=20 \doifmode{Professor} { \useblocks[ComplementTwo] } This is course 2 : a lot of pages here about B and C!=20 \page[yes] Let's begin course 3.=20 \doifmode{Professor} { \useblocks[ComplementThree] }=09 This is course 3 : a lot of pages here about D... !=20 \stoptext %=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2= =80=94=20 The only inconvenient of this solution if that I have to define 15 = blocks (one for each week of the term): ComplementOne, ComplementTwo, = .., ComplementFithteen=E2=80=A6 Another drawback of this is difficult to = move one block form one week to another if I change something. Each = block here correspond in fact to a summary of the previous course. So I = have typically around 10 pages of summary for each course. The challenge = is that the content of each course is not exactly the same form one term = to another, so I have to move a page to the summary from one course to = the other one, like in a given term, if teach about subject C in course = 3 : \beginComplementThree Last course, we have seen C=E2=80=A6. \endComplementThree , but next term in course 4: \beginComplementFour Last course, we have seen C=E2=80=A6. \\beginComplementFour I have to manually change \beginComplementThree =E2=80=A6 = \endComplementThree to \beginComplementFour =E2=80=A6 = \beginComplementFour. But I will do this if I do not find another solution.=20 Thanks again Hraban. Fabrice.=20 >=20 >=20 > Hraban > = __________________________________________________________________________= _________ > If your question is of interest to others as well, please add an entry = to the Wiki! >=20 > 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 > = __________________________________________________________________________= _________ --Apple-Mail=_0A5C20F0-7315-41C6-81A4-F02BA78F133B Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Thanks Hraban for your answer, 

Le 28 = nov. 2021 =C3=A0 15:42, Henning Hraban Ramm via ntg-context <ntg-context@ntg.nl> = a =C3=A9crit :

Am 28.11.21 um 19:39 schrieb Fabrice L via = ntg-context:
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 ?).

You can=E2=80=99t nest modes in = \startmode ... \stopmode.
I don=E2=80=99t know what are = the limitations of \doifmode.

According to the wiki, we cannot nest several = \startmode =E2=80=A6\stopmode, but there is no limitation with = \doifmode.


Maybe it helps to use = additional grouping with {}, \bgroup .. \egroup or \start .. \stop.

Following = your advice, I tried with several {}, but no luck. 

In my = courses notes, I insert some blocks (named =C2=AB  = Complement =C2=BB in the minimal exemple below) when in = =C2=AB Professor =C2=BB mode. This works fine, as shown in the = first =C2=AB  \beginComplement =E2=80=A6 = \endComplement  =C2=BB of my example below.

Maybe you can work with buffers = or (ConTeXt) blocks (the latter were recently discussed here, it=E2=80=99s= a quite unknown mechanism).

I already = use blocks, but following your message, I tried to think differently. = One solution would be to define a block for each course. Something like = this (a working minimal example, redone in order this would be more = easier to understand (I hope!) what I=E2=80=99m trying to = do):

% = =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2= =80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94
\setuppaper= size[S5][S5]
\enablemode[Professor]

\defineblock[ComplementTwo]
\defineblock[C= omplementThree]

\setupblock[ComplementTwo,ComplementThree][
= before=3D{\page[yes]\setuppagenumber[state=3Dstop]\setupheadertexts= []\setupbackgrounds[page][background=3Dcolor,backgroundcolor=3Dred]},
= after=3D{\page[yes]\setuppagenumber[state=3Dstart]}]
\sta= rttext

% Let's process the summaries =  ;
= \beginComplementTwo
Last course, we have seen = A.
= \endComplementTwo

= \beginComplementThree
Last course, we have seen = B=E2=80=A6.
\endComplementThree

= \beginComplementThree
Last course, we have seen = C=E2=80=A6.
= \endComplementThree
% ---- 

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[ComplementTwo]
}

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

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

This is course 3 : a lot of pages = here about D... ! 

\stoptext

%=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80= =94=E2=80=94=E2=80=94=E2=80=94 

The only inconvenient of this solution if that I = have to define 15 blocks (one for each week of the term): ComplementOne, ComplementTwo, .., ComplementFithteen=E2=80=A6 Another = drawback of this is difficult to move one block form one = week to another if I change something. Each block = here correspond in fact to a summary of the previous course. So I = have typically around 10 pages of summary for each course. The challenge = is that the content of each course is not exactly the same = form one term to another, so I have to move a page to the summary = from one course to the other one, like in a given term, if = teach about subject C in course 3 :

= \beginComplementThree
Last course, we have seen = C=E2=80=A6.
= \endComplementThree

, but next term in course 4:

\beginComplementFour
= Last course, we have seen C=E2=80=A6.
= \\beginComplementFour

I have to manually = change \beginComplementThree =E2=80=A6 \endComplementThree to \beginComplementFour =E2=80=A6 \beginComplementFour.

But I = will do this if I do not find another = solution. 
Thanks = again Hraban.
Fabrice. 



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
_______________________________________________________________= ____________________

= --Apple-Mail=_0A5C20F0-7315-41C6-81A4-F02BA78F133B-- --===============3137767282945990797== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============3137767282945990797==--