Disable overlay on chapter pages
Hi, I'm trying to print chapter and section titles in the margins, and it works fine, except that the chapter title is also printed on the same page as the chapter starts, which I find unnecessary. 1) Can I somehow (probably via the right \setuphead trick) disable this overlay only on chapter pages? 2) If I want to disable it on another page, is there some smart way of doint it, or should I just set it blank and then enable it when I know I'm on next page again? /Mikael PS The code I have right now is given below. It compiles, but the chapter title is shown on the first page... \setuppagenumbering[alternative=doublesided] \defineoverlay[mymargin][{\framed[frame=off,width=0.8in,height=0.8\textheight,offset=overlay,align={top}]{\doifrightpageelse{{\startalignment[flushleft]\getmarking[chapter]\stopalignment}}{{\startalignment[flushright]\getmarking[section]\stopalignment}}}}] \setupbackgrounds[text][rightmargin][background=mymargin] \starttext \chapter{Foo} \dorecurse{15}{\section{Bar}\input ward\par} \stoptext
On 08/02/2017 12:00 PM, Mikael P. Sundqvist wrote:
Hi,
I'm trying to print chapter and section titles in the margins, and it works fine, except that the chapter title is also printed on the same page as the chapter starts, which I find unnecessary.
Hi Mikael, margintext as alternative for \setuphead may be a better approach: \showframe \setuppagenumbering[alternative=doublesided] \definemargindata[margintext:chapter] [margintext] [width=\rightmarginwidth, location=outer, align=flushleft] \defineheadalternative [margintext:chapter] [margintext] [margintext=margintext:chapter] \definemargindata[margintext:section] [margintext] [width=\leftmarginwidth, location=inner] \defineheadalternative [margintext:section] [margintext] [margintext=margintext:section] \setuphead[chapter] [alternative=margintext:chapter, style=\tf, number=no] \setuphead[section] [alternative=margintext, style=\tf, number=no] \starttext \chapter{Foo} \dorecurse{15}{\section{Bar}\input ward\par} \stoptext All this comes from Hans replying to a question of mine some days ago and from the last lines from typo-mar.mkiv. I hope I got it right ;-), Pablo -- http://www.ousia.tk
On Wed, Aug 2, 2017 at 7:21 PM, Pablo Rodriguez
On 08/02/2017 12:00 PM, Mikael P. Sundqvist wrote:
Hi,
I'm trying to print chapter and section titles in the margins, and it works fine, except that the chapter title is also printed on the same page as the chapter starts, which I find unnecessary.
Hi Mikael,
margintext as alternative for \setuphead may be a better approach:
\showframe \setuppagenumbering[alternative=doublesided]
\definemargindata[margintext:chapter] [margintext] [width=\rightmarginwidth, location=outer, align=flushleft]
\defineheadalternative [margintext:chapter] [margintext] [margintext=margintext:chapter]
\definemargindata[margintext:section] [margintext] [width=\leftmarginwidth, location=inner]
\defineheadalternative [margintext:section] [margintext] [margintext=margintext:section]
\setuphead[chapter] [alternative=margintext:chapter, style=\tf, number=no] \setuphead[section] [alternative=margintext, style=\tf, number=no]
\starttext
\chapter{Foo} \dorecurse{15}{\section{Bar}\input ward\par}
\stoptext
All this comes from Hans replying to a question of mine some days ago and from the last lines from typo-mar.mkiv.
I hope I got it right ;-),
Pablo
-- http://www.ousia.tk ___________________________________________________________________________________ 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 ___________________________________________________________________________________
Hi Pablo, many thanks for your answer! I think I might have described my issue a bit vague. Just to clarify: I do not want to change the output of the chapters/sections themself. I want to have a "running header", but in the margin rather than in the header. I get that with the code I gave, but I want to disable it for new chapters _on the page where the chapter begins_. If you have a copy of Bringhursts book, you know what I mean. If it is still not clear what I mean please ask me to clarify it further. /Mikael
On 08/02/2017 07:28 PM, Mikael P. Sundqvist wrote:
Hi Pablo,
many thanks for your answer! I think I might have described my issue a bit vague. Just to clarify:
I do not want to change the output of the chapters/sections themself.
I want to have a "running header", but in the margin rather than in the header. I get that with the code I gave, but I want to disable it for new chapters _on the page where the chapter begins_.
Sorry, Mikael, I misunderstood what you needed. I’m afraid I don’t know how to check whether you are in the chapter page or not. Pablo -- http://www.ousia.tk
Am 2017-08-02 um 19:28 schrieb Mikael P. Sundqvist
I do not want to change the output of the chapters/sections themself.
I want to have a "running header", but in the margin rather than in the header. I get that with the code I gave, but I want to disable it for new chapters _on the page where the chapter begins_.
I guess this is a case for setups. \startsetups[chapterpage] \setupheadertexts[][][][] \stopsetups \setuphead[chapter][setup=chapterpage] Something like this, I didn’t check. Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD
On Wed, Aug 2, 2017 at 10:23 PM, Henning Hraban Ramm
Am 2017-08-02 um 19:28 schrieb Mikael P. Sundqvist
: I do not want to change the output of the chapters/sections themself.
I want to have a "running header", but in the margin rather than in the header. I get that with the code I gave, but I want to disable it for new chapters _on the page where the chapter begins_.
I guess this is a case for setups.
\startsetups[chapterpage] \setupheadertexts[][][][] \stopsetups
\setuphead[chapter][setup=chapterpage]
Something like this, I didn’t check.
Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD
___________________________________________________________________________________ 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 ___________________________________________________________________________________
Thank you for your answer, Henning. I am sorry, but it does not work. The problem is that I don't have the marking text in the header, but in overlays in the margins. I tried to replace your \setupheadertexts[][][][] inside the setup with \setupbackgrounds[text][rightmargin][background=] but with no luck. But maybe you are right that one should use setups. /Mikael
Hi Pablo,
Dealing with the sample you has given to Mikael I find a difficulty on page 2 : if you replace 'Foo' and 'Bar' (three letters), by 'Introduction' and 'section', see what happen to 'section', page 2.
Here is your MWE :
\showframe
\setuppagenumbering[alternative=doublesided]
\definemargindata[margintext:chapter]
[margintext]
[width=\rightmarginwidth, location=outer, align=flushleft]
\defineheadalternative
[margintext:chapter]
[margintext]
[margintext=margintext:chapter]
\definemargindata[margintext:section]
[margintext]
[width=\leftmarginwidth, location=inner]
\defineheadalternative
[margintext:section]
[margintext]
[margintext=margintext:section]
\setuphead[chapter]
[alternative=margintext:chapter, style=\tf, number=no]
\setuphead[section]
[alternative=margintext, style=\tf, number=no]
\starttext
\chapter{Introduction}
\dorecurse{15}{\section{Section}\input ward\par}
\stoptext
----- Mail original -----
De: "Mikael P. Sundqvist"
Am 2017-08-02 um 19:28 schrieb Mikael P. Sundqvist
: I do not want to change the output of the chapters/sections themself.
I want to have a "running header", but in the margin rather than in the header. I get that with the code I gave, but I want to disable it for new chapters _on the page where the chapter begins_.
I guess this is a case for setups.
\startsetups[chapterpage] \setupheadertexts[][][][] \stopsetups
\setuphead[chapter][setup=chapterpage]
Something like this, I didn’t check.
Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD
___________________________________________________________________________________ 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 ___________________________________________________________________________________
Thank you for your answer, Henning. I am sorry, but it does not work. The problem is that I don't have the marking text in the header, but in overlays in the margins. I tried to replace your \setupheadertexts[][][][] inside the setup with \setupbackgrounds[text][rightmargin][background=] but with no luck. But maybe you are right that one should use setups. /Mikael ___________________________________________________________________________________ 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 ___________________________________________________________________________________
On 8/3/2017 10:35 AM, Jean-Pierre Delange wrote:
Hi Pablo,
Dealing with the sample you has given to Mikael I find a difficulty on page 2 : if you replace 'Foo' and 'Bar' (three letters), by 'Introduction' and 'section', see what happen to 'section', page 2.
Here is your MWE :
\showframe \setuppagenumbering[alternative=doublesided]
\definemargindata[margintext:chapter] [margintext] [width=\rightmarginwidth, location=outer, align=flushleft]
\defineheadalternative [margintext:chapter] [margintext] [margintext=margintext:chapter]
\definemargindata[margintext:section] [margintext] [width=\leftmarginwidth, location=inner]
\defineheadalternative [margintext:section] [margintext] [margintext=margintext:section]
\setuphead[chapter] [alternative=margintext:chapter, style=\tf, number=no] \setuphead[section] [alternative=margintext, style=\tf, number=no]
\starttext
\chapter{Introduction} \dorecurse{15}{\section{Section}\input ward\par}
\stoptext
----- Mail original ----- De: "Mikael P. Sundqvist"
À: "mailing list for ConTeXt users" Envoyé: Mercredi 2 Août 2017 22:33:16 Objet: Re: [NTG-context] Disable overlay on chapter pages On Wed, Aug 2, 2017 at 10:23 PM, Henning Hraban Ramm
wrote: Am 2017-08-02 um 19:28 schrieb Mikael P. Sundqvist
: I do not want to change the output of the chapters/sections themself.
I want to have a "running header", but in the margin rather than in the header. I get that with the code I gave, but I want to disable it for new chapters _on the page where the chapter begins_.
I guess this is a case for setups.
\startsetups[chapterpage] \setupheadertexts[][][][] \stopsetups
\setuphead[chapter][setup=chapterpage]
Something like this, I didn’t check.
\showframe \setuplayout [backspace=3cm, margin=2cm, width=middle] \setuppagenumbering [alternative=doublesided] \definemargindata [margintext:chapter] [margintext] [width=\outermarginwidth, location=outer, align=flushouter] \defineheadalternative [margintext:chapter] [margintext] [margintext=margintext:chapter] \definemargindata[margintext:section] [margintext] [width=\innermarginwidth, location=inner, align=flushinner] \defineheadalternative [margintext:section] [margintext] [margintext=margintext:section] \setuphead [chapter] [alternative=margintext:chapter, style=\tf, number=no] \setuphead [section] [alternative=margintext, style=\tf, number=no] \starttext \chapter{Introduction} \dorecurse{15}{\section{Section}\input ward\par} \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 -----------------------------------------------------------------
On 08/03/2017 06:03 PM, Hans Hagen wrote:
[...] \definemargindata [margintext:chapter] [margintext] [width=\outermarginwidth, location=outer, align=flushouter] [...] \definemargindata[margintext:section] [margintext] [width=\innermarginwidth, location=inner, align=flushinner]
Many thanks for your reply, Hans. I didn’t know that these margin widths and aligments even existed. Pablo -- http://www.ousia.tk
On Thu, Aug 3, 2017 at 7:29 PM, Pablo Rodriguez
On 08/03/2017 06:03 PM, Hans Hagen wrote:
[...] \definemargindata [margintext:chapter] [margintext] [width=\outermarginwidth, location=outer, align=flushouter] [...] \definemargindata[margintext:section] [margintext] [width=\innermarginwidth, location=inner, align=flushinner]
Many thanks for your reply, Hans.
I didn’t know that these margin widths and aligments even existed.
Pablo -- http://www.ousia.tk ___________________________________________________________________________________ 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 ___________________________________________________________________________________
Hi, that solves the other problem that appeared. What about the one I originally posted in this thread? Is it possible to pause backgrounds on chapter pages? /Mikael
On 8/3/2017 8:11 PM, Mikael P. Sundqvist wrote:
that solves the other problem that appeared. What about the one I originally posted in this thread? Is it possible to pause backgrounds on chapter pages? one of the many ways ...
\definelayer [chapter] [width=\paperwidth, height=\paperheight] \defineoverlay [pagebackground] [\directsetup{pagebackground}] \setupbackgrounds [page] [background=pagebackground] \startsetups pagebackground \doifelsemode {chapterpage} { \setlayer [chapter] [preset=middle] {\scale[width=\textwidth]{CHAPTER}} \globaldisablemode[chapterpage] } { \setlayer [chapter] [preset=middle] {\scale[width=\textwidth]{WHATEVER}} } \placelayer[chapter] \stopsetups \startsetups chapter:before \globalenablemode[chapterpage] \stopsetups \setuphead [chapter] [before=\setup{chapter:before}] \starttext \chapter{foo} test \page test \chapter{bar} test \page test \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 -----------------------------------------------------------------
On Fri, Aug 4, 2017 at 9:53 AM, Hans Hagen
On 8/3/2017 8:11 PM, Mikael P. Sundqvist wrote:
that solves the other problem that appeared. What about the one I originally posted in this thread? Is it possible to pause backgrounds on chapter pages?
one of the many ways ...
\definelayer [chapter] [width=\paperwidth, height=\paperheight]
\defineoverlay [pagebackground] [\directsetup{pagebackground}]
\setupbackgrounds [page] [background=pagebackground]
\startsetups pagebackground \doifelsemode {chapterpage} { \setlayer [chapter] [preset=middle] {\scale[width=\textwidth]{CHAPTER}} \globaldisablemode[chapterpage] } { \setlayer [chapter] [preset=middle] {\scale[width=\textwidth]{WHATEVER}} } \placelayer[chapter] \stopsetups
\startsetups chapter:before \globalenablemode[chapterpage] \stopsetups
\setuphead [chapter] [before=\setup{chapter:before}]
\starttext \chapter{foo} test \page test \chapter{bar} test \page test \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 ___________________________________________________________________________________
Many thanks! It now works as expected. Just if someone finds this thread in the future, to get the texts into the margin, I ended up with something like the code below. /Mikael \showframe \setuppagenumbering[alternative=doublesided] \setuplayout[ %alternative=doublesided, location=middle, width=10cm, backspace=2in, ] \definelayer [chapter] [width=\paperwidth, height=\paperheight, location=right] \defineoverlay [pagebackground] [\directsetup{pagebackground}] \setupbackgrounds [page] [background=pagebackground] \startsetups pagebackground \doifelsemode {chapterpage} { \setlayer [chapter] [x=\dimexpr\backspace+\textwidth+\rightmargindistance\relax, y=3in, location={right,bottom}] {\getmarking[chapternumber]} \globaldisablemode[chapterpage] } { \setlayer [chapter] [x=\dimexpr\backspace+\textwidth+\rightmargindistance\relax, y=3in, location={right,bottom}] {\doifrightpageelse{\getmarking[chapter]}{}} } \placelayer[chapter] \stopsetups \startsetups chapter:before \globalenablemode[chapterpage] \stopsetups \define[2]\mychaptercommand{\midaligned{#2}} \setuphead [chapter] [align=middle,style=\tfa,align=middle,command=\mychaptercommand,before=\setup{chapter:before}] \starttext \chapter{foo} test \page test \page test \page test \chapter{bar} test \page test \page test \page test \stoptext
participants (5)
-
Hans Hagen
-
Henning Hraban Ramm
-
Jean-Pierre Delange
-
Mikael P. Sundqvist
-
Pablo Rodriguez