Following instructions here, I have a new section mysection
. On this new section I want to apply a background created with MetaPost; for the sake of the question let's say this background is simply
\startuseMPgraphic{mysection}
StartPage ;
fill Page withcolor green ;
StopPage ;
\stopuseMPgraphic
So, in order to apply the the background to the section I remembered that answer and start playing around with it.
I commented out \globaldisablemode[mysectionpage]
in the pagebackground
setup and obtained the wanted green background on all the pages after startmysection
is used.
Let me show you in an example.
\defineresetset[myreset][][0]
\definehead[mysection][section=section-8, sectionresetset=myreset]
\setuplist[mysection][numbersegments=mysection]
\startuseMPgraphic{mysection}
StartPage ;
fill Page withcolor green ;
StopPage ;
\stopuseMPgraphic
\definelayer[mysection][width=\paperwidth, height=\paperheight]
\defineoverlay[pagebackground][\directsetup{pagebackground}]
\setupbackgrounds[page][background=pagebackground]
\startsetups pagebackground
\doifelsemode {mysectionpage} {
\setlayer[mysection][preset=lefttop]{\useMPgraphic{mysection}}
%\globaldisablemode[mysectionpage] <--------------------------
}{}
\placelayer[mysection]
\stopsetups
\startsetups mysection:before
\globalenablemode[mysectionpage]
\stopsetups
\setuphead[mysection][before={\page[yes]\setup{mysection:before}}]
\setuphead[section][before={\page[yes]}]
\starttext
\startsection[title=Section]
\dorecurse{3}{\input knuth}
\stopsection
\startmysection[title=My Section]
\dorecurse{15}{\input ward}
\stopmysection
\startsection[title=Section]
\dorecurse{3}{\input knuth}
\stopsection
\stoptext
As you can see, the background is applied on every pages after of the document after \startmysection
. That is the good part of the experiment. However, what I want to achieve is to have the background applied only on all the mysection
pages, not other section leveling. So the last page with a regular section
should have a white background.
I tried to put \globaldisablemode[mysectionpage]
in the else
part of \doifmodeelse
\doifelsemode {mysectionpage} {
\setlayer[mysection][preset=lefttop]{\useMPgraphic{mysection}}
}{\globaldisablemode[mysectionpage]}
and it did not work. Then I tried to create a setup for after
:
\startsetups mysection:after
\globaldisablemode[mysectionpage]
\stopsetups
it did not work either.
Then I thought I could move sections one level bellow to create mysection
:
\definehead[mysection][section=section-3,sectionreset=mysectionreset]
\definehead[section][section=section-4,sectionreset=sectionreset]
\definehead[subsection][section=section-5,sectionreset=subsectionreset]
...
and apply the same things. Did not work either.